KatInterview

Designing a Live Trivia Elimination Game with Spectator Fan-Out

System DesignModel answer
MediumModel answerSystem Designsystem-designpartitioningfailure-recovery

Last updated

Design the backend for a live riddle battle: rooms partitioned by coordinator, server-authoritative timing, crash recovery, and spectator isolation.

You're building the backend for a live multiplayer riddle game ("Riddle Showdown"). Dozens to a few hundred players join a room together. Each round, a riddle is broadcast to the room with a fixed answer window. When the window closes, every player who answered incorrectly is eliminated, plus the slowest fraction of those who answered correctly. Play repeats until one player remains or riddles run out. Anyone — player or not — can open an in-progress room and watch a live leaderboard.

Design a system that supports:

  • Matchmaking: grouping waiting players into rooms, roughly balanced by skill, without excessive waiting.
  • Live round state: each player's alive/eliminated status and running score propagate to everyone in the room in real time.
  • Authoritative settlement: the server — not any client — decides who was correct and in what order, then applies the elimination rule.
  • Spectating: a spectator can join any in-progress room at any time and watch a live leaderboard without participating.

Non-functional requirements: round outcomes publish within a second or two of the window closing; scale horizontally to roughly 2,000 concurrent rooms of up to 300 players each; a crash in one room must not affect other rooms; a room that goes viral with tens of thousands of spectators must not slow or destabilize gameplay in that room.

State any additional assumptions you need and justify them. The interviewer cares most about partitioning and failure recovery, not exact API shapes.

Hints

Hint 1

The elimination math for one round only involves players in that one room — let that property drive your sharding key.

Hint 2

Clients lie about timing. Timestamp answers on the server at the moment of receipt, measured from a round-start time the server itself controls.

Hint 3

Write an answer to a durable, room-keyed log and only acknowledge it to the player after the write succeeds; replay the log on takeover.

Hint 4

Never let spectators subscribe to the gameplay process — publish a small leaderboard delta and fan it out through a separate tier.