The latency problem
With a pure authoritative server, every keypress must travel to the server and back before the player sees movement. At one hundred milliseconds of round trip, controls feel like wading through mud.
Client side prediction fixes this by letting the client run the same simulation locally and apply its own input immediately, without waiting.
How it works
- The player presses move, and the client predicts the new position at once.
- The same input is also sent to the server tagged with a sequence number.
- The client keeps a buffer of unacknowledged inputs so it can correct later.
The local result is a guess that should match what the authoritative server will compute, because both run the same deterministic rules.
Why it usually works
- Most inputs are predictable, like walking forward on flat ground.
- The server runs the same code, so the prediction is right the vast majority of the time.
- When the guess is wrong, reconciliation corrects it, covered in the next lesson.
Key idea
Client side prediction applies inputs locally and instantly while still sending them to the authoritative server, hiding round trip latency.