Multiplayer Game Networking
The cluster discusses techniques for handling latency, synchronization, and simulation in real-time multiplayer games, including client-side prediction, server reconciliation, rollback netcode, and authoritative servers.
Activity Over Time
Top Contributors
Keywords
Sample Comments
That sounds a lot like the "client side prediction" that modern multiplayer games do.
Nice, but doing everything server side kills the game unless you have really low latency. You should synchronise clocks between the players, then run the game physics client-side, and resolve conflicts after-the-fact.
The server runs at ~100 FPS, but things like worker updates and attacks happen at a 1.5 second interval. Only the changes (like walking a step, collecting a resource) are sent to the client(s). There is no client side prediction. There is no specific aiming on targets like in FPS games, just need the opponent id, so don't really need to do that Team Fortress thing.
are there any affordances for prediction or replay? you could try to help network latency by having the server resimulate a small period of time roughly equivalent to the client's network delay - it's not perfect without client-side prediction but it could help
The synchronization is one way only. The server sends the authoritative world state to your client. Your client only sends your inputs to the server, not the results of those inputs, and the server validates your inputs by running them through the game engine. Modifying your local copy of the simulation will just desynchronize you from the server, forcing a resync.
I think you should implement client-side prediction, it feels very laggy.https://developer.valvesoftware.com/wiki/Prediction
It's generally simpler to do everything server side then it is to try to keep x clients synchronized in their simulations of everything (physics, random number generation, multiple players all contributing movement and such)
Re. client side prediction and server reconciliation, may I recommend https://gabrielgambetta.com/client-server-game-architecture....? Even if you don't roll your own solution, it might be worth understanding the theory so you can use these libraries correctly.
Because of client-side interpolation and prediction, the client isn't on the same game state as the server, just an approximation of it. It's the tradeoff you have to make for a smooth game experience.The server can do a best effort attempt at rewinding the game state and take into account how the client is interpolating the world, but it gets very complicated as game complexity goes up.Someone correct me if I'm wrong, but I believe the Source engine does that for the attack
Just do everything with integers. RTS games of the 90's did it. They were able to sync 8 PCs across the world to run the same historical simulation (think Age of Kings) by passing nothing more than mouse clicks and keyboard presses over peer to peer. Determinism is king in lockstep programming