System Design Atlas

Real-time multiplayer world

07 / 10Worked example

Critical flow

How does a confirmed winner survive a lost response packet?

Trace the failure point through the architecture: the server persists the winning record and crashes before responding. The new authority generation reads the record and confirms the same winner. Unconfirmed movement may revert to the last checkpoint; confirmed crystal ownership survives. Durable acceptance, actual effect and response are considered separately.

Starting point Scale the game process and durable reward store separately.

Assumptions for the example case

A fictional example design: one session with at most 32 players, server-authoritative movement, one-time pickup of world items, reconnection within the same session and durably confirmed rewards. Figures and quality goals are illustrative test assumptions. A shared global game world, player trading, paid items and comprehensive fraud detection are outside the scope.

Failure point in the sequence

Crash after crystal commit · Generation changes

Generation 1 orders the pickup; the record is durable before the response is lost.

Game client
Session router
Game process
Reward store
Restart coordinator
  1. 01 Game client → Session routerP-21 · G-21 · sequence 7
  2. 02 Session router → Game processGeneration 1
  3. 03 Game process · Local processingT-600: distance 2,000 mm, G-21 free
  4. 04 Game process → Reward storeCommit winner P-21
  5. 05 Reward store → Game processRecord durable
  6. 06 Game process · Local processingCrash before response
  7. 07 Restart coordinator → Reward storeLoad the record
  8. 08 Restart coordinator → Game processGeneration 2 + record
  9. 09 Game process → Game clientP-21 has G-21

Result: Generation 2 confirms the same winner; unconfirmed movement is allowed to jump back.

The record survives the process; an old generation must not produce a second effect.

The crystal was allocated, but confirmation was lost. After restart, load the durable record before awarding again. Both clients eventually see the same winner.

Effect, response and recovery

Specific error
The server persists the winning record and crashes before responding. The new authority generation reads the record and confirms the same winner. Unconfirmed movement may revert to the last checkpoint; confirmed crystal ownership survives.
Before and after commit
Commit durably completes the local change. Before commit, the old state remains valid; afterwards, an identical retry returns the stored outcome. Reconcile the external effect using its existing reference.
Retry behaviour
The same input sequence for G-21 is sent twice and returns the same winning record. The same sequence with a different item identifier is rejected as a protocol conflict. An old server generation may not write a second record even with a new key.

Confirmation survives a crash

Confirmation survives a crash

After a restart, load the durable record before awarding again.

The crystal was allocated, but confirmation was lost.

Both clients eventually see the same winner.

Alternative considered
Restarting only from a position checkpoint can duplicate ownership.
Trade-off
The checkpoint and reward-record position must be explained together.
Reassess
World interactions become more complex than one-time item awards.

Terms in this step

Confirmation survives a crash
Both clients eventually see the same winner.

Try it yourself

Crash the server after storing the winning record but before responding. Determine the state under the new generation.

A hint for your attempt

Use the specific entities and conditions from this step. The two solution parts distinguish the decision from its evidenced outcome.

Compare with a possible solution
First part of the solution
G-21 remains assigned to the recorded winner. The new process reads this record before handling another pickup.
Second part of the solution
The retry returns the same winner. Both characters may receive new movement snapshots, but exactly 1 crystal is awarded in total.

Apply to your project

Which corresponding assumption would you test first in your project? Consider this trigger: World interactions become more complex than one-time item awards.

Step 8 examines snapshot traffic.