From 90576381df2e1c0724aa386c96d21747e838532b Mon Sep 17 00:00:00 2001 From: Davide Cappellini Date: Tue, 10 Nov 2026 17:51:02 +0100 Subject: [PATCH] design: fix token size and stuck/squeezed statuses (#4) Co-Authored-By: Claude Haiku 5.5 --- GLOSSARY.md | 19 ++++++++++++++ docs/DESIGN.md | 69 +++++++++++++++++++++++++++++--------------------- 2 files changed, 59 insertions(+), 29 deletions(-) create mode 100644 GLOSSARY.md diff --git a/GLOSSARY.md b/GLOSSARY.md new file mode 100644 index 0000000..10e8d31 --- /dev/null +++ b/GLOSSARY.md @@ -0,0 +1,19 @@ +# FFF_vtt + +A browser virtual tabletop for one table: the GM and players share a map with walls, doors and tokens. This glossary holds the terms that are specific to that table. + +## Language + +**Token size**: +How big a token is on the map, as a radius in map pixels. A token uses its own size if one is set, otherwise the scene's default size. +_Avoid_: token scale, token diameter, size preset + +**Stuck**: +A lock condition meaning the token is held in place: a wall runs through it, or something holds it (ropes, a magic grasp). A player cannot move a stuck token; the GM always can. +_Avoid_: blocked + +**Squeezed**: +A lock condition meaning the token is pressed with no room: walls surround it, or a closing hand presses it. A player cannot move a squeezed token; the GM always can. +_Avoid_: blocked, crushed + +Neither term names its cause. Stuck and squeezed both lock a token for its player in the same way; they differ only in why. diff --git a/docs/DESIGN.md b/docs/DESIGN.md index 7e98892..72faa00 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -111,7 +111,8 @@ A browser virtual tabletop for one table (1 GM + up to 6 players [FIXED, Q1]), s Notes: - Prototype gap [INFERRED from code reading]: `Tok.gmOnly` is loaded from `scene.json` but never consulted in `sync()`; a GM-only token inside a player's LOS would be sent. Real build must enforce `gm_only` in the view builder and test it (new fault class, section 10). - Prototype gap [INFERRED]: every message carries the global `gseq`; player-visible gaps in `gseq` reveal that hidden mutations occurred. Real build: players get a per-connection monotonic counter. -- `hello` to a player carries world size, tile size, explored cell size, token radius, owned ids. None of these is secret. It must not carry scene/entity counts or wall counts. +- `hello` to a player carries world size, tile size, explored cell size, scene default token radius, owned ids. None of these is secret. It must not carry scene/entity counts or wall counts. +- A token's radius and status entries (5.5, 5.6) go to every recipient who sees the token [FIXED, owner decision 2026-11-10, #4]. ### 3.2 Authentication and invite secrets - Invite = 128-bit random secret from the OS CSPRNG (prototype: `urandom(16)`, hex). Link `https://host/join/`. @@ -218,11 +219,12 @@ meta(k PRIMARY KEY, v) -- schema_version also via PRAGM player(id PK, name, role, colour, created_at) invite(id PK, player_id FK, secret, created_at, revoked_at, used_at) -- secret plaintext (Q11) session(id PK, player_id FK, token_hash, created_at, last_seen) -- never expires (Q10) -scene(id PK, name, w, h, tile_size, cell, grid_size, vision_radius_default, - art_version, active, next_wall_id, extra_json) -- next_wall_id: monotonic, §8 [FIXED, #3] +scene(id PK, name, w, h, tile_size, cell, grid_size, vision_radius_default, token_radius_default, + art_version, active, next_wall_id, extra_json) -- next_wall_id: monotonic, §8 [FIXED, #3]; token_radius_default [FIXED, #4] wall(scene_id FK, id, ax, ay, bx, by, kind, open, flags, PRIMARY KEY(scene_id, id)) -- kind: wall|door|(later: window, one-way) -entity(id TEXT PK, scene_id FK, kind, name, x, y, owner_player_id NULL, +entity(id TEXT PK, scene_id FK, kind, name, x, y, radius REAL NULL, owner_player_id NULL, gm_only, flags, props_public JSON, props_owner JSON, props_gm JSON) +entity_status(entity_id FK, status, source, PRIMARY KEY(entity_id, status, source)) -- status: stuck|squeezed; source: walls|GM [FIXED, #4] explored_chunk(player_id, scene_id, cx, cy, bits BLOB, PRIMARY KEY(player_id, scene_id, cx, cy)) ``` - Exactly one scene in v1 (Q3): `scene_id` keys stay in the schema. @@ -265,39 +267,40 @@ Conclusions: - Skip recompute when the token moved but its polygon is unchanged (prototype already compares `np == r.polys`). ### 5.4 Known limitations (carry forward) -- Token exactly on a wall cannot move off it: `moveBlocked` counts any touch as a hit, so every move from that point is blocked, even a perpendicular step to the open side [MEASURED limit, `tests/tgeometry.nim` test "KNOWN LIMITATION: token exactly on a wall cannot move off it"; also in the `server/geometry.nim` header]. Known limitation, not a policy. Fixed in M2 by the escape rule (5.5). The escape is required by Q14 so the GM can move such a token: mechanism [PROPOSED], requirement [FIXED]. A validated move cannot reach this state (a destination within r of a wall is rejected) [INFERRED from `moveBlocked`]; it arises from a wall/door edit (`blocked` trigger, 5.5) or from a GM placement on a wall (GM placements ignore walls, 5.5); the escape rule covers both. -- Closing a door on a token [FIXED, owner 2026-11-08, supersedes the earlier `blocked` decision for doors]: the token is pushed aside (5.5), `blocked` only if neither side is valid. Editing or adding a wall on a token [FIXED, Q14]: the token gets `blocked` (trigger narrowed to circle overlap, 5.5). The server refuses that token's player moves; the GM can still move it; status clears per the 5.5 Keep/Clear rules (wall removed or door opened and no other wall overlaps, GM move to a free spot, or GM clear). Current pin: `tests/tgeometry.nim`, suite "door/wall closing on a token", test "door closed on a token: Q14 undecided, DESIGN 5.4 vs 12 H2 conflict": a token whose centre is 10 px off a closed door may move to a clear spot, may not stay overlapped, and may not cross the door. It pins `moveBlocked` only; it is replaced in M2 by tests of the 5.5 policy (under the 5.5 trigger this token is `blocked`, so player moves are refused). +- Token exactly on a wall cannot move off it: `moveBlocked` counts any touch as a hit, so every move from that point is blocked, even a perpendicular step to the open side [MEASURED limit, `tests/tgeometry.nim` test "KNOWN LIMITATION: token exactly on a wall cannot move off it"; also in the `server/geometry.nim` header]. Known limitation, not a policy. Fixed in M2 by the escape rule (5.5). The escape is required by Q14 so the GM can move such a token: mechanism [PROPOSED], requirement [FIXED]. A validated move cannot reach this state (a destination within r of a wall is rejected) [INFERRED from `moveBlocked`]; it arises from a wall/door edit (`stuck` trigger, 5.5) or from a GM placement on a wall (GM placements ignore walls, 5.5); the escape rule covers both. +- Closing a door on a token [FIXED, owner 2026-11-08, supersedes the earlier `blocked` decision for doors; 2026-11-10 #4: failure is `squeezed`]: the token is pushed aside (5.5), `squeezed` only if neither side is valid. Editing or adding a wall on a token [FIXED, Q14]: the token gets `stuck` (trigger narrowed to circle overlap, 5.5). The server refuses that token's player moves; the GM can still move it; status clears per the 5.5 Keep/Clear rules (wall removed or door opened and no other wall overlaps, GM move to a free spot, or GM clear). Current pin: `tests/tgeometry.nim`, suite "door/wall closing on a token", test "door closed on a token: Q14 undecided, DESIGN 5.4 vs 12 H2 conflict": a token whose centre is 10 px off a closed door may move to a clear spot, may not stay overlapped, and may not cross the door. It pins `moveBlocked` only; it is replaced in M2 by tests of the 5.5 policy (under the 5.5 trigger this token is `stuck`, so player moves are refused). - Boundary epsilon ambiguity (RayEps 1e-4, inclusive tolerances). - Explored and tile checks in the leak test recompute with the server's own `cellsTouched`: self-consistency only (caveat in 10.2). New independent oracle in section 10. - Doors/walls changing does not un-explore anything; explored only grows [MEASURED behaviour]. - Single uniform vision radius in prototype; v1 uses a per-entity numeric property (`vision_radius`) with scene default; no light/darkvision [FIXED, Q7]. - Vision origin = token centre, radius is not clipped by the token's own size. -### 5.5 Move rules and `blocked` (M2 decisions, 2026-11-08) +### 5.5 Move rules and statuses (M2 decisions, 2026-11-08; status model 2026-11-10, #4) Normative for M2. Replaces the prototype move validation (5.1) and the move-related limitations in 4.2 and 5.4. Implemented as a pure in-process module with unit tests; the WebSocket layer only maps its result to `moveAck`. The WebSocket probing test is M3. -Notation: token centre `c`, radius `r` (scene `token_radius`), start `s`, destination `d`. Blocking wall: segment with `kind=wall`, or `kind=door` with `open=false`; open doors do not block. `dist(X, W)` = distance from point or segment `X` to segment `W`. "Overlaps" = `dist < r` (strict; touching at exactly r is clear). +Notation: token centre `c`, radius `r` (entity `radius` if set, else scene `token_radius_default`; 5.6), start `s`, destination `d`. Blocking wall: segment with `kind=wall`, or `kind=door` with `open=false`; open doors do not block. `dist(X, W)` = distance from point or segment `X` to segment `W`. "Overlaps" = `dist < r` (strict; touching at exactly r is clear). -**`blocked` flag** ("stuck": the player cannot move the token at all; the GM always can) (stored bool on the entity, persisted) [FIXED, owner (B), Q14, refined 2026-11-08] +**Statuses `stuck` and `squeezed`** (replace the M2 `blocked` bool) [FIXED, owner (B), Q14, refined 2026-11-08; FIXED, owner 2026-11-10, #4]. Both are cause-agnostic lock conditions: a locked token cannot be moved by its player; the GM always can. `stuck` = held in place (wall through it, ropes, magic grasp); `squeezed` = pressed, no room (walls around it, closing hand). +- Storage: a token holds a set of `(status, source)` entries (stored on the entity, persisted); the same status may come from several sources. Locked while any entry exists. Both statuses may show at once. Sources: `walls` (set by the rules below) and `GM` (GM sets either status by hand for any reason; GM can clear any single entry at any time). - Overlap: `dist(c, W) < r` for a blocking wall `W`. An open door stops blocking, so opening = removing that wall for this rule; closing = adding it. Centre-on-wall is not required. -- Set: a wall is added or updated -> every token overlapping that wall becomes `blocked`. (A door CLOSING on a token does not set it: push rule below.) The GM places or moves a token to a position overlapping any blocking wall -> `blocked`. -- Keep: while any blocking wall still overlaps the token it stays `blocked` (opening a door does not free it if another wall overlaps). -- Clear: a wall is removed or a door opened -> each token that overlapped that wall gets `blocked` = overlaps any remaining blocking wall. The GM moves the token to a position overlapping no blocking wall -> cleared. GM manual clear -> cleared unconditionally (wire intent defined in M3). -- **Door closing on a token = push aside, not stuck** [FIXED, owner, 2026-11-08; changes the door case only]: each token (player or GM-owned) with `dist(c, door) < r` is moved perpendicular to the door segment, to the side its centre is already on, by the minimal distance that ends `>= r` from the door (+ `PushEps` = 1e-6 px; past the door's end the offset is `sqrt(r^2 - e^2)`, `e` = along-axis overshoot). Centre exactly on the door line: side of the token's previous position (position before its most recent move or push; `prev`/`hasPrev` on the token); no history, or previous also on the line: left of the door's a->b direction (deterministic default). The pushed position must be in bounds and `>= r` from every blocking wall (the closed door included); else the opposite side is tried; if neither is valid the token stays and becomes `blocked`, and opening that door later clears it per the Clear rule. A pushed token ends `blocked = false`. The push is a server-originated position change returned by the move-rules module (list of token index + new position) so M3 can broadcast it and recompute vision; no step cap applies. Each token is pushed independently; tokens do not block tokens (no token-token collision; the `blocks_move` flag is not modelled in M2), so pushed tokens may overlap each other. Wall add / wall update / GM placement or move inside a wall are unchanged (stuck). Door open is unchanged. -- An event changes only the tokens it touches (those overlapping the changed wall, or the moved token). An unrelated wall change elsewhere never re-blocks a GM-cleared token. -- After a GM manual clear while a wall still overlaps, the player escape rule (step 3 below) applies unchanged: the token may step out without crossing, destination >= r from every blocking wall. +- Set (source `walls`): a wall is added or updated -> every token overlapping that wall gets `stuck`. (A door CLOSING on a token does not set it: push rule below.) The GM places or moves a token to a position overlapping any blocking wall -> `stuck`. +- Keep: while any blocking wall still overlaps the token, its `walls`-sourced entries stay (opening a door does not free it if another wall overlaps). +- Clear: a wall is removed or a door opened -> each token that overlapped that wall keeps its `walls`-sourced entries only if it still overlaps a remaining blocking wall; otherwise they clear. A shrink (5.6) that ends the overlap clears them likewise. The GM moves the token to a position overlapping no blocking wall -> `walls`-sourced entries cleared. `GM`-sourced entries clear only by GM action (any single `(status, source)` entry; wire intent in #11). +- **Door closing on a token = push aside, not stuck** [FIXED, owner, 2026-11-08; changes the door case only]: each token (player or GM-owned) with `dist(c, door) < r` is moved perpendicular to the door segment, to the side its centre is already on, by the minimal distance that ends `>= r` from the door (+ `PushEps` = 1e-6 px; past the door's end the offset is `sqrt(r^2 - e^2)`, `e` = along-axis overshoot). Centre exactly on the door line: side of the token's previous position (position before its most recent move or push; `prev`/`hasPrev` on the token); no history, or previous also on the line: left of the door's a->b direction (deterministic default). The pushed position must be in bounds and `>= r` from every blocking wall (the closed door included); else the opposite side is tried; if neither is valid the token stays and gets `squeezed` (source `walls`), and opening that door later clears it per the Clear rule. A pushed token is clear of walls, so its `walls`-sourced entries clear. The push is a server-originated position change returned by the move-rules module (list of token index + new position) so M3 can broadcast it and recompute vision; no step cap applies. Each token is pushed independently; tokens do not block tokens (no token-token collision; the `blocks_move` flag is not modelled in M2), so pushed tokens may overlap each other. Wall add / wall update / GM placement or move inside a wall are unchanged (stuck). Door open is unchanged. +- An event changes only the tokens it touches (those overlapping the changed wall, or the moved token). An unrelated wall change elsewhere never re-sets a GM-cleared token. +- After the GM clears the `walls`-sourced entries while a wall still overlaps and no other entry remains, the player escape rule (step 3 below) applies unchanged: the token may step out without crossing, destination >= r from every blocking wall. - `wall.update` = remove then add for this rule [PROPOSED; not in the owner's list]. -- Player moves while `blocked`: the uniform nack (unchanged). +- Player moves while locked (any entry): the uniform nack (unchanged). **Player move `s -> d`** [FIXED, accepted default]. Checks in order; any failure gives the uniform nack. -1. Owner check (non-owned -> `error`, as now) and token not `blocked`. +1. Owner check (non-owned -> `error`, as now) and token not locked (no status entry). 2. Step cap [FIXED, owner]: `|d - s| <= cap`, where `cap` = the token's `vision_radius` if the token has `vision` and sets it, else the scene's `vision_radius_default`. 3. For each blocking wall `W`: - if `dist(s, W) < r` (start overlaps `W`, escape case): allowed only if the path `s->d` does not cross `W` (crossing at parameter t > eps; collinear overlap counts as crossing) AND `dist(d, W) >= r`; - otherwise (swept/capsule check): allowed only if `dist(segment s->d, W) >= r`, which also gives `dist(d, W) >= r`. -4. Accept: `moveAck{ok:true, pos:d}`. Nack: `moveAck{ok:false, pos:s}` for blocked, over-cap and collision alike. No reason field. +4. Accept: `moveAck{ok:true, pos:d}`. Nack: `moveAck{ok:false, pos:s}` for locked, over-cap and collision alike. No reason field. -**GM move** [FIXED, owner (D)]: no wall check, no step cap, ignores `blocked`. Bounds and referential checks still apply; after the move `blocked` is recomputed (set/clear rules above). A GM move out of bounds gets the same uniform nack as a player move (`moveAck{ok:false, pos:old}`) [RECORDED, as implemented]. +**GM move** [FIXED, owner (D)]: no wall check, no step cap, ignores locks. Bounds and referential checks still apply; after the move its `walls`-sourced entries are recomputed (set/clear rules above). A GM move out of bounds gets the same uniform nack as a player move (`moveAck{ok:false, pos:old}`) [RECORDED, as implemented]. **Wall index** [FIXED, accepted default, H3]: radius-bbox cull first; uniform spatial grid over walls only if the 5k-wall bench misses target (13, M2). @@ -305,7 +308,15 @@ Notation: token centre `c`, radius `r` (scene `token_radius`), start `s`, destin **Regression baseline** [FIXED, accepted default]: "results equal old implementation" = `visibilityPolygon` and `cellsTouched` on the prototype leak transcripts plus `tests/fixtures/scene.json`. `moveBlocked` is excluded: its results change on purpose. -**Unconfirmed** [PROPOSED, owner to confirm]: (a) `wall.update` as remove + add. Former (b) (door opened while another wall overlaps clears `blocked`) is closed by the Keep rule above [FIXED, owner, 2026-11-08]. +**Unconfirmed** [PROPOSED, owner to confirm]: (a) `wall.update` as remove + add. Former (b) (door opened while another wall overlaps clears `stuck`) is closed by the Keep rule above [FIXED, owner, 2026-11-08]. + +### 5.6 Token size and grow push [FIXED, owner decision 2026-11-10, #4] +- **Size:** `r` = entity `radius` if set, else scene `token_radius_default`. Units: px (map units). Client size presets (S/M/L, squares) are UI convenience only. Validation: `radius > 0`; no upper cap. Only the GM sets a radius; anyone who sees a token sees its radius. +- **Scene default change:** every token using the default is resized by the same rule, per token. +- **Shrink** never pushes. It can clear `walls`-sourced entries (5.5 Clear). +- **Grow push:** GM grows a token -> the server pushes it away from every blocking wall it overlaps, by the minimal displacement that ends `>= r` from every blocking wall, stays in bounds, and does not enter any other wall. No step cap. Deterministic; the tie-break is fixed and documented in the module header [PROPOSED]. Each token is pushed independently (tokens do not block tokens). The position change is server-originated: broadcast like the door push, vision recomputed for affected players. +- **Grow fails** (no valid position): the token stays (its graphic may overlap walls) and gets `squeezed` (source `walls`). +- Wire intent names (resize, set status, clear entry) deferred to #11 ("Message list"). --- @@ -319,9 +330,9 @@ Client -> server (intents). Authority column: P = player, G = GM. | t | fields (contract) | who | server behaviour | |---|---|---|---| -| `move` | `reqId:int, id, pos:[x,y]` | P (owned) / G (any) | validate; reply `moveAck` (+ `token` diffs); non-owned -> `error`; P move refused (`blocked`, over step cap, or wall collision; 5.5) -> `moveAck{ok:false, pos:old}`, one uniform nack; G move ignores walls, step cap and `blocked`, then sets/clears `blocked` by overlap; out-of-bounds G move gets the same nack (5.5) | -| `door` | `scene, id, open:bool` | G | toggle; recompute all players; close pushes tokens whose circle overlaps the door aside (perpendicular, valid side; server-originated position change to broadcast, vision recomputed; `blocked` only if no side is valid; Q14, 5.5), open recomputes `blocked` for those tokens (still blocked if another wall overlaps) | -| `wall.add` / `wall.update` / `wall.remove` | wall fields (add: server assigns `id`) / `scene, id` | G | validate geometry; recompute all players; GM-only broadcast of wall delta; add sets `blocked` on tokens whose circle overlaps the wall, remove recomputes it for those tokens (Keep rule), update = remove + add (Q14, 5.5; update PROPOSED) | +| `move` | `reqId:int, id, pos:[x,y]` | P (owned) / G (any) | validate; reply `moveAck` (+ `token` diffs); non-owned -> `error`; P move refused (locked: any status entry, over step cap, or wall collision; 5.5) -> `moveAck{ok:false, pos:old}`, one uniform nack; G move ignores walls, step cap and locks, then recomputes its `walls`-sourced entries by overlap; out-of-bounds G move gets the same nack (5.5) | +| `door` | `scene, id, open:bool` | G | toggle; recompute all players; close pushes tokens whose circle overlaps the door aside (perpendicular, valid side; server-originated position change to broadcast, vision recomputed; `squeezed` only if no side is valid; Q14, 5.5), open recomputes `walls`-sourced entries for those tokens (still stuck if another wall overlaps) | +| `wall.add` / `wall.update` / `wall.remove` | wall fields (add: server assigns `id`) / `scene, id` | G | validate geometry; recompute all players; GM-only broadcast of wall delta; add sets `stuck` (source `walls`) on tokens whose circle overlaps the wall, remove recomputes `walls`-sourced entries for those tokens (Keep rule), update = remove + add (Q14, 5.5; update PROPOSED) | | `entity.create` / `entity.update` / `entity.remove` | kind, name, pos, owner, props buckets | G | validate against property schema; view diff | | `prop.set` | `id, bucket, key, value` | G (v1) | owner-bucket writes by players come with FFF actions (section 9) | | `scene.set` | scene meta | G | broadcasts new `hello`-equivalent reset to all; no `scene.activate` (one scene, Q3) | @@ -333,12 +344,12 @@ Server -> client. | t | content | recipient | |---|---|---| -| `hello` | `proto`, role, owned ids, world size, tile size, explored cell, token radius, scene meta | all; client resets state on receipt | +| `hello` | `proto`, role, owned ids, world size, tile size, explored cell, scene default token radius, scene meta | all; client resets state on receipt | | `walls` / `wall` | full list / delta incl. doors with `open` | **GM only** | | `door` | `id, open` | GM only (players learn only via LOS changes) | | `vision` | `polys` (integer px, owned tokens only) | player | | `explored` | `cells` (full on connect, fresh cells after) | player | -| `token` | `id, name, kind, pos, mine, blocked` (bool, Q14, 5.5), visible props | per visibility | +| `token` | `id, name, kind, pos, radius, mine, statuses` (list of `{status, source}`; 5.5, 5.6 [FIXED, #4]), visible props | per visibility | | `remove` | `id` (left LOS / deleted) | per visibility | | `moveAck` | `reqId, ok, pos` | sender only | | `error` | static `msg` code | sender only | @@ -415,10 +426,10 @@ Prototype `client/src/main.ts`: explored rects appended to a `Graphics` mask for All ids are server-assigned. **Walls [FIXED, owner decision 2026-11-10, #3]**: per-scene ids, each scene counts from 1. Removal never renumbers; ids are never reused. Each scene stores `next_wall_id` (monotonic, never decreases, even if the newest wall is deleted). Wall identity = `(scene, id)` in DB, server and wire. Wall ids are GM-only in v1. **Tokens/entities [FIXED, owner decision 2026-11-10, #3]**: random opaque id, 12 chars from `[A-Za-z0-9_-]`, from a CSPRNG; server checks collision on create. Unique game-wide (not per-scene), so a token may later change scene keeping its id (cross-scene move not in M3). Counted ids would leak hidden tokens through gaps. **Doors are walls** and use wall ids; toggling is GM-only in v1, so any door-id exposure later leaks at most about the wall count (accepted). Rejected: dense ids with renumber broadcast (in-flight intents hit the wrong wall); game-wide wall counter (per-scene ids keep scene copy/export stable). -- **Scene** (exactly one in v1, Q3): `id, name, w, h` (px), `tile_size` (32 default = `explored_cell` [FIXED, Q4]; 64 is the per-scene fallback), `explored_cell` (32 default; `tile_size % cell == 0` required, prototype assumes it silently), `grid_size`, `vision_radius_default`, `art_version`, `active`, free-form `extra`. +- **Scene** (exactly one in v1, Q3): `id, name, w, h` (px), `tile_size` (32 default = `explored_cell` [FIXED, Q4]; 64 is the per-scene fallback), `explored_cell` (32 default; `tile_size % cell == 0` required, prototype assumes it silently), `grid_size`, `vision_radius_default`, `token_radius_default` (px, > 0, no upper cap [FIXED, #4]), `art_version`, `active`, free-form `extra`. - **Wall/Door**: `scene, id` (per-scene, see above), `a:[x,y], b:[x,y], kind ('wall'|'door'), open:bool, flags`. `blocks = not (door and open)`. GM-only everywhere. Later kinds (window, one-way, secret door) are extra `kind`/`flags` values; v1 geometry treats any non-open blocker identically. - **Entity (token and anything else) [PROPOSED, FFF seam]**: - - `id` (random text, see above), `scene, kind` (free string: `pc`, `npc`, `item`...), `name`, `pos`, `radius`, `owner` (player id or null = GM-controlled), `gm_only`, `flags` (`vision`, `blocks_move`...), `vision_radius` (optional; per-entity numeric with scene default, Q7 FIXED; also the player step cap, 5.5), `blocked` (bool stored flag, Q14, 5.5). + - `id` (random text, see above), `scene, kind` (free string: `pc`, `npc`, `item`...), `name`, `pos`, `radius` (px, > 0, no upper cap; NULL = use scene `token_radius_default`; GM-only to set [FIXED, #4]; 5.6), `owner` (player id or null = GM-controlled), `gm_only`, `flags` (`vision`, `blocks_move`...), `vision_radius` (optional; per-entity numeric with scene default, Q7 FIXED; also the player step cap, 5.5), `statuses` (set of `(status, source)` entries; status `stuck`|`squeezed`, source `walls`|`GM`; locked while any entry exists; Q14, 5.5, #4). - `props`: three JSON objects by visibility bucket: `public` (anyone who sees the entity), `owner` (owner + GM), `gm` (GM only). Keys are strings, values JSON scalars/arrays/objects with a size cap. No hidden state beyond these buckets and `gm_only` in v1 [FIXED, Q19]. - The server never interprets props in v1 except via a registered property schema (type, bucket, writable-by) used for validation and for FFF later. - **Player**: `id, name, role (gm|player), colour`. Exactly one GM. @@ -524,7 +535,7 @@ Source: `prototype-server-vision/HANDOFF.md` (and README/NOTES worries). | # | Item | Decision / open | Milestone | |---|---|---|---| | H1 | Port geometry + tests as-is | Decision: port `geometry.nim`, `tgeometry.nim`, mutation check, leak harness first | M1 | -| H2 | Token on a wall can't leave (inclusive `segsCross`); closing a door or editing a wall on a token | Decision [FIXED, Q14; door case revised by owner 2026-11-08]: wall add/edit on a token gives it `blocked` (player moves refused, GM moves allowed); a door closing on a token pushes it aside instead (5.5; `blocked` only if no side is valid). Set/Keep/Clear per 5.5: stays while any blocking wall overlaps; clears on wall removal or door open only if no other wall overlaps, on a GM move to a free spot, or on GM clear; GM placements/moves onto a wall set it. Trigger = circle overlap [FIXED, owner]; escape + capsule rule [FIXED, accepted default]; both in 5.5. Pin tests replaced in M2. | M2 | +| H2 | Token on a wall can't leave (inclusive `segsCross`); closing a door or editing a wall on a token | Decision [FIXED, Q14; door case revised by owner 2026-11-08]: wall add/edit on a token gives it `stuck` (player moves refused, GM moves allowed); a door closing on a token pushes it aside instead (5.5; `squeezed` only if no side is valid; status names per #4, was `blocked`). Set/Keep/Clear per 5.5: stays while any blocking wall overlaps; clears on wall removal or door open only if no other wall overlaps, on a GM move to a free spot, or on GM clear; GM placements/moves onto a wall set it. Trigger = circle overlap [FIXED, owner]; escape + capsule rule [FIXED, accepted default]; both in 5.5. Pin tests replaced in M2. | M2 | | H3 | O(rays x walls) vision | Decision: radius-bbox cull now; uniform spatial grid over walls only if the 5k-wall bench misses target (5.5) | M2 | | H4 | `cellsTouched` ~12x polygon | Decision: scanline rasterization, differential test vs ported version | M2 | | H5 | Shared-endpoint test gap | Decision: port with a test that fails if either arm is removed; new mutation (d) | M1 | @@ -597,7 +608,7 @@ Each is small, ends with a green gate, and no milestone depends on browser UI be 11. Q11 - Invite secrets: stored hashed (shown once, GM regenerates to re-share) or stored plaintext so the GM can re-copy a link? **RESOLVED [FIXED (owner decision), 2026-11-08]:** invite secrets stored plaintext so the GM can re-copy the link. 12. Q12 - Durability: is `synchronous=NORMAL` (can lose the last few commits on power loss/OS crash, never corrupts) acceptable, or should it be FULL for some or all writes? **RESOLVED [FIXED (owner decision), 2026-11-08]:** `synchronous=NORMAL`; `FULL` around GM authoring transactions. 13. Q13 - Slow/dead client policy: acceptable to disconnect clients that fall behind? Willing to patch/fork the pinned mummy commit if per-socket queue depth cannot be read from outside? **RESOLVED [FIXED (owner decision), 2026-11-08]:** option A: app-level bounded per-client outbox, latest-state-wins coalescing per key (MQTT-retained-like), diff at flush time, server Ping(seq)/Pong ack tracking for lag, stop feeding lagging clients + full resync on recovery; no mummy patch. Dead/stuck peers closed by nginx proxy timeouts (mechanism PROPOSED; verify WS goes through nginx in M5). Fork of mummy (option B) is fallback only, not planned. Research: `docs/research/q13-mummy-slow-clients.md`; detail in 4.3. -14. Q14 - Moving tokens when walls change: what should happen if the GM closes a door (or edits a wall) on top of a token? Allow the token to walk out, auto-nudge it, or refuse the edit? **RESOLVED [FIXED (owner decision), 2026-11-08]:** a GM edit that lands on a token gives it status `blocked`: server refuses that token's player moves; GM can still move it; status clears when the wall is removed or the door opened, or when the GM clears it. **Door case revised [FIXED (owner decision), 2026-11-08]:** spell walls and wall edits stay stuck; a door closing on a token pushes the token aside (5.5), stuck only if neither side is valid. +14. Q14 - Moving tokens when walls change: what should happen if the GM closes a door (or edits a wall) on top of a token? Allow the token to walk out, auto-nudge it, or refuse the edit? **RESOLVED [FIXED (owner decision), 2026-11-08]:** a GM edit that lands on a token gives it status `blocked`: server refuses that token's player moves; GM can still move it; status clears when the wall is removed or the door opened, or when the GM clears it. **Door case revised [FIXED (owner decision), 2026-11-08]:** spell walls and wall edits stay stuck; a door closing on a token pushes the token aside (5.5), stuck only if neither side is valid. Status names superseded by #4 (2026-11-10): `blocked` is now `stuck`/`squeezed` (5.5); door-push failure is `squeezed`. 15. Q15 - Reconnect: is a full resync on every reconnect fine up to what explored/state size, or do you want `resume since N` later? **RESOLVED [FIXED (owner decision), 2026-11-08]:** full resync on every reconnect; revisit if a measured snapshot exceeds ~100 KB. 16. Q16 - Vision payload: OK with full polygon per move (~3.4-3.7 KB per mover delivery, measured on loopback) for v1, or do you want deltas/binary earlier (e.g. for mobile data plans)? **RESOLVED [FIXED (owner decision), 2026-11-08]:** full vision polygon, integer px, sent only on change; deltas post-v1. 17. Q17 - Names/labels: which character sets must labels support (Latin only, accents, non-Latin, emoji)? Affects BitmapText glyph atlas vs Text/HTMLText. **RESOLVED [FIXED (owner decision), 2026-11-08]:** labels in Latin incl. accented characters plus Nerd Font icon glyphs.