THNK icon indicating copy to clipboard operation
THNK copied to clipboard

Rollback-based networking support for the platformer behavior

Open arthuro555 opened this issue 3 years ago • 0 comments

The network is slow. Even on the speediest connections, there is a slight delay between a message sent from a client and the moment the server receives it. Especially on lower-grade connections, this delay can completely destroy a user's game experience: if a client sends a jump input a few moments before falling into a pit, if the delay is high enough, the server won't allow the jump to be done because he already fell off, even though it was valid at the time the player pressed the button.

To help with that, THNK would make snapshots of the platformer behavior's state every frame, e.g. The position of the character, and the platform it is standing on (if any), and save them for the last few server ticks. When it is time for the platformer behavior to handle inputs, we'll revert the state of the server to that of the tick at which the player did the input. That way, we can prevent unfair behavior due to latency 😎

arthuro555 avatar Aug 03 '22 16:08 arthuro555