feat(observer): add observer mode and disconnect recovery

This commit is contained in:
2026-09-05 21:19:52 +03:00
parent d042c3ce90
commit ffdaa299bc
23 changed files with 988 additions and 43 deletions
+20 -4
View File
@@ -1,9 +1,8 @@
# Authoritative game core
Milestones 006 and 007 provide the portable movement engine, gameplay object
systems, terminal results, and view projector. The ESP remains the only owner
of mutable game state. Reconnect behavior and browser controls remain out of
scope until their later milestones.
Milestones 006, 007, and 009 provide the portable movement engine, gameplay
object systems, terminal results, view projector, and disconnect recovery. The
ESP remains the only owner of mutable game state.
## Command processing
@@ -87,3 +86,20 @@ compass hint, and own-exit status. An opponent's carried key is included only
while that opponent is currently visible. Observer snapshots contain both
inventories and effect counters, both exit states and authoritative exit
timestamps, every remaining ground object, and the public match result.
## Disconnect recovery
Both players start connected. Disconnecting either player during `active` or
`finish_pending` stores that exact phase, clears queued commands, enters
`paused`, and assigns the disconnected player a monotonic deadline 60,000 ms
after detection. Commands processed during the pause are rejected before any
position, inventory, effect counter, or result can change.
If the disconnect occurs during `finish_pending`, the remaining 200 ms result
window is preserved and continues only after both players reconnect.
Restoring the reserved player session before the deadline reconnects the same
player record. The stored phase resumes only when both player records are
connected, so a second disconnected player cannot be bypassed. Reaching a
disconnected player's deadline ends the match with the authoritative `draw`
result and clears queued commands. Observer connection state never enters this
state machine.