22 ADRs: server-authoritative sight and single egress, per-recipient views/diffs, uniform nack, opaque ids, 32 px tile unit, wall switches/presets, see-over, thick walls, open-door gap, typed wall columns, proto 2, build order, zoom clamp, accepted status leak, player marker, chunked explored, slow-client policy, session/key split, closing message, character records, global lock, synchronous choice. Each links its tickets and its spec section.
31 lines
1.4 KiB
Markdown
31 lines
1.4 KiB
Markdown
# Explored area is stored as chunked 64x64 bitmaps
|
|
|
|
Each player's explored cells are persisted as 64x64-cell chunks: 512 bytes per chunk, row-major,
|
|
LSB-first, keyed by `(player, scene, chunk_x, chunk_y)`, both FKs cascading. A mutation writes only
|
|
the chunks its refresh dirtied, and each dirty chunk is encoded from the whole explored set because
|
|
a bitmap is a value, not a delta. We chose this over the prototype's one row per cell because a move
|
|
can add hundreds of cells, and over one blob per player because a small mutation would rewrite the
|
|
whole grid.
|
|
|
|
## Status
|
|
accepted
|
|
|
|
## Alternatives
|
|
- One row per cell: rejected, one INSERT per new cell and a huge row count.
|
|
- One blob per player: rejected, every mutation rewrites the full grid.
|
|
- Delta rows: rejected, the in-memory set is authoritative and a bitmap is cheaper to rewrite than
|
|
to merge.
|
|
|
|
## Consequences
|
|
A move and its chunks are one `NORMAL` transaction; a GM authoring write adds a second `NORMAL`
|
|
chunk transaction under the same lock, so the two are not atomic with each other and a crash can
|
|
lose cells no client was acked about (the next refresh re-adds them). At 4096 px/32 px the whole map
|
|
is 2x2 chunks; at 16384 px it is 8x8. The exact bit layout is pinned by tests and re-read
|
|
independently by the Node harness.
|
|
|
|
## Tickets
|
|
#21; H13.
|
|
|
|
## Spec
|
|
Current §4.4 (step 5, write policy), §8 (explored grid).
|