Build a Real-Time Multiplayer Game State Sync System
distributed-systems performance reliability
System Design Deep Dive
Multiplayer Game State Sync
How to keep all players in sync under 100ms when the network is your enemy.
Imagine two players shooting at each other across the internet. Player A in Tokyo fires at Player B in New York. The shot leaves Tokyo at time T. It travels 150ms across the Pacific before reaching New York’s server. Player B, whose client is only 10ms from the server, has already moved. From the server’s perspective, B is safely behind cover when the shot arrives. From A’s perspective - seeing the world 150ms in the past - B was fully exposed when A pulled the trigger. Who is right?
This is the fundamental tension in real-time multiplayer game design. Every player sees a slightly different version of the game world, lagged by their network round-trip time. A player with a 200ms ping sees the world 100ms older than a player with a 20ms ping. Without compensation, fast-network players have a systematic unfair advantage: they see and react to the current world while slow-network players aim at ghosts.
At 64 players per match running at 20 game ticks per second, a server is processing 1,280 state updates per second and broadcasting roughly 640KB/s of authoritative game state per match. At 10,000 concurrent matches - a modest mid-tier multiplayer game - that is 6.4GB/s of outbound UDP traffic, not counting the inbound input stream. Every packet must be processed, validated, and broadcast within 50ms or the game feels broken. Real systems like Valve’s Source Engine, Overwatch, and Unity Netcode for GameObjects have each solved this at production scale.
We need to solve for sub-100ms update cycles across all 64 players, lag compensation that gives 200ms-RTT players a fair shot, and graceful disconnect recovery that lets a player reconnect mid-match without corrupting the game state. These three problems pull in different directions and must be solved simultaneously.
Requirements and Constraints
Functional Requirements
- Synchronize game state across all players in a match with consistent world view
- Apply lag compensation so a player’s hit detection is evaluated at the moment they fired, not when the packet arrives
- Support up to 64 players per match instance
- Recover player state if a player disconnects and reconnects within 60 seconds
- Broadcast authoritative state to all clients at 20 ticks per second (50ms tick interval)
- Validate all player inputs server-side - no client-trusted physics or hit detection
Non-Functional Requirements
- Update latency: server processes each game tick in under 16ms, broadcasts within 50ms of tick completion
- Player capacity: 64 players per match, 10,000 concurrent matches per deployment cluster
- Network RTT support: correct gameplay for players with up to 200ms round-trip latency
- Uptime: 99.9% per match instance - a crash mid-match is a bad player experience
- Reconnect window: player state preserved for 60 seconds after disconnect, full state resync on reconnect
- Bandwidth: 500 bytes per player per tick (with delta compression) = 640KB/s outbound per match
Constraints and Assumptions
- We use UDP for all real-time game packets and TCP only for control-plane messages (session setup, reconnect handshake)
- The game server is authoritative - clients never trust their own physics results
- Clients run local prediction but reconcile with server state on every tick
- Clock synchronization across server and clients uses NTP with drift correction; we do not require hardware clocks
- Match state is not globally replicated in real time - it lives entirely in the game server’s memory during play
High-Level Architecture
The system comprises six components: the Game Client, UDP Gateway, Authoritative Game Server, State Broadcast Service, Reconnect State Cache, and Match Coordinator.
The Game Client sends player input packets to the UDP Gateway at up to 60 frames per second. Each input packet contains the action (move, fire, jump), the client’s local sequence number, and a client-side timestamp. The UDP Gateway validates the session token, rate-limits malformed packets, and forwards valid inputs to the Authoritative Game Server over a reliable internal channel.
The Authoritative Game Server runs a fixed-rate game loop at 20Hz. Each tick it dequeues all pending inputs, applies them to the canonical game state with lag compensation applied, runs collision detection and physics, and produces a new authoritative state snapshot. The State Broadcast Service takes the delta between this snapshot and the previous one, compresses it, and fans it out to all 64 clients via UDP.
The Reconnect State Cache (backed by Redis) stores the last 60 seconds of state snapshots for each match. If a player disconnects, their session slot is held. When they reconnect, the cache replays the current state to bring them back in sync.
The Match Coordinator handles pre-match setup: picking a game server pod, assigning player session tokens, and routing the 64 clients to the correct UDP Gateway endpoint. After the match starts, the Coordinator is out of the hot path entirely.
The Match Coordinator is only involved at match creation and termination. Once the match runs, all 64 players talk directly to a single game server process. This keeps the hot path to a single network hop: client to game server and back. Any intermediate routing would add latency that compounds badly at 20Hz.
Premium Content
Unlock the full article along with everything else in the archive — all in one place.