feat(game): implement authoritative movement and visibility core
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
# Authoritative game core
|
||||
|
||||
Milestone 006 provides the portable movement engine and view projector. The
|
||||
ESP remains the only owner of mutable game state. Object interaction, item
|
||||
effects, exits, results, reconnect behavior, and browser controls remain out of
|
||||
scope until their later milestones.
|
||||
|
||||
## Command processing
|
||||
|
||||
Move commands enter a fixed 16-entry FIFO. The server assigns a monotonically
|
||||
increasing command sequence when an entry is accepted into the queue, then
|
||||
processes entries one at a time. An accepted move crosses exactly one open
|
||||
north, east, south, or west passage. Countdown commands, closed-wall moves,
|
||||
out-of-order timestamps, and commands inside the configured per-player
|
||||
cooldown leave authoritative game state and the state sequence unchanged.
|
||||
|
||||
Each player has an independent cooldown clock. Player positions never block
|
||||
one another. When an accepted move ends on the other player's cell, that
|
||||
command emits exactly one meeting event and advances the meeting sequence.
|
||||
Observers cannot enqueue commands.
|
||||
|
||||
## Projection boundary
|
||||
|
||||
Player projections contain only cells whose Chebyshev distance from the
|
||||
player is at most the active radius:
|
||||
|
||||
`max(abs(x - player_x), abs(y - player_y)) <= radius`
|
||||
|
||||
The projector supports the normal radius three and vision-effect radius six.
|
||||
Map boundaries clip the square; walls do not occlude it. Each projection is
|
||||
rebuilt from zero, so an opponent or object that leaves the current square is
|
||||
omitted instead of surviving as stale state. Observer projections contain all
|
||||
maze cells, static objects, and both current player positions.
|
||||
|
||||
The serialized view is split into bounded JSON records of at most 512 bytes,
|
||||
matching the WebSocket gateway's message bound.
|
||||
Every record uses the architecture's versioned envelope and carries the
|
||||
authoritative state sequence, role, match phase, meeting sequence, chunk index,
|
||||
and chunk count. Cell records contain only the cell index and current passage
|
||||
flags. Object records contain kind, owner, variant, and cell index. Player
|
||||
records omit the `opponent` member when that player is not currently visible;
|
||||
observer records instead carry both positions in `players`.
|
||||
|
||||
Static maze objects are projected for visibility testing, but Milestone 006
|
||||
does not pick up, consume, transfer, or otherwise mutate them.
|
||||
Reference in New Issue
Block a user