Authoritative data and states
How does the authority generation prevent a second valid writer?
The interfaces require authoritative state. G-21 has at most one reward record for 1 crystal. Only the current authority generation confirms effects. Client-side movement prediction grants no ownership. The table separates current states from the evidence that established them.
Starting point Validate input sequence numbers within the player and session identity.
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.
Data relationships and permitted transitions
Session, characters, crystal and record
State snapshots are replaceable; the crystal record and authority generation remain authoritative.
Entities and relationships
| Entity | Authoritative data | Responsibility |
|---|---|---|
| Game session W-21 | Authority generation, current tick and participants | Exactly one active writer per generation. |
| Game characters P-21 and P-22 | Position, last input sequence, session | Client position is a prediction. |
| Crystal G-21 | frei or vergeben; winner | One unique allocation per world item. |
| Reward record | Session, item, winner and tick | Durable record before visible final reward confirmation. |
| State snapshot | Generation, tick and visible characters | Replaceable representation; old snapshots are discarded. |
Game session W-21
- Authoritative data
- Authority generation, current tick and participants
- Responsibility
- Exactly one active writer per generation.
Game characters P-21 and P-22
- Authoritative data
- Position, last input sequence, session
- Responsibility
- Client position is a prediction.
Crystal G-21
- Authoritative data
- frei or vergeben; winner
- Responsibility
- One unique allocation per world item.
Reward record
- Authoritative data
- Session, item, winner and tick
- Responsibility
- Durable record before visible final reward confirmation.
State snapshot
- Authoritative data
- Generation, tick and visible characters
- Responsibility
- Replaceable representation; old snapshots are discarded.
Permitted state transitions
| Starting point | Target | Condition |
|---|---|---|
| wartend | aktiv | Authentication checked and capacity available. |
| aktiv | getrennt | Connection lost; the server stops the character according to a defined rule. |
| getrennt | aktiv | Reconnect to the current authority generation. |
| aktiv or getrennt | beendet | Session ends with saved reward receipts. |
| frei | vergeben | G-21 is atomically allocated to a valid contender according to the server’s input order. |
| vergeben or beendet | terminal | Reallocation is blocked; the record remains available. |
wartend
- Target
- aktiv
- Condition
- Authentication checked and capacity available.
aktiv
- Target
- getrennt
- Condition
- Connection lost; the server stops the character according to a defined rule.
getrennt
- Target
- aktiv
- Condition
- Reconnect to the current authority generation.
aktiv or getrennt
- Target
- beendet
- Condition
- Session ends with saved reward receipts.
frei
- Target
- vergeben
- Condition
- G-21 is atomically allocated to a valid contender according to the server’s input order.
vergeben or beendet
- Target
- terminal
- Condition
- Reallocation is blocked; the record remains available.
Fence authority generations
Bind every durable record to the current authority generation.
An old game process continues after a network partition.
The datastore rejects old generations even while their clients remain connected.
- Alternative considered
- Changing only the router leaves the old writer able to act.
- Trade-off
- A generation change requires an atomic leadership decision.
- Reassess
- The game rules require multiple writers for one world.
Terms in this step
- Fence authority generations
- The datastore rejects old generations even while their clients remain connected.
Try it yourself
Let an old and a new game process write concurrently. Mark the boundary that rejects the old process.
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
- The reward datastore atomically checks the current authority generation on every write. A router change alone is insufficient.
- Second part of the solution
- The old process receives a generation conflict and cannot reallocate G-21. The new process retains the existing winning record.
Apply to your project
Which corresponding assumption would you test first in your project? Consider this trigger: The game rules require multiple writers for one world.