Hi,
I’m fresh new to Unity, been around a month since I installed it and started messing around, now I’m planing on creating a FPS multiplayer online game.
My current view of the project is to split into 2 projects, Server and Client, don’t want to have server code in client project to prevent reverse engineering (I know it’s still possible in other ways), Server will have no GUI, just start the exe and forget it.
I want the server to be authoritative, make it aware of the physics and map of the game, so basically clients are just terminals that send inputs, buffer 100ms of game and interpolate state.
I’ve read couple tutorials on networking in unity and using authoritative server and such, but they’re all old ones that use older Unity versions (before Unity5), so they used Network View.
Does anyone have guides and tutorials on creating such game with Unity 5, separated projects for server and client along with buffering??
You might be amused to know how often we hear that.
Sadly, they all seem to disappear when they find they’re in way over their head. On the difficulty scale, if creating recreating Space Invaders is a 1, Mario Bros is a 3, Doom is maybe an 8, and an online FPS client/server game is probably a 30 or so.
So, if you’re planning to accomplish the 30, go ahead and do Space Invaders and Mario Bros first, since they only add 4 to your total effort. And then do Doom, since that’s only adding 8 more, but really less than that since much of the effort that goes into that will be directly usable for the 30.
In other words, quit worrying about the dream game which, if you work hard, you’ll be ready to start in in a year or so, and spend that time creating lots of simpler games to level up your skills. You’re like a level 1 fighter proposing to go out and slay the level 30 dragon. Smarter to bag some bunnies first and work your way up, no?
I’m fresh to Unity but not fresh to programming or learning new stuff, during the month since I downloaded Unity I was able to get hold of the basic concepts and created a small maze game where you run around a maze and can leave marks on ground and there are some walk through walls, next thing I wanted to add for it is portals.
I’m not planing to create the next online FPS, just something to mess around at university with friends, I already have read many many articles online on how the server/client should operate along with smoothing and buffering, but all of them were concepts with no demo, let alone some were working in the lower levels such as compressing packets http://gafferongames.com/networked-physics/introduction-to-networked-physics/
I really appreciate your advice, but I’m still planing on making a server-client game.
How many points an online multiplayer space invaders would get??
(incidentally, since you already know how to program then you should checkout my book Unity in Action. It sounds like you already know the basics covered in the first few chapters, but there’s plenty of other stuff you probably still want to learn.)
Yep, I certainly don’t mean to discourage you, it sounds like you’re off to a great start.
One more suggestion though, if you’ll allow it: consider building your FPS game around tanks (or UFOs, or other simple vehicles) rather than heavily armed commandos. That avoids all the problems of character animation and control, letting you focus on the networking, collision detection, and all that other stuff, while still making a very fun game.
That’s why I didn’t answer this thread initially. It was clear to me you knew what you were talking about, and I didn’t know how to advise you moving forward!
Actually, I think I just grokked this question. You mean on my little difficulty scale, where space invaders is a 1, and an online FPS is a 30?
That’s actually a great question, and probably a project worth doing. I’d say it’s probably a 10 or so. You have all the difficulties of writing a server, defining your protocol, deploying and testing the coupled apps, dealing with lag and synchronization issues, etc., but the rest of the game is just a bunch of simple sprites.
How to make multiplayer space invaders interesting is another question… probably one for the Game Design forum!
Oh, I agree with the animation part, I’ll probably make the characters as android mascots to avoid animations, it’ll be just rotations.
Do you think I should implement my own networking protocol? like just using a UDP listener and then manually serialize and deserialize them to objects? this approach would give the lowest packet size if implemented correctly, but implementing is the hard part, is it worth it?? or should I just use the built in sync and protocols?? do you happen to have study/search materials that can help?
And to one of my biggest questions, can I create a separated projects in Unity for Server and Client? I remember reading somewhere that if Server didn’t share code with client then it’ll be sending the whole prefab on every first sync (or I miss understood that), and how would I make my Server run without GUI? prefer if there’s a method to build it as a .dll with some interface to provide info, maybe I’ll think of adding a managing system to it.
The last time I did networking in Unity was before the new UNET stuff, and it was very low-level. That approach certainly still works, but I know the Unity folks have put a lot of effort into making UNET performant and easy to use.
So I would recommend you start with that, and roll your own implementation only if you find UNET lacking in some fundamental way.
Since I’ve never used UNet, I’m not sure what restrictions (if any) it imposes on a separate dedicated server project. When I did it, I wrote the server in C# and compiled it to a command-line app with Xamarin Studio. It shared code with the Unity project, but that’s all — which actually made it quite convenient to debug and run them both at once.
But I’ll bow out now and let somebody who actually knows something about UNET jump in… or you could just dig in yourself and see how it goes!
UNet is the way to go. UNet is set up so you only use a single build, typically you would use an if (server) type approach. But that’s the high level side. UNet also exposes a low level API you can use for greater control.
I’ve read about the if (server) approach and personally didn’t like it, using it this way means the server code is included in the client, and I don’t want to do this. also when updating some server side stuff that means a new version is created and all clients will have to update version, I know if I didn’t change client code then old clients will work, but the update program we’re designing will tell user there’s a new version.
The thread is really awesome, thanks for the link. I’m considering your book for now, but probably will buy it after my mid term exams.