I want my game to be fully server-side. Meaning, the client only sends its keystrokes. Then they are provided with updates to the positions of changed objects from the server. Then the client displays all the frames.
This is a 2D game.
I was thinking of something like this: compute an intermediate frame using Box2D and not try to predict where the server actually will be.
ServerPos β ClientPos β ServerPos β ...
If by a certain time we have not received a packet (dropped or something else), we simply simulate the next frame on the client. The idea is to avoid the server always correcting our position. We want the client to populate inbetweens, but not try to predict where the server will be.
We want the player to move in the opposite direction at any cost, because the client simulated, so we could multiply the resulting vector by a scalar, for example, 0.98, which would mean that the client would be slightly slower than the server, and help ensure a smooth transition to the server position.
thanks
source share