Netcode Basics: Lag, Prediction and Interpolation
Why online games feel smooth even with delay: client-side prediction, server reconciliation, interpolation and lag compensation, explained simply.

Information needs time to travel. If a player's connection takes 80 milliseconds to reach the server and 80 to come back, a move you make is only confirmed after 160 milliseconds. If the game waited for that confirmation, controls would feel sticky. Netcode is the set of methods that hide the delay and make an online game feel instant and smooth.
Latency, jitter and packet loss
- Latency (ping): the time a message needs to go to the server and back
- Jitter: latency that changes from message to message
- Packet loss: messages that never arrive
Good netcode expects all three. It is tested with tools that add fake delay and loss to the connection, because a game that works on a fast office network can fail on a mobile network.
Client-side prediction
When you press forward, your own game does not wait. It moves your character at once, using the same rules as the server. This is called client-side prediction. In the meantime the input is sent to the server, which runs the same movement and sends back the official result.
Server reconciliation
Sometimes the server's result is different, for example because another player pushed you. The client then compares: where the server says I was at input number 120, and where I predicted. If they differ, the client corrects its position and replays the inputs it has sent since then. Done well, the correction is small and the player rarely notices.
Interpolation for other players
Other players cannot be predicted well. The game receives their positions 20 to 30 times a second, which would look jerky if shown as they arrive. So it shows other players slightly in the past, for example 100 milliseconds, and moves smoothly between two received snapshots. This is entity interpolation. It costs a little delay and gives smooth movement.
Lag compensation
If you shoot at a player you see on your screen, you are shooting at where they were 100 milliseconds ago. To make this fair, the server can rewind other players to the time you fired and check the hit there. This is lag compensation. It favours the shooter, and designers tune it carefully.
Other tools
- Dead reckoning: guess where a car will be from its speed and direction until a new update arrives
- Delta compression: send only what has changed
- Tick rate: how many times a second the server updates, for example 30 or 60. A higher rate is smoother but costs more bandwidth and server power
- Priority: nearby and important objects are updated more often than far ones
These methods work on top of the client-server architecture. Vehicles are a hard case because they move fast and collide (vehicle physics). See also how online open-world games are made.
Frequently asked questions
What is client-side prediction?
The player's own game moves the character immediately without waiting for the server, using the same rules as the server. When the server's answer arrives, the game corrects any difference.
Why do other players look smooth in online games?
The game shows other players a little in the past and moves them smoothly between the last two updates it received. This is called interpolation.
What is tick rate?
Tick rate is how many times per second the server updates the game. A higher tick rate makes the game more responsive but needs more bandwidth and server power.

