I'm currently planning a simple online multiplayer game. And here is the question. Does it make sense to make the whole game logic on the server and just send the input from the client to the server? Which are the pros and the cons or are there any reasons why I shouldn't do that?
|
You don't want to send player input to the server. What you probably want to do is send an abstracted representation of what the player wants to do to the server, and then run the logic on there. Likewise you don't necessarily want to send back everything the client needs to do. For example, you can send some kind of message saying "NPC X died", and the client determines what animation/sounds to play. Stuff like that. The trick is to find the line where bandwidth and processing power (on the server) is trumped by preventing people from cheating. Usually you make any kind of game-changing authoritative decision on the server only, and leave all the ancillary visual stuff to the client. There are a lot of more specific questions on this topic all over the site. For example: Should collision detection be done server-side or cooperatively between client/server? Who does the AI calculations in an MMO? Should the game host be the authority, or another dumb client? |
|||||
|
|
Well, you got answers but your real answer is at "try yourself". The things differ from game to game. I did couple of multiplayer games for some distributed network game design course. The most challenging was doing a realtime action game where many players involved and sending inputs like hell. When it comes to that point, everything becomes problem. As you see the first link Tetrat sent, even determining a collusion becomes a problem. And you will read-hear terms like lag, interpolation, extrapolation, prediction... But if you never tried yourself coding from scratch, you will just accept these words and wouldn't know what they really mean. My recommendation is: Step 1 Step 2 Step 3 Well, net has many tutorials and things about this subject. But there are 2 I really like: Really good, covers dark spots: Valve-Source Engine Multiplayer Networking |
|||
|
|
|
Pros:
Cons:
|
|||
|
|
Server side logic also creates scalability problems - you have to do all the work for all the clients on your server - verses letting each client do his own share of the total work. |
|||
|
|
|
Depends on what game you want to create and what part of the game. If developing an RTS (or any game with a lockstepped model), then you definitely should only send the input and which simulation step the input was recieved. If you want to do a shooter you could use both input and abstract functions. If you take Unreal Tournament 3 as the case, they created the multiplayer mainly via replicated function calls. And for non-RTS games, remember client prediction. |
|||
|
|