Design a Real-Time Multiplayer Typing Race Game

Quick Overview

A system design interview question about the backend of a real-time multiplayer typing race game. It covers storage for live and finished races, matching players, handling race conditions, enforcing a freeze effect, and scaling and recovering when a player disconnects or a game server fails.

Design a Real-Time Multiplayer Typing Race Game

Company: OpenAI

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Technical Screen

Design the backend of an online multiplayer typing race game. Assume the usual format: players are matched into a race, everyone types the same passage, each player watches the others' progress while typing, and the race ends with a ranking. The interviewer asked how game data is stored, how matching works, how race conditions are handled, how to implement a freeze, how the system scales, and how it handles failures such as a player who disconnects mid-race and needs to recover. The source gives no scale numbers and does not define the freeze, so settle both with the interviewer before designing. ### Clarifying Questions - How many players join one race, and how many concurrent races and online players must the design handle at peak? - Is matching based on skill (for example typing speed), on whoever is waiting right now, or on invitations from friends? - What does "freeze" mean in this game: an effect that stops one player's typing for a while (such as a penalty, or a power-up used against an opponent), or freezing a whole race? - How quickly must players see opponents' progress? - How long are race results kept, and do they feed ratings or leaderboards? ### Part 1: Game flow, APIs and storage Describe the life of a race from queueing to results, the protocol between client and server during a race, and how you store players, passages, live race state and finished results. ```hint Separate hot and cold data Some data changes many times per second during a race and some is written once when it ends. Store each where its access pattern fits. ``` #### What This Part Should Cover - Race states and the transitions between them. - The real-time protocol, and which side decides progress and finish times. - Storage for live race state versus durable records. ### Part 2: Matching How are players matched into races? ```hint Waiting time versus match quality Decide what happens to a player who has waited a long time without a close match. ``` #### What This Part Should Cover - The queue structure and the matching rule. - The trade-off between waiting time and match quality. - Keeping a player out of two races at once. - Assigning a matched group to the server that will host the race. ### Part 3: Race conditions Handle race conditions in the game, for example two players taking the last open seat in a race, a join that arrives just as the race starts, or finish messages from several players arriving within a few milliseconds of each other. ```hint Pick one writer For each piece of race state, decide which component may change it and in what order changes apply. ``` #### What This Part Should Cover - Where each race's state changes are serialized. - Idempotency and ordering of client messages. - Deterministic handling of near-simultaneous finishes. ### Part 4: Implementing freeze Implement freeze. Settle what is frozen first (see the clarifying questions), then design how a freeze is triggered, enforced, shown to clients and ended. ```hint Enforce it where the clock lives Consider what happens if a frozen client keeps sending keystrokes, or if the freeze message reaches clients at different moments. ``` #### What This Part Should Cover - Enforcement and expiry on the server. - How clients learn about and display the freeze. - Interaction with reconnects, race end and overlapping freezes. ### Part 5: Scaling and failure modes Scale the design to many concurrent races, and walk through its failure modes, including a player who disconnects mid-race and reconnects, and a game server that crashes while hosting races. ```hint Make a race rebuildable Ask what a reconnecting client or a replacement server would need in order to pick up a race in progress. ``` #### What This Part Should Cover - Horizontal scaling of game servers, matching and connections. - Reconnection and resynchronization for a dropped player. - Recovery when a game server or the live-state store fails. - Monitoring of the real-time path. ### What a Strong Answer Covers - Server authority over progress, finish times and freezes. - One owner per race so that concurrent events apply in a single order. - Storage that separates live race state from durable history. - Defined behavior for disconnects and server crashes, with its cost. ### Follow-up Questions - How would you detect players who paste text or use scripts to fake typing speed? - How would you add spectators to a popular race without overloading its game server? - How would you keep a global leaderboard of best speeds up to date? - How would you let players in different regions race each other with fair latency?

Overview: A system design interview question about the backend of a real-time multiplayer typing race game. It covers storage for live and finished races, matching players, handling race conditions, enforcing a freeze effect, and scaling and recovering when a player disconnects or a game server fails.

Read the full OpenAI Software Engineer interview experience this question came from

OpenAI logo
OpenAI
Nov 9, 2026
hardSoftware EngineerTechnical ScreenSystem Design
0
0

Design the backend of an online multiplayer typing race game. Assume the usual format: players are matched into a race, everyone types the same passage, each player watches the others' progress while typing, and the race ends with a ranking. The interviewer asked how game data is stored, how matching works, how race conditions are handled, how to implement a freeze, how the system scales, and how it handles failures such as a player who disconnects mid-race and needs to recover.

The source gives no scale numbers and does not define the freeze, so settle both with the interviewer before designing.

Clarifying Questions Guidance

  • How many players join one race, and how many concurrent races and online players must the design handle at peak?
  • Is matching based on skill (for example typing speed), on whoever is waiting right now, or on invitations from friends?
  • What does "freeze" mean in this game: an effect that stops one player's typing for a while (such as a penalty, or a power-up used against an opponent), or freezing a whole race?
  • How quickly must players see opponents' progress?
  • How long are race results kept, and do they feed ratings or leaderboards?

Part 1: Game flow, APIs and storage

Describe the life of a race from queueing to results, the protocol between client and server during a race, and how you store players, passages, live race state and finished results.

What This Part Should Cover Guidance

  • Race states and the transitions between them.
  • The real-time protocol, and which side decides progress and finish times.
  • Storage for live race state versus durable records.

Part 2: Matching

How are players matched into races?

What This Part Should Cover Guidance

  • The queue structure and the matching rule.
  • The trade-off between waiting time and match quality.
  • Keeping a player out of two races at once.
  • Assigning a matched group to the server that will host the race.

Part 3: Race conditions

Handle race conditions in the game, for example two players taking the last open seat in a race, a join that arrives just as the race starts, or finish messages from several players arriving within a few milliseconds of each other.

What This Part Should Cover Guidance

  • Where each race's state changes are serialized.
  • Idempotency and ordering of client messages.
  • Deterministic handling of near-simultaneous finishes.

Part 4: Implementing freeze

Implement freeze. Settle what is frozen first (see the clarifying questions), then design how a freeze is triggered, enforced, shown to clients and ended.

What This Part Should Cover Guidance

  • Enforcement and expiry on the server.
  • How clients learn about and display the freeze.
  • Interaction with reconnects, race end and overlapping freezes.

Part 5: Scaling and failure modes

Scale the design to many concurrent races, and walk through its failure modes, including a player who disconnects mid-race and reconnects, and a game server that crashes while hosting races.

What This Part Should Cover Guidance

  • Horizontal scaling of game servers, matching and connections.
  • Reconnection and resynchronization for a dropped player.
  • Recovery when a game server or the live-state store fails.
  • Monitoring of the real-time path.

What a Strong Answer Covers Guidance

  • Server authority over progress, finish times and freezes.
  • One owner per race so that concurrent events apply in a single order.
  • Storage that separates live race state from durable history.
  • Defined behavior for disconnects and server crashes, with its cost.

Follow-up Questions Guidance

  • How would you detect players who paste text or use scripts to fake typing speed?
  • How would you add spectators to a popular race without overloading its game server?
  • How would you keep a global leaderboard of best speeds up to date?
  • How would you let players in different regions race each other with fair latency?