← Lessons

quiz vs the machine

Gold1400

System Design

The Realtime State Sync

Keeping every client's view of the world consistent with the authoritative state.

5 min read · core · beat Gold to climb

Sharing the world

Realtime state sync is the loop that keeps each client's copy of the world matching the authoritative server. The server broadcasts snapshots of relevant entities, and clients render from them.

Snapshots and interpolation

  • The server sends a snapshot each send tick with positions and states of nearby entities.
  • Because packets arrive at irregular times, the client buffers a few and renders the past, called entity interpolation.
  • Interpolating between two known snapshots produces smooth motion even with jitter.

For the player's own character, prediction handles responsiveness, while other entities are interpolated for smoothness.

Reliability over UDP

  • State is usually sent over UDP because a late packet is worthless, do not wait for it.
  • Snapshots are designed so a dropped one is simply replaced by the next.
  • Critical events like a kill use a small reliable channel layered on top.

Key idea

Realtime sync broadcasts authoritative snapshots over UDP, and clients interpolate between them so motion stays smooth despite jitter and loss.

Check yourself

Answer to earn rating on the learn ladder.

1. Why do clients render slightly in the past using interpolation?

2. Why is UDP preferred for state snapshots?