KatInterview

Elimination Quiz Arena: Scalable Live Game Backend Design

System DesignModel answer
MediumModel answerSystem Designsystem-designreal-timewebsockets

Last updated

Design a backend for elimination-style live quiz games with many players per room, fair timing, crash recovery mid-round, and spectator traffic kept away from gameplay.

You are asked to design the backend for an online quiz game played in elimination format.

How a game works

  • Between a few dozen and a hundred or more players are placed together in one room.
  • Questions are shown one round at a time. Each round has a fixed answer window.
  • When a round closes, anyone who answered incorrectly is removed, and so are the slowest of the players who answered correctly.
  • The game continues until one player remains. That player wins.
  • Anyone can watch a game in progress and follow its live leaderboard without taking part.

Required capabilities

  1. Matching: place waiting players into rooms with others of similar skill.
  2. Live state: each player's status (still in or out, current score) is updated in real time for everyone in the room.
  3. Round resolution: compute eliminations at the end of every round, then produce the final ranking and winner when the game ends.
  4. Spectating: let viewers open any running room and follow its leaderboard.

Non-functional goals

  • Low-latency updates inside each round.
  • Horizontal scaling as the number of rooms grows with the player count.
  • Isolation: a fault in one room, or a surge of spectators, must not degrade other rooms or the players in the same room.

What to cover

  • Only the room size is specified. State your own assumptions for concurrent rooms, players and spectators, and design for them.
  • The discussion will concentrate on how work is divided among servers and how you recover when a server dies mid-game. Detailed API design is less important.
  • Make explicit decisions on the open points: how many slow players are removed per round and what happens when everyone is wrong, how answer speed is measured fairly, and whether a disconnected player can rejoin.

Hints

Hint 1

Make the room the unit of everything: one room is owned by exactly one game server at a time, which keeps ordering and settlement simple. Then ask how ownership is assigned, renewed, and taken away.

Hint 2

For fairness and recovery, think about what must be durable before the server acknowledges an answer or closes a round, and how a new owner can rebuild a room from a snapshot plus an append-only log of events.

Hint 3

Treat spectators as a separate read path: publish already-settled state to a pub/sub or cache tier and fan out through edge or gateway servers, so spectator load never touches the game server's hot loop.