server: load and persist explored with every mutation (#21)

Startup restores each player's grid from its chunk rows (explored_loaded log) and every
mutation writes only the chunks its refresh dirtied, in the mutation's transaction: a move
keeps position and chunks in one NORMAL commit, a GM authoring write adds one NORMAL chunk
transaction under the same lock, before the ack. db.withTransaction is the shared seam.
This commit is contained in:
2026-11-15 09:58:19 +01:00
parent 22014a36dc
commit df4634d12a
2 changed files with 61 additions and 12 deletions
+2 -1
View File
@@ -10,7 +10,8 @@
## Explored (5.1, 8): the union of the cells every polygon ever overlapped, per player, strictly
## per player (Q9 FIXED). It only grows: a wall edit or a door closing never un-explores. `cells`
## are `(cx, cy)` from the world origin, cell size = the scene's `cell` (= `tile_size` in v1, Q4).
## Persistence (chunked bitmaps, #21) is slice 6; this module owns the in-memory set only.
## Persistence (chunked bitmaps, #21) lives in server/explored.nim, which stores this module's
## `explored` set and restores it at startup; this module owns the in-memory set only.
##
## Token visibility to a player (3.1): a token this player controls is always visible; any other
## token only while its centre is inside one of the player's polygons and it is not `gm_only`.