← Lessons

quiz vs the machine

Platinum1760

System Design

The Delta Compression Of State

Shrinking snapshots by sending only what changed since a known baseline.

5 min read · advanced · beat Platinum to climb

Full snapshots are wasteful

Sending the entire world state every tick wastes bandwidth, since most of it did not change. Delta compression sends only the difference between the current state and a baseline the client already has.

How deltas work

  • Each snapshot is encoded relative to a previously acknowledged snapshot.
  • Only fields that changed are written, often with a bitmask marking present fields.
  • The client applies the delta on top of its baseline to reconstruct the full state.

The hard part is the baseline. The server must know which snapshot each client last confirmed, so it can diff against exactly that.

Handling loss

  • Over lossy UDP, an unacknowledged baseline cannot be used, or the client would apply a delta to the wrong base.
  • The server tracks per client ack of the latest snapshot it received.
  • If acks fall too far behind, the server sends a full snapshot to resync.

Key idea

Delta compression sends only fields that changed since a per client acknowledged baseline, cutting bandwidth while needing reliable ack tracking.

Check yourself

Answer to earn rating on the learn ladder.

1. What does delta compression send?

2. Why must the server track each client's acknowledged baseline?