I am trying to figure out a good way to handle latency, in a multiplayer side scrolling type game.
Right now, the client is basically a “dummy terminal”- it just sends it’s input changes to the server, the server handles them, and send to everyone the results of what happened.
Additionally, the client also pre-calculates for smooth movement- when they push left, they move left, until they get a response from the server if they are actually in the same spot they think they should be in.
But of course, if the client handles something instantly, and it takes time to get to the server, they are always slightly off. If I have some acceleration/ deceleration on the characters, I can eventually make them “stop faster” on the server if the client stopped, when the server had assumed they would keep moving.
But my main question is, what is a good way to handle discrepancies? If the client if slightly ahead of the server, should I slow it down slightly for the server to catch up, and vice versa? If The client becomes too unsynced with the server, is there any way to re-synch them up without just popping them into place?
Are there any other good articles on “latency hiding” aside from the one from valve (https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking ), and gaffron games(http://gafferongames.com/networking-for-game-programmers/) ?