Skip to main content

Prediction in multiplayer games

In order to avoid traffic-related lag in the gameplay, prediction is needed, i.e. locally running the identical game logic locally, as on the server side. Upfront, with zero lag.

Let’s demonstrate this with the following example.

The client sends an input, then wants to initiate an animation that lasts 100ms. Due to the fact that the client has to wait for a response from the server, the whole action takes 200ms, where the first 100ms the client waits for a response.


Without Prediction

No prediction

In order to eliminate the traffic-related lag, we have implemented the prediction mechanism in the Elympics SDK. This allows the game to run locally at the same time as waiting for acknowledgement of inputs from the server.


With Prediction


This way we can eliminate any multiplayer-related lag in local player movement, leading to the same response time as you get in a single player game. In our example the whole action takes 100 ms less than without the prediction mechanism.

That's it! 🎉

This however can lead to invalid state locally, which makes it really difficult to debug. Fortunately, Elympics SDK comes with prediction's best friend – reconciliation!