I have a game loop that sends new positions of every player to other players.

But there is no guarantee that the users will send the server their new positions at the same time. Actually if their connection is slow or some errors happen inbetween, then the data of the clients will flow to the server in a very varying way for every other user.

My question is, how should I handle so varying data on the server, and decide who should win in a fast-paced multiplayer game. Is the key, timestamp of the requests (seems like it is widely open to cheating), or just the clients sending me directions where they go, and their actions like pressing a button etc?

I've read lots of articles on the web, but none of them seems to completely cover the subject.

PS: I just want to decide on the server side, what should be the next 'frame' in the game by applying the game scenario to the user inputs.


1 Answer 1


Common approach, as you suggested yourself, is to make clients send only their inputs and view angle(for FPS games), then handle all events on a server and send updated information back to the clients. However, with this approach player could experience very unresposive controls due to ping. This could be solved by using server data only as a synchronization fallback in case of a big deviance from the server state and calculating game information in parallel to the server. For example, you could let player move freely on the client side and send his inputs to the server. Then every packet you check if difference between server state and client state is too big and move player accordingly to synchronize client and server. Also, predicting movement of the opponents is a good way to hide most of the problems you encounter with bad server-client connections.

  • \$\begingroup\$ There are many networking questions on stackexchange, have none of your searches found anything that helped to explain how other games handle this? \$\endgroup\$ Dec 1, 2018 at 0:27
  • \$\begingroup\$ @PatrickHughes the question was not about how other games handle this. \$\endgroup\$
    – Ocelot
    Dec 1, 2018 at 6:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .