KatInterview

Real-Time Multiplayer Game Backend with Move Reversal

System DesignModel answer
MediumModel answerSystem Designreal-time systemsstateful servicesdistributed systems

Last updated

Architect a scalable backend for a turn-based multiplayer game supporting concurrent matches, move reversal requests, and dynamic player rankings.

Problem Statement

You need to architect a backend system for a turn-based multiplayer game platform. The system must support real-time gameplay between matched opponents, allow players to propose reversing their previous moves (with opponent approval), and maintain updated player rankings based on match outcomes.

Requirements

Core Functionality

  1. Match Operations: Players get paired and exchange moves with immediate feedback on validity
  2. Move Reversal: Either player can propose rolling back to an earlier game state; the opponent decides whether to accept
  3. Player Rankings: A scoring system that reflects win/loss records and adjusts after every finished match

Quality Attributes

  1. Responsiveness: Players should see their opponent's moves and receive validation feedback with minimal perceived delay
  2. Correctness: Both players must always observe identical game states; no divergence permitted
  3. Fault Tolerance: Server failures should not lose in-progress games
  4. Throughput: The architecture must handle traffic spikes during organized events

What to Cover

Your design should address:

  • Communication Protocol: How clients and servers exchange move data and reversal requests
  • Storage Schema: How you represent current game positions, historical moves, and player scores
  • Service Architecture: The components responsible for real-time message delivery, game logic, and ranking updates
  • Reversal Mechanism: The technical approach to implementing move rollback while preserving history
  • Ranking Updates: How to efficiently adjust player scores without creating database bottlenecks

Provide enough detail that the design could guide an implementation team.

Hints

Hint 1

Think about whether each game needs a single authoritative process or if you can distribute the work across multiple servers

Hint 2

Consider how optimistic concurrency control can prevent race conditions when both players submit moves simultaneously

Hint 3

Player rankings are computed from finished games, not live gameplay—does this suggest an asynchronous approach?