Lesson 3 of 9 · 25m
Snapshots, Interpolation, and the Remote-Entity Illusion
Build believable remote players from delayed snapshots using interpolation buffers, delta compression, and controlled extrapolation.
Remote players do not exist in the present on your screen. They exist a little in the past, reconstructed from packets that arrived late, out of order, or not at all. Good netcode hides that uncomfortable fact. Bad netcode draws remote players at whatever time the last packet happened to describe and then wonders why they teleport.
Snapshots are samples, not continuous truth
A server snapshot captures state at a tick. It might be full or delta-compressed against an earlier snapshot the client acknowledged. The client receives a series of samples:
tick 100 pos x=10.0 vel=4.0
tick 102 pos x=10.8 vel=4.0
tick 104 pos x=11.6 vel=4.2If the server runs at 30 ticks per second, tick 100 and 102 are about 67 milliseconds apart. Rendering every packet as it arrives produces hitching because packet arrival is jittery even when simulation time is regular.
Interpolation deliberately adds delay
The standard trick is to render remote entities behind the newest snapshot by an interpolation delay — often around two snapshot intervals, then adapt for jitter. You keep a buffer of states and interpolate between the two surrounding the render time.
def sample_remote(buffer, render_time):
newer, older = buffer.bracketing_samples(render_time)
if newer is None:
return buffer.newest() # no good choice; freeze or extrapolate briefly
span = newer.time - older.time
alpha = (render_time - older.time) / span
return older.lerp(newer, alpha)The added delay is not a failure. It is the cost of converting jittery packet arrival into smooth motion. Players already pay this cost for remote entities whether you admit it or not; the only question is whether it is controlled.
Extrapolation is a calculated lie
When packets stop arriving, interpolation has no future state to approach. You can freeze, extrapolate velocity briefly, or hide the entity. Extrapolating too far makes players appear inside walls or surviving shots that server truth says missed. In competitive games, keep extrapolation windows short and prefer predictable degradation.
loss under 80 ms usually invisible behind interpolation
loss 80-200 ms extrapolate cautiously or tighten buffer adaptation
loss over 200 ms stale state is visible; prioritize correctness over smoothnessThose numbers are starting points, not commandments. A tactical shooter tolerates less error than a co-op horde game.
Delta compression needs acknowledgment discipline
Sending full snapshots is simple and expensive. Delta compression sends changes relative to a baseline the client confirmed receiving:
server snapshot 140:
baseline=132 acked_by_client=true
changed_entities=[7, 9, 21]
events=[damage:9, reload:7]If the baseline was lost, the delta is unusable. Track per-client acknowledgments and resend a full or larger baseline when needed. Sequence numbers must account for unreliable UDP delivery and reordering; "latest packet wins" is not enough when deltas depend on history.
Events are not the same as replicated state
A muzzle flash, hit sound, door opening, or death cam is often better represented as an event than by inferring it from state differences. Events need ordering, deduplication, and lifetime rules. State needs convergence. Mixing those two concerns produces ghosts: effects replayed because a state packet repeated, or missing effects because a delta looked unchanged.
Field notes
- Interpolate position and rotation separately from animation state; visual pose often needs its own smoothing.
- Interpolation delay that adapts too aggressively feels like rubber-banding even when packets are fine.
- Do not interpolate through teleports, spawns, or dimension changes. Mark discontinuities explicitly.
- A remote player's smoothness is not evidence of correctness. Compare render time against server tick time when debugging hits and collisions.
Was this lesson helpful?