Design a Multiplayer Game Server (FPS / battle royale)
Authoritative game server: tick-based simulation, lockstep / client-prediction, regional matchmaking, anti-cheat, and ~100 ms p95 round-trip.
Intro
A real-time multiplayer game server (Fortnite, COD Warzone, Valorant) runs an authoritative simulation at 60 Hz tick rate per match. Players send inputs, the server simulates and broadcasts state, clients render with prediction + reconciliation. The hard parts are sub-100 ms RTT to all players in a match, anti-cheat, regional matchmaking, and the ops complexity of running thousands of stateful servers.
Functional
- Matchmaking — group N players into a match by skill + region.
- Authoritative server simulates the game at 60 Hz.
- Receive inputs + broadcast state with prediction / reconciliation.
- Persist results — XP, stats, leaderboards.
Non-functional
- Round-trip p95 < 100 ms (regional).
- 60 Hz tick = 16.67 ms simulation budget per tick.
- 100 k concurrent matches × ~50 players = 5 M concurrent players.
- Anti-cheat — server is authoritative; client-side detection complementary.
Components
Matchmaker
Skill + region grouping; emits match assignments.
Game server fleet
Per-match dedicated server (UDP).
Session orchestrator
Spins up game servers (Kubernetes / Agones).
State broadcaster
60 Hz delta updates over UDP to clients.
Anti-cheat
Server-side validation + client kernel module (BattlEye / EAC).
Persistence
Leaderboards, XP, match history.
Trade-offs
Authoritative server vs lockstep
Pros
- Authoritative: anti-cheat-friendly, smaller messages.
- Lockstep: deterministic; lower bandwidth.
Cons
- Authoritative: server CPU.
- Lockstep: any desync = game over.
TCP vs UDP for state sync
Pros
- UDP: no head-of-line blocking; correct trade for real-time.
Cons
- UDP: own loss + ordering layer.
Scale concerns
- Tick-rate budget — 16.67 ms includes simulation + serialization + send.
- Regional servers — no cross-region match (latency bomb).
- Anti-cheat arms race.
- Match orchestration — start servers in < 5 s after match found.