I'm trying to make a multiplayer platformer game. I can almost get client side prediction and server reconsiliation to work, but there is one issue that I just can't wrap my head around.
Lets say that the following scenario takes place.
- The server is running at a tick rate of 30 fps.
- State updates are being sent at a rate of 10 fps.
- Player movement events are being sent at a tick rate of 30 fps.
The player movement event consists of two fields
jump. Which tells the server what directions the player wants to move in. Now lets say the player presses the jump button and then mid-air decides to move sideways. This becomes very problematic as the client starts to move the player instantly. Meanwhile, the server starts to move the player a bit later, due to latently. Eventuelly missing one or two ticks. This leads to gravity pulling the player further downwards on the server before moving sideways, then on the client.
When the server sends the next state update that means the state is massively out of sync because in the servers eyes the player started moving left a bit later then they actually did. Here is a image that describes the situation better:
This problem have kept me up at night, because I can't see a single way the client is going to handle this without ending up the "wrong" position. I've tried multiple forms of client side correction. My most promising solution that still failed were:
- On the server when receiving a player event. Go back in time to the state that was current when that event was sent. Then reapply every event from that point on the server side. This seems like it would work but didn't for some reason.
This seems like such a fundamental flaw of networked game that I can't understand how ANY networked game works what so ever.
Any help would be very appreciated 🙂