design: thick walls sight and movement (#45)
This commit is contained in:
+43
-19
@@ -1,6 +1,6 @@
|
||||
# FFF_vtt design
|
||||
|
||||
Status: draft v0.24, 2026-11-15 (owner decisions recorded in section 14; v0.4 records Q4 (tile_size 32 px), the outbox lock invariant (4.2, 4.3), and the follow-ups in 3.4, 8, 11.1, 12, 13; v0.5 records the M2 move-rule decisions in 5.5 and updates 3.4, 4.2, 5.1, 5.4, 6.1, 7.4, 8, 10.3, 12, 13; v0.6 records #14 (characters and player data) in 3.1, 3.4, 4.1, 4.4, 6.1, 8, 9, 10.3, 13, 14; v0.7 records #6 (players and invites) in 3.1, 3.2, 3.4, 4.4, 6.1, 8, 12, 13, 14; v0.8 records #7 (map tiles) in 3.3, 3.4, 11.1, 13, 14; v0.9 records #9 (test tools) in 2, 10.4, 13, 14; v0.10 records #12 (what M3 done means) in 13, 14; v0.11 records #15 (M3 limits) in 4.3, 6.4, 10.1, 13, 14; v0.12 records #11 (M3 message list) in 3.1, 3.2, 3.4, 4.2, 4.3, 5.5, 5.6, 6, 7.5, 13, 14; v0.13 records the owner review of #11 flags in 1, 3.1, 5.5, 6.1, 8, 14; v0.14 records #17 (getting in: keys, sessions, the auth slice) in 3.2, 4.4, 6.5, 6.6, 8, 11.1, 13, 14; v0.15 records #18 (talking safely: the protocol shell and the `closing` close-reason message) in 3.2, 4.3, 6, 6.1, 6.2, 6.4, 6.5, 10.3, 13, 14; v0.16 records #19 (walls and doors: the scene/wall schema, the wall payload rules and the slice-4 rollout) in 4.4, 6.1, 8, 13, 14; v0.17 records #20 (tokens and sight: the `entity` step, the typed views and the single egress, vision and explored, and the slice-5 rollout) in 4.4, 6.1, 6.3, 8, 10.3, 13, 14; v0.18 records #23 (characters and names: the `character`/`name_reveal`/`encountered` step, the name rule, the players' names and the `roster` frame, and the four name/character fault classes) in 4.1, 4.4, 6.1, 6.3, 6.4, 6.5, 8, 10.3, 13, 14; v0.19 records the owner confirmation of the #22 property-schema registry (keep the empty registry with the permissive fallback in v1; strict mode comes with the FFF seam, post-v1) in 6.1, 14; v0.20 records the #27-#31 correctness and cost fixes (per-player reveal persistence, one encountered rewrite path, link-by-update, the borrowed egress context, one scene read per request) in 4.3, 6.1, 10.3, 14; v0.21 records #41 (the height model: metres, `height` and `eye_height` as GM-only registered props with a token override, eye height 93% by default, walls full height unless the GM gives a height) in 5.7, 6.1, 8, 9, 14; v0.22 records #42 (the wall model: independent sight/movement switches with door settings and a sight-only direction, kinds as presets, a derived `kind` label, the v1 preset table, and secret/locked unobservable to players) in 1, 3.1, 5.1, 5.5, 5.8, 6.1, 7.4, 8, 14; v0.23 records #44 (low walls: see-over as a per-target predicate over the strict fog polygon, movement blind to height, the floor behind a low wall left unexplored, and the GM-only who-sees-it view) in 5.7, 5.8, 5.9, 7.4, 14; v0.24 records #46 (secret and locked doors: doors stay GM-only in v1, a locked door refuses to open, and the differential door-equivalence oracle with its fault, leakcheck and tile sweeps) in 1, 3.4, 5.8, 6.1, 6.5, 7.4, 10.3, 14. All of Q1-Q24 are RESOLVED or DEFERRED; none OPEN). Audience: the owner and coding agents.
|
||||
Status: draft v0.25, 2026-11-15 (owner decisions recorded in section 14; v0.4 records Q4 (tile_size 32 px), the outbox lock invariant (4.2, 4.3), and the follow-ups in 3.4, 8, 11.1, 12, 13; v0.5 records the M2 move-rule decisions in 5.5 and updates 3.4, 4.2, 5.1, 5.4, 6.1, 7.4, 8, 10.3, 12, 13; v0.6 records #14 (characters and player data) in 3.1, 3.4, 4.1, 4.4, 6.1, 8, 9, 10.3, 13, 14; v0.7 records #6 (players and invites) in 3.1, 3.2, 3.4, 4.4, 6.1, 8, 12, 13, 14; v0.8 records #7 (map tiles) in 3.3, 3.4, 11.1, 13, 14; v0.9 records #9 (test tools) in 2, 10.4, 13, 14; v0.10 records #12 (what M3 done means) in 13, 14; v0.11 records #15 (M3 limits) in 4.3, 6.4, 10.1, 13, 14; v0.12 records #11 (M3 message list) in 3.1, 3.2, 3.4, 4.2, 4.3, 5.5, 5.6, 6, 7.5, 13, 14; v0.13 records the owner review of #11 flags in 1, 3.1, 5.5, 6.1, 8, 14; v0.14 records #17 (getting in: keys, sessions, the auth slice) in 3.2, 4.4, 6.5, 6.6, 8, 11.1, 13, 14; v0.15 records #18 (talking safely: the protocol shell and the `closing` close-reason message) in 3.2, 4.3, 6, 6.1, 6.2, 6.4, 6.5, 10.3, 13, 14; v0.16 records #19 (walls and doors: the scene/wall schema, the wall payload rules and the slice-4 rollout) in 4.4, 6.1, 8, 13, 14; v0.17 records #20 (tokens and sight: the `entity` step, the typed views and the single egress, vision and explored, and the slice-5 rollout) in 4.4, 6.1, 6.3, 8, 10.3, 13, 14; v0.18 records #23 (characters and names: the `character`/`name_reveal`/`encountered` step, the name rule, the players' names and the `roster` frame, and the four name/character fault classes) in 4.1, 4.4, 6.1, 6.3, 6.4, 6.5, 8, 10.3, 13, 14; v0.19 records the owner confirmation of the #22 property-schema registry (keep the empty registry with the permissive fallback in v1; strict mode comes with the FFF seam, post-v1) in 6.1, 14; v0.20 records the #27-#31 correctness and cost fixes (per-player reveal persistence, one encountered rewrite path, link-by-update, the borrowed egress context, one scene read per request) in 4.3, 6.1, 10.3, 14; v0.21 records #41 (the height model: metres, `height` and `eye_height` as GM-only registered props with a token override, eye height 93% by default, walls full height unless the GM gives a height) in 5.7, 6.1, 8, 9, 14; v0.22 records #42 (the wall model: independent sight/movement switches with door settings and a sight-only direction, kinds as presets, a derived `kind` label, the v1 preset table, and secret/locked unobservable to players) in 1, 3.1, 5.1, 5.5, 5.8, 6.1, 7.4, 8, 14; v0.23 records #44 (low walls: see-over as a per-target predicate over the strict fog polygon, movement blind to height, the floor behind a low wall left unexplored, and the GM-only who-sees-it view) in 5.7, 5.8, 5.9, 7.4, 14; v0.24 records #46 (secret and locked doors: doors stay GM-only in v1, a locked door refuses to open, and the differential door-equivalence oracle with its fault, leakcheck and tile sweeps) in 1, 3.4, 5.8, 6.1, 6.5, 7.4, 10.3, 14; v0.25 records #45 (thick walls: the rectangular body and its placement, the shared sight/collider rectangle with square ends, see-over at every crossed face, no push on a wall edit, and the shape seam) in 1, 5.1, 5.3, 5.5, 5.7, 5.8, 5.9, 5.10, 6.1, 7.4, 8, 13, 14. All of Q1-Q24 are RESOLVED or DEFERRED; none OPEN). Audience: the owner and coding agents.
|
||||
|
||||
Legend:
|
||||
- **[FIXED]** owner decision, not up for debate here.
|
||||
@@ -24,7 +24,7 @@ A browser virtual tabletop for one table (1 GM + up to 6 players [FIXED, Q1]), s
|
||||
|
||||
### v1 scope [PROPOSED, trimmed to what the prototypes proved plus the minimum to be usable]
|
||||
- One table, 1 GM + up to 6 players (max 6 [FIXED, owner decision 2026-11-08, Q1]), a shared site link and per-player keys, no accounts.
|
||||
- Exactly one scene in v1 (Q3, FIXED): large tiled map image, optional visual grid, walls and doors, tokens. A wall's behaviour is a set of switches (blocks sight, blocks movement, sight direction) plus door settings; named presets (`wall`, `door`, `secret door`, `locked door`, `terrain`, `one-way wall`) are one-drag defaults over them (5.8; supersedes Q6's `wall`|`door` only).
|
||||
- Exactly one scene in v1 (Q3, FIXED): large tiled map image, optional visual grid, walls and doors, tokens. A wall's behaviour is a set of switches (blocks sight, blocks movement, sight direction) plus door settings; named presets (`wall`, `door`, `secret door`, `locked door`, `terrain`, `one-way wall`) are one-drag defaults over them (5.8; supersedes Q6's `wall`|`door` only). A wall also has a per-wall thickness and height (5.10, 5.7).
|
||||
- GM tools: author walls, doors, terrain and one-way barriers in the browser (Q6, FIXED; presets plus an advanced toggle, 5.8, 7.4), create/move/delete tokens, toggle doors, edit token properties, manage players and player keys.
|
||||
- Player: move owned tokens only; see only line-of-sight area, previously explored area (dimmed), and tokens inside LOS. Character creation and edits and all prop writes are GM-only in v1; opening them to players later is a permission change on the existing intents (6.1), not a redesign.
|
||||
- Automatic LOS from owned tokens against walls/doors, server-side. Explored area = per-player cell grid, persisted.
|
||||
@@ -38,6 +38,7 @@ A browser virtual tabletop for one table (1 GM + up to 6 players [FIXED, Q1]), s
|
||||
- Players opening or closing doors, and players discovering secret doors (searching, revealing, finding a way in): in v1 only the GM touches a door, so the lock and `secret` are GM authoring state (#46, 5.8). Future effort; moving it to players is a permission change on the existing `door.set`, not a redesign.
|
||||
- Feeding from the owner's map generator [FIXED: does not feed in]. Map import is a CLI step in v1; browser upload is post-v1 (Q5, FIXED).
|
||||
- Freehand drawing, rulers, pings, chat, audio, video (order decided at M7, Q8).
|
||||
- Curved, freeform or image-traced walls: v1 walls are straight segments with a rectangular body, and a cave wall is a chain of straight segments (5.10). A future effort (#45); the shape sits behind a seam so this stays a change of one function, not a redesign.
|
||||
- Mobile-first UI polish (the client must work on a phone [MEASURED render], but layout is not a v1 goal). Devices in scope: phones, tablets, laptops (Q1, FIXED).
|
||||
- Network exposure and reachability: owner's concern (Q23, FIXED). Built-in protections stay (127.0.0.1 bind, connection cap, frame/rate limits, Origin check); internet-only hardening (fail2ban etc.) is not in scope.
|
||||
- Horizontal scaling, multi-process server.
|
||||
@@ -97,7 +98,7 @@ A browser virtual tabletop for one table (1 GM + up to 6 players [FIXED, Q1]), s
|
||||
|
||||
| Data | GM | Player (own) | Player (others) |
|
||||
|---|---|---|---|
|
||||
| Walls: geometry, switches, door settings and the derived `kind` label (5.8) | all, always | **never** (WS or HTTP) | never |
|
||||
| Walls: geometry (thickness and the body's side included, 5.10), switches, door settings and the derived `kind` label (5.8) | all, always | **never** (WS or HTTP) | never |
|
||||
| Tokens/entities (position, radius, statuses without `source`, name per 8) | all | controlled by this player (`entity.owner`): always. Others: only if inside own LOS polygon **and** not `gm_only` | -- |
|
||||
| Token props, `public` bucket | all | for visible tokens | -- |
|
||||
| Token props, `owner` bucket (owner = token controller) | all | only for tokens this player controls | never |
|
||||
@@ -281,7 +282,7 @@ explored_chunk(player_id, scene_id, cx, cy, bits BLOB, PRIMARY KEY(player_id, sc
|
||||
## 5. Vision and explored
|
||||
|
||||
### 5.1 Algorithm (ported from `prototype-server-vision/src/geometry.nim`)
|
||||
- **Visibility polygon** from token centre: cast rays to every blocking wall endpoint at angle -eps, 0, +eps (`RayEps` = 1e-4 rad), plus an inscribed 64-gon of radius R as range limit; sort by angle; each ray returns nearest hit among wall segments + circle segments; result = CCW polygon. The wall list holds only walls whose sight switch is on; an open door and a `terrain` wall are absent from it, and a one-way wall is evaluated per observer (5.8).
|
||||
- **Visibility polygon** from token centre: cast rays to every blocking wall endpoint (for a thick wall, every corner of its body quad, 5.10) at angle -eps, 0, +eps (`RayEps` = 1e-4 rad), plus an inscribed 64-gon of radius R as range limit; sort by angle; each ray returns nearest hit among wall segments (body faces for a thick wall) + circle segments; result = CCW polygon. The wall list holds only walls whose sight switch is on; an open door and a `terrain` wall are absent from it, and a one-way wall is evaluated per observer (5.8).
|
||||
- **Explored**: `cellsTouched(poly, cell)` marks every grid cell that the polygon overlaps; union into the player's explored set. Vertex-in-cell test added after a bug (polygon wholly inside one cell) [MEASURED bug log, prototype `NOTES.md`; covered by `tests/tgeometry.nim`, suite "cells", test "tiny polygon inside one cell"].
|
||||
- **Token visibility** to a player: token centre inside any of the player's polygons (even-odd `inside`).
|
||||
- **Move validation (prototype)**: inclusive segment intersection on blocking walls (touching = blocked, so no squeezing through shared vertices) AND destination circle at distance >= token radius from every blocking wall. Replaced by the M2 rules in 5.5; the prototype result is a baseline only.
|
||||
@@ -307,6 +308,7 @@ Conclusions:
|
||||
- `cellsTouched` is ~12x the polygon itself and dominates [MEASURED]. M2 target: replace per-cell polygon tests with scanline rasterization of the polygon over the explored grid, differential-tested against the ported implementation [PROPOSED].
|
||||
- Polygon cost is O(rays x walls in bbox) [MEASURED code reading, `server/geometry.nim` `visibilityPolygon` (ported unchanged from prototype)]. Prototype scene has 60 walls and 8 tokens, so this says nothing about big maps. With radius-bbox culling the cost scales with local wall density, not total walls [INFERRED]; a uniform spatial grid over walls is needed when scenes reach thousands of walls (M2 gate: bench with a synthetic 5k-wall scene, target polygon < 1 ms [PROPOSED test target, Q2: owner has no map size yet; revisit with real maps]). The 5k target is the sparse primary layout `genScene(16384, 5000, 1)` (`tools/scenegen.nim`): 0.082 ms avg [MEASURED, `results/bench.log`]. The dense layout `genScene(4096, 5000, 1)` is a stress reference (1.28 ms avg, ~207 walls in the vision bbox) [MEASURED]; revisit the uniform grid if real maps approach that density.
|
||||
- Skip recompute when the token moved but its polygon is unchanged (prototype already compares `np == r.polys`).
|
||||
- **Thickness cost** [#43, 5.10]: a thick body is a quad, and the fan costs about 10x on a dense scene (13.2 ms vs 1.25 ms baseline on the 5k dense layout; 0.26 ms per polygon, 3.15x, on the 5k sparse one). The owner accepted that and re-baselined the per-move budget [FIXED (owner decision), #43]; polygon optimisation is deferred. The quad is hoisted per wall edit, so the extra cost is in the fan, never in per-viewer geometry.
|
||||
|
||||
### 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 (`stuck` trigger, 5.5) or from a GM placement on a wall (GM placements ignore walls, 5.5); the escape rule covers both.
|
||||
@@ -320,15 +322,15 @@ Conclusions:
|
||||
### 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 `ack` (6.1). The WebSocket probing test is M3.
|
||||
|
||||
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 `blocks_movement` on, and for a door only while it is closed (5.8); open doors do not block, and a one-way wall blocks movement both ways. `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 `blocks_movement` on, and for a door only while it is closed (5.8); open doors do not block, and a one-way wall blocks movement both ways. `dist(X, W)` = distance from point or segment `X` to `W`'s body: the segment itself, or the rectangle of 5.10 when the wall has thickness (a centre inside the rectangle is distance 0). "Overlaps" = `dist < r` (strict; touching at exactly r is clear).
|
||||
|
||||
**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). Visibility: every recipient who sees the token gets `status` only; `source` is GM-only (6.1, amended 2026-11-14).
|
||||
- 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.
|
||||
- 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, and a centre inside a thick body is distance 0, so it overlaps (5.10).
|
||||
- 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 `status.clear`, 6.1).
|
||||
- **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.
|
||||
- **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 (with thickness the body of 5.10; a thick door's shape is #50), 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].
|
||||
@@ -361,7 +363,7 @@ Notation: token centre `c`, radius `r` (entity `radius` if set, else scene `toke
|
||||
- Wire intents: `token.resize`, `status.set`, `status.clear` (6.1) [FIXED (owner-delegated, 2026-11-14, #11)].
|
||||
|
||||
### 5.7 Heights [FIXED (owner decision), 2026-11-15, #41]
|
||||
What the vertical dimension is made of, and in what unit. Vision only: what a low wall does to sight is #44, thickness is #45, the wall kinds were #42 (5.8), the wire and migration are #49.
|
||||
What the vertical dimension is made of, and in what unit. Vision only: what a low wall does to sight is 5.9 (#44), thickness is 5.10 (#45), the wall kinds were #42 (5.8), the wire and migration are #49.
|
||||
- **Unit: metres, decimal.** Map distances stay px and no map scale is introduced: see-over compares heights with heights, so no px -> m conversion exists anywhere [FIXED (owner decision), 2026-11-15, #41]. Research #39 3.3 needs only `h_eye` and `h_wall` for the hidden band behind a low wall (`d_floor = s * h_eye / (h_eye - h_wall)`), never a ground distance in metres.
|
||||
- **Height is a property, not a field.** `height` and `eye_height` live in the `gm` bucket of the three-bucket `props` (8), on the character or on the token; there is no dedicated column and no wire field of their own.
|
||||
- **Token height.** A character carries its base `height` (the character-sheet value). A plain token (no character) carries its own `height`, and `token.create` without one is refused `invalid` (`invalid`, not `not-found`: a missing field, 6.5). A linked token uses its character's `height` by default; it may carry its own `height` as a temporary on-map override (an enlarge spell doubling it) that never writes the character. Removing the override restores the character's value. **Effective token height** = the token's override, else the character's `height`, else the plain token's own `height`.
|
||||
@@ -371,10 +373,10 @@ What the vertical dimension is made of, and in what unit. Vision only: what a lo
|
||||
- **Limits** [FIXED (owner-delegated), 2026-11-15, #41]: every height > 0; `height` <= 100 m; `eye_height` <= 100 m and **may exceed** `height` (a floating eye); a wall's height > 0 and <= 100 m. The registered kind is enforced on write, so a non-number is `invalid` (8, 9).
|
||||
- **First registered keys.** `height` and `eye_height` are the first two keys of the property-schema registry (8, 9): `kind` number, bucket `gm`. This is the first time the server interprets props, so the "the server never interprets props in v1" wording of 8 and 9 is narrowed to **the server interprets only registered keys used by core sight rules** (6.1, 8, 9).
|
||||
- Deferred: what height existing tokens and characters get at migration (`height` is required) -> #49 "Wall wire format, schema and migration". The *target's* height in see-over (a giant's head over a fence) is settled by #44 (5.9): the target's top is what has to clear the line.
|
||||
- Conflict note (settled later): section 1's non-goals (windows/transparent walls, one-way walls) and Q6's `wall`|`door` only were contradicted by the wall-model work. That is 5.8 [FIXED, 2026-11-15, #42], which superseded both; this block fixed heights and units only, and what a low wall hides (#44) and thickness (#45) are still open.
|
||||
- Conflict note (settled later): section 1's non-goals (windows/transparent walls, one-way walls) and Q6's `wall`|`door` only were contradicted by the wall-model work. That is 5.8 [FIXED, 2026-11-15, #42], which superseded both; this block fixed heights and units only, and what a low wall hides (#44) and thickness (#45) were settled afterwards in 5.9 and 5.10.
|
||||
|
||||
### 5.8 Wall switches, presets, doors and one-way [FIXED (owner decision), 2026-11-15, #42]
|
||||
What a wall's behaviour is made of. Heights are 5.7; what a low wall does to sight and movement is 5.9 (#44); thickness is #45; the wire and the migration are #49.
|
||||
What a wall's behaviour is made of. Heights are 5.7; what a low wall does to sight and movement is 5.9 (#44); thickness is 5.10 (#45); the wire and the migration are #49.
|
||||
- **Behaviour is independent switches, not a kind [FIXED (owner decision), Q1].** A wall carries its own settings and the server reads those. A named kind is only a preset over them. Rejected: a fixed kind enum as the record's behaviour, and client-interpreted free flags; the client may send a preset name, and the **server** expands it and validates the resulting switch set (6.1).
|
||||
- **v1 switches [FIXED (owner decision), Q2].** `blocks_sight: bool`, `blocks_movement: bool`; door settings `door: bool`, `open: bool`, `secret: bool`, `locked: bool`; one direction field `sight_dir: "both"|"left"|"right"` (default `both`). No light axis, no sound axis in v1 (and none on the map).
|
||||
- **Direction is sight only [FIXED (owner decision), Q4].** `sight_dir` says sight is blocked from one side only; movement is always governed by `blocks_movement` and is two-way (a one-way wall blocks movement both ways). `left`/`right` are the sides of the wall's `a -> b` order read from `a` to `b`; `left` names the side whose view across the wall is blocked. Which side the editor offers first, and what a one-way wall does to explored cells and tiles, is #47.
|
||||
@@ -398,11 +400,11 @@ What a wall's behaviour is made of. Heights are 5.7; what a low wall does to sig
|
||||
No `window` preset in v1. The switch set *can* express the see-through door of Fantasy Grounds and Roll20 (a door with `blocks_sight:false`, `blocks_movement:true`: look through it while closed, open it to pass), but "window" also names Foundry's distance-limited wall, which two booleans cannot express, and `terrain` already covers the fixed see-over barrier. v1 therefore ships no preset under that ambiguous name; #47 picks the meaning. No "blocks nothing" preset either: a segment that blocks nothing is a marker, not a barrier, and the editor deletes instead.
|
||||
- **Derived label, not a stored kind [FIXED (owner-delegated), #42].** The record stores the switches. `kind` survives on the wire as a read-only label derived from them (exact match with the preset table above, else `custom`); it is never an input and never the authority, so the label and what the rules do cannot drift. Rejected: storing `kind` next to the switches.
|
||||
- **Where the switches live [FIXED (owner-delegated), #42].** Typed, validated fields on the wall record and in the wall payloads, defaulted server-side; never inside `flags`, because the server interprets sight and movement and `flags` stays the never-interpreted free object (6.1, 8). Whether they become columns or one validated restrictions object is #49's; the direction is named fields, not a free-form blob.
|
||||
- **Composition with thickness and height (height decided in 5.9, thickness in #45).** The switches choose *which* predicate reads a wall: the sight wall list holds a wall only when `blocks_sight` (one-way: only for the blocked side), the movement collider only when `blocks_movement`. 5.9 then decides how the sight predicate treats a wall's height, #45 how thickness widens the sight footprint and the movement collider. A wall with `blocks_sight=false` is absent from the vision input entirely, height and thickness included — that is what keeps `terrain` cheap.
|
||||
- **Composition with thickness and height (height decided in 5.9, thickness in 5.10).** The switches choose *which* predicate reads a wall: the sight wall list holds a wall only when `blocks_sight` (one-way: only for the blocked side), the movement collider only when `blocks_movement`. 5.9 then decides how the sight predicate treats a wall's height, 5.10 how thickness widens the sight footprint and the movement collider. A wall with `blocks_sight=false` is absent from the vision input entirely, height and thickness included — that is what keeps `terrain` cheap.
|
||||
- **Status model (5.5).** "Blocking wall" for `stuck`, `squeezed`, the door push and the move checks means `blocks_movement` and, for a door, closed. So a terrain wall sticks and pushes exactly as a solid wall; a one-way wall blocks movement both ways; a secret door pushes a token exactly as a solid wall would, with no signal.
|
||||
|
||||
### 5.9 Low walls: see-over [FIXED (owner decision), 2026-11-15, #44]
|
||||
What a wall shorter than a figure does to sight and movement. Heights and units are 5.7; the switches and the one-way direction are 5.8; thickness is #45; the wire and the migration are #49. Answers #41's open question: the *target's* height matters.
|
||||
What a wall shorter than a figure does to sight and movement. Heights and units are 5.7; the switches and the one-way direction are 5.8; thickness is 5.10 (#45); the wire and the migration are #49. Answers #41's open question: the *target's* height matters.
|
||||
|
||||
- **Movement is blind to height [FIXED (owner decision), #44].** "Does a low wall block movement?" is answered by `blocks_movement` alone, exactly as in 5.5/5.8. Height is a sight input and never enters the move rules, the collider, `stuck`/`squeezed` or the door push: a knee-high wall with the switch on stops a walker, and a wall with it off is walked through however tall it is.
|
||||
- **See-over is a per-target predicate, not a wall flag [FIXED (owner decision), #43].** A token is visible iff its top clears the wall on the line from the viewer's eye; the visibility polygon stays **strict**, i.e. it still stops at every sight wall's line (5.1). Consequence, accepted: a visible token may stand on a cell its viewer has not explored ("floating on black"). Rejected: a permissive polygon that fogs a band nobody can see, and a "see-over" switch on the wall.
|
||||
@@ -412,7 +414,7 @@ What a wall shorter than a figure does to sight and movement. Heights and units
|
||||
- **Players get a binary answer [FIXED (owner decision), #44].** Visible or not; when visible the whole token is drawn and its name/status behave as today. No clipping, no partial-body drawing, no cover rules (a rules-engine judgement, non-goal 1).
|
||||
- **GM-only who-sees-it view [FIXED (owner decision), in v1, #44].** The GM can see, per token, which player(s)/characters see it and its **visible fraction**: the share of the token's height above the highest blocking sight line, 100 % when nothing is crossed (definition below). GM-only, derived from data the GM already receives (all walls, all tokens, the `gm` props), so no player-visible field is added; never on a player wire in any form. The panel's shape is M4 editor/fog work (7.4).
|
||||
- **Delegated knobs [FIXED (owner-delegated), #44].**
|
||||
- Comparison strict, equality hidden, evaluated at the wall's near face (v1 walls are zero-width, so the crossing point is the wall; #45 fixes the near face for a thick wall). *Why: a body exactly level with the wall top is not above it.*
|
||||
- Comparison strict, equality hidden, evaluated at every face of the wall the line crosses — 5.10 fixes the thick case (with zero thickness the faces coincide with the wall line, so this is today's point). *Why: a body exactly level with the wall top is not above it.*
|
||||
- Every crossed sight wall must clear; the predicate is an AND, so one failing wall hides the token. Candidate walls come from the existing radius-bbox cull, so the cost is per crossed wall and adds no fan (research #39: the predicate is not part of the polygon). *Why: one rule, one pass, zero geometry.*
|
||||
- Hook at `visibleTo` (`server/vision.nim`): visible iff `insideAny(pos)` **or** the predicate. `visibilityPolygon`, `cellsTouched` and `tiles.nim` never read a height. *Why: the token-visibility rule stays in one copy (10.3's fault classes rely on it) and the fan is untouched.*
|
||||
- Visible fraction: per crossed wall the required top is `h_req(W) = h_e + (h_w - h_e)·(d_T/d_W)`, and `f_W = clamp((h_t - h_req(W))/h_t, 0, 1)`; the token's fraction is the **minimum** over crossed walls, 1 when none is crossed. `f = 0` exactly when the predicate hides it, because the comparison is strict. *Why: the same predicate read as a number cannot drift from the binary answer.*
|
||||
@@ -420,6 +422,25 @@ What a wall shorter than a figure does to sight and movement. Heights and units
|
||||
- Oracles [FIXED (owner-delegated), #44]. `tools/leakcheck.nim`'s `clearLine` gets its own height test (walls carry their height; a target's top is compared independently of the server's code, never by calling vision.nim). Cells in a low wall's hidden band are **maybe** for the independent explored/tile oracle: a tile there may be allowed or refused, both correct, but a band cell may never be **sure** (a `200` on a band cell is legitimate, a withheld proof cell never). A token hidden only by the band gives no `token` frame, no name and no encountered entry, and no churn: no alternating frames as a position crosses the line. The assertions land with the build tickets (/to-spec), not here.
|
||||
- Deferred: nothing about see-over itself. A `terrain` wall is unaffected (it never reaches sight, 5.8). Whether the client or the server computes the GM's numbers is M4's build call.
|
||||
|
||||
### 5.10 Thick walls: the body, sight and movement [FIXED (owner decision), 2026-11-15, #45]
|
||||
What a wall's thickness does to the floor it covers, the vision fan and the collider. Heights and units are 5.7, the switches 5.8, see-over 5.9; the wire fields and the migration are #49; a thick door's leaf and its push are #50.
|
||||
|
||||
- **The body.** Thickness is a strip of floor: a rectangle of length `|ab|` with **square ends** and no extension past `a` or `b`, and width `thickness`. `position` places it: `center` (default) straddles the drawn `a -> b` line, half the thickness each side; `left` keeps the whole body on the left of `a -> b`, so the line is the inner face and the room's interior; `right` on the other side. A flip moves only the body: `a` and `b` never move, so the GM draws the exact interior size and puts the thickness outward. `left`/`right` are the sides of the `a -> b` order, the same pair `sight_dir` uses (5.8): left is the `(-dy, dx)` normal of `a -> b`, the same left as 5.5's default door-push side. Which side the editor offers first and how it draws the arrow are #47's.
|
||||
- **Zero thickness is today, exactly.** `thickness: 0` degrades the rectangle to the segment: same polygon, same collider, same see-over crossing point. Every existing wall migrates to `thickness: 0, position: "center"` and changes nothing [FIXED (owner decision), #45].
|
||||
- **Unit and limits** [FIXED (owner-delegated), 2026-11-15, #45]. Thickness is **px**, a map distance like length and token radius: heights are metres (5.7) and no scale converts between the two (5.7). `0 <= thickness <= 256` px (8 tiles): 0 is the line, and 256 is already a room-sized block better drawn as several walls; the cap bounds the quad. The body may cross the map edge (a border wall thickened outward); only the map area exists, so nothing is drawn or explored outside it.
|
||||
- **The body is opaque floor [FIXED (owner decision), #45].** It is never inside a player's polygon and its own area is never newly explored, so a player's fog stays black under it and no tile is newly revealed there. Explored only grows (5.4), so cells explored before a body was thickened over stay explored and tiles already held stay held; the rule is that a body reveals nothing, ever.
|
||||
- **One shape, two readers [FIXED (owner decision), #45].** Sight and movement read the same exact rectangle, with the same square ends, so a corner cannot be generous to one and tight to the other. A wall with `blocks_sight: false` contributes nothing to sight, body included (a `terrain` wall's thickness is movement-only, 5.8); its collider still uses the thickness.
|
||||
- **Sight: the body quad.** A sight-blocking thick wall enters the vision input as the four faces of its rectangle (two long, two square ends), hoisted once per wall edit and reused for every viewer and frame — viewer-independent, so it caches [#43 measured: 0.26 vs 0.94 ms on 5k sparse and 12.7 vs 13.2 dense, against the 3-face near+caps silhouette that is observer-dependent and cannot be hoisted]. The fan and `cellsTouched` are otherwise unchanged, and zero thickness is the segment of today. What a one-way wall's own body does on its seeing side is #47.
|
||||
- **Movement: exact circle-vs-rectangle.** `dist(c, body)` is the true Euclidean distance from the token's centre to the rectangle, and a centre **inside** the body is distance 0, so it overlaps (`0 < r`). One rectangle-distance primitive, in one place, serves every reader: `pathClear` (the capsule/segment check and the escape rule of 5.5), the `stuck`/`squeezed` overlap check, the door push, `pushOutOfWalls` and resize/grow push. Movement still never reads height (5.9).
|
||||
- **See-over across a body [FIXED (owner decision), #45].** 5.9's comparison is evaluated at **every face the eye -> target-top line crosses**: entering and leaving a body is two crossings (near and far), and an oblique line may cross an end face instead, so the rule is "every crossed face of the rectangle", strictly above the wall's height at each. Both must clear: a target shorter than the viewer's eye has the line falling, so the far face is stricter; a taller one has it rising, so the near face is. With zero thickness the two faces coincide with the wall line, and 5.9 is unchanged. The visible fraction's per-wall minimum becomes a minimum over that wall's crossed faces, so the number cannot drift from the binary answer. Candidate walls still come from the radius-bbox cull, now over the body's box.
|
||||
- **A viewer inside a sight-blocking body sees nothing [FIXED (owner decision), #45].** A token whose vision origin (its centre) lies inside such a body gets an empty polygon until it leaves: no cells, no other tokens, no tiles. It normally overlaps the body and is `stuck` too, so it cannot walk out by itself; the GM moves it out.
|
||||
- **A wall edit never pushes [FIXED (owner decision), #45].** A thickness change, a position flip or a move that puts a body over a token leaves the token where it is and makes it `stuck` (5.5's rule for a wall edit over a token: it may only move to reduce or leave the overlap). Only a door **closing** pushes (5.5; thick-door push geometry is #50). So the GM can thicken a wall through a crowd and nobody teleports.
|
||||
- **Joints: overlap, never a mitre [FIXED (owner-delegated), #45].** Two walls meeting at a corner keep their own rectangles; the bodies overlap at the joint and the outside corner shows a small notch. No mitre, no merged joint, no joint object, and no crack: the overlap is what closes it. A cave is a chain of straight walls. #43 measured that joints need no thickness: zero-width corners show no crack either.
|
||||
- **Shape behind a seam [FIXED (owner-delegated), #45].** A wall's occupied area is produced by **one** wall-shape function, and no other code reads `a`/`b` to build geometry; in v1 that function returns the 5.10 rectangle. Curved, freeform and image-traced walls are out of v1 (1) and land by changing that function alone, so no sight, move, editor or wire code may assume "a wall is a straight segment".
|
||||
- **Editor and fields** [FIXED (owner-delegated), #45]. The GM editor gains a thickness control and a **position flip** with a live preview of the body, the flip never moving `a`/`b` (7.4). A new wall starts at the GM's last-used thickness, held as editor state for the session (not a scene field, not on the wire); a fresh editor starts at 0. The record and the payloads carry `thickness` (number, px, 0..256) and `position` (`center|left|right`, default `center`); the payload shape, columns vs one validated object, and the existing-row migration are #49's (6.1, 8).
|
||||
- Oracles: the independent explored/tile oracle and the leak checker build the body rectangle from `a`, `b`, `thickness` and `position` with their own code, never by calling `vision.nim` or the move rules, and use it for both the sight footprint and the distance test. Assertions land with the build tickets (10.2, 10.3).
|
||||
- Deferred: what a door is with thickness (a leaf inside a deep opening or the full thick segment) and its push geometry -> #50 "Door geometry: thick doors and door push"; a one-way wall occluding its own body on the side that sees across -> #47 "Windows and one-way walls"; columns, payload shape and migration -> #49.
|
||||
|
||||
---
|
||||
|
||||
## 6. Protocol
|
||||
@@ -485,6 +506,7 @@ Validation for `wall.*`: `a != b`, both in bounds; each switch a boolean and `si
|
||||
- `wall.update` patches `a`, `b`, the switches (or one `preset`), and `flags`; at least one of them is required, otherwise `invalid`. A patch is absolute, not additive: a `preset` replaces the whole switch set, so `preset:"door"` on a terrain wall turns it into a closed door. `open` is not a patch field: it belongs to `door.set`, and an `open` field in `wall.update` is an unknown field (ignored, 6.2; a `preset` carrying `open:true` is `invalid` as above). Fields are checked before the target lookup (6.5 steps 7 then 8), so a fieldless `wall.update` is `invalid` whatever the id.
|
||||
- `id` is an integer; lookup failures are `not-found` (a GM's missing target, 6.5 step 8). `door.set` on a row whose `door` is false is `invalid`, and so is `open:true` on a secret door (5.8) or on a locked door (#46, 5.8).
|
||||
- `kind` is **output only** on the `wall`/`walls` frames: the label derived from the switches (`wall`, `door`, `secret_door`, `locked_door`, `terrain`, `one_way`, else `custom`). It is not accepted as an input field; an input `kind` is an unknown field (ignored, 6.2). Field names, defaults and the existing-row migration are #49's; the rule here is that the switches are the authority and the label is derived.
|
||||
- `thickness` and `position` (5.10) are wall fields too: `thickness` a number in px `0 <= t <= 256`, `position` one of `center|left|right` (default `center`). Like the switches they are typed and validated server-side and never live in `flags`; their payload shape, whether they are columns or part of one validated object, and the existing-row migration are #49's.
|
||||
- `wall.add` assigns the id from the scene's `next_wall_id`, which is monotonic and never reused (#3, 8; removal does not touch it, and a restart reloads it from the DB).
|
||||
- Every write is one transaction with `synchronous=FULL` around it (Q12: GM authoring is the data that is expensive to lose) and `NORMAL` again afterwards; the in-memory scene is updated only after COMMIT, so a failed write leaves memory and DB identical.
|
||||
|
||||
@@ -709,7 +731,7 @@ Prototype `client/src/main.ts`: explored rects appended to a `Graphics` mask for
|
||||
|
||||
### 7.4 Input and UI
|
||||
- Mouse: wheel zoom, drag pan, drag token. Touch: one finger drag/pan, two-finger pinch/pan [MEASURED works on Note 10].
|
||||
- Wall editor (GM) [FIXED, Q6, extended by 5.8]: click-click segments, snap to grid/endpoints optional, delete, undo of last edit [PROPOSED]; submits `wall.*` intents; server is the validator. A preset row (`wall` (default), `door`, `secret door`, `locked door`, `terrain`, `one-way wall`) sets the switches for a one-drag default; an **advanced** toggle exposes the raw switches (`blocks_sight`, `blocks_movement`, `sight_dir`, `door`, `open`, `secret`, `locked`) for a custom wall. The editor draws `kind` (the derived label) only; no preset is a stored kind. Thickness and height controls arrive with #45 and M4. A locked door's open action is the `invalid` case of 5.8, so the editor shows the hint "locked: unlock first" and offers the one click that clears `locked`; no door action is offered to players (#46).
|
||||
- Wall editor (GM) [FIXED, Q6, extended by 5.8, 5.10]: click-click segments, snap to grid/endpoints optional, delete, undo of last edit [PROPOSED]; submits `wall.*` intents; server is the validator. A preset row (`wall` (default), `door`, `secret door`, `locked door`, `terrain`, `one-way wall`) sets the switches for a one-drag default; an **advanced** toggle exposes the raw switches (`blocks_sight`, `blocks_movement`, `sight_dir`, `door`, `open`, `secret`, `locked`) for a custom wall. A thickness control and a **position flip** (`center|left|right`) sit beside them, the flip previewing the body live and never moving `a`/`b`; a new wall starts at the GM's last-used thickness (0 in a fresh editor). The editor draws `kind` (the derived label) only; no preset is a stored kind. The height control is M4's (5.7). A locked door's open action is the `invalid` case of 5.8, so the editor shows the hint "locked: unlock first" and offers the one click that clears `locked`; no door action is offered to players (#46).
|
||||
- Grid snap on drop: client option, off by default [FIXED, Q18]. Server accepts any in-bounds position within the step cap and clear of walls (5.5; step cap = effective vision radius, Q18 FIXED).
|
||||
- Who-sees-it view (GM only) [FIXED (owner decision), 2026-11-15, #44]: for each token, which player(s)/characters see it and its visible fraction (5.9, 100 % when unobstructed). GM-only and never on a player wire; the panel's shape belongs to the M4 editor/fog work.
|
||||
|
||||
@@ -728,7 +750,7 @@ 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). The column lives on the `scene` row created by migration step 3 (4.4), and the wire rules for the four wall intents are in 6.1. 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`, `token_radius_default` (px, > 0, no upper cap [FIXED, #4]), `art_version`, `active`, free-form `extra`.
|
||||
- **Wall [FIXED, owner decision 2026-11-15, #42]**: `scene, id` (per-scene, see above), `a:[x,y], b:[x,y]`, the switches `blocks_sight, blocks_movement, sight_dir ('both'|'left'|'right')`, the door settings `door, open, secret, locked`, and the free `flags`. Behaviour comes from the switches (5.8); `kind` is only a derived output label (`wall`, `door`, `secret_door`, `locked_door`, `terrain`, `one_way`, else `custom`) and is never stored. `blocks = blocks_movement and not (door and open)`; a `terrain` wall is absent from the sight input. GM-only everywhere. **Height [FIXED, 2026-11-15, #41]**: an optional height in metres on the wall record (> 0, <= 100 m); absent = full height, which blocks sight for every viewer (5.7). Existing walls carry none and are unchanged. Thickness and the low-wall rules are #44/#45; the wire fields and the migration are #49. Rejected: a stored `kind` enum, and a `window` kind before #47 gives it a rule (in v1 "sees over, does not pass" is `terrain`).
|
||||
- **Wall [FIXED, owner decision 2026-11-15, #42]**: `scene, id` (per-scene, see above), `a:[x,y], b:[x,y]`, the switches `blocks_sight, blocks_movement, sight_dir ('both'|'left'|'right')`, the door settings `door, open, secret, locked`, and the free `flags`. Behaviour comes from the switches (5.8); `kind` is only a derived output label (`wall`, `door`, `secret_door`, `locked_door`, `terrain`, `one_way`, else `custom`) and is never stored. `blocks = blocks_movement and not (door and open)`; a `terrain` wall is absent from the sight input. GM-only everywhere. **Height [FIXED, 2026-11-15, #41]**: an optional height in metres on the wall record (> 0, <= 100 m); absent = full height, which blocks sight for every viewer (5.7). Existing walls carry none and are unchanged. **Thickness and position [FIXED, 2026-11-15, #45]**: `thickness` (px, 0..256, default 0 = the drawn line) and `position` (`center|left|right`, default `center`) turn the segment into a rectangular body with square ends for both sight and movement (5.10); existing walls get `0`/`center` and behave exactly as before. The wire fields, columns vs one validated object, and the migration are #49's. The low-wall rules are 5.9 (#44). Rejected: a stored `kind` enum, and a `window` kind before #47 gives it a rule (in v1 "sees over, does not pass" is `terrain`).
|
||||
- **Entity (token and anything else) [PROPOSED, FFF seam]**:
|
||||
- `id` (random text, see above), `scene, kind` (free string: `pc`, `npc`, `item`...), `character_id` (NULL = plain token, e.g. monster or item; else the character it figures), `descriptive_name`, `actual_name` (plain tokens only; a character's tokens use the character's names), `pos`, `radius` (px, > 0, no upper cap; NULL = use scene `token_radius_default`; GM-only to set [FIXED, #4]; 5.6), `owner` = token controller (player id or null = GM-controlled; independent of the character's owner, 8), `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` (token controller + 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]. **`height` and `eye_height` (5.7) are the first two registered keys**, both in the `gm` bucket and both `number`: on a plain token they are its own values, on a linked token the token's values are a temporary override of the character's base (5.7) [FIXED, 2026-11-15, #41].
|
||||
@@ -911,7 +933,7 @@ Each is small, ends with a green gate, and no milestone depends on browser UI be
|
||||
8. **persistence**: explored chunks round trip; old DB migrates to new (H13, 4.4, 10.3; migrations are PROPOSED in 4.4).
|
||||
9. **logs**: no secret in any log; the test greps the logs for every key and session value it used (T6, 11.3 PROPOSED). **Built by slice 10 (#25):** `tools/logs.test.mjs` (two runs incl. a GM-key rotation, keys/sessions/hashes, and a `keylog` leak-fault negative control; details in 10.3).
|
||||
- **M4 - Client v1.**
|
||||
- Scope: new `client/` dir (first real client build): Vite + TS + Pixi v8 client: layers, tiles, grid, tokens (BitmapText), character list, encountered list (greyed), reveal buttons (#14 UI; server side in M3), fog textures, wall editor with presets (5.8), token drag with prediction/rollback, DOM overlay, reconnect backoff, reducer tests; after the client port, archive `prototype-*` dirs (Q24).
|
||||
- Scope: new `client/` dir (first real client build): Vite + TS + Pixi v8 client: layers, tiles, grid, tokens (BitmapText), character list, encountered list (greyed), reveal buttons (#14 UI; server side in M3), fog textures, wall editor with presets (5.8) and thickness/position (5.10), token drag with prediction/rollback, DOM overlay, reconnect backoff, reducer tests; after the client port, archive `prototype-*` dirs (Q24).
|
||||
- Accept: headless e2e: fog pixel checks, player traffic audit clean, reconnect restores; manual run on laptop and Note 10 at 60 fps with 50 tokens, 16384 px map (tiled; PROPOSED test target, Q2), fog active.
|
||||
- Tile-size gates [FIXED, Q4]: (a) automated headless-Chromium test with mobile emulation (viewport, dpr, CPU + network throttle) against the real server path (nginx HTTP/2 + caching): viewport fills in < 1 s at zoom 1; (b) one manual run on the owner's 5-year-old Android phone (worst-case reference). If either fails: `tile_size` 64 px (per-scene config, no code change). The 2026-11-08 prototype phone run (`prototype-tile-leak/README.md`) is evidence, not the gate: HTTP/1.1, no-store, zoom 0.5 only, first cold load up to 3.3 s.
|
||||
- **M5 - Robustness and observability.**
|
||||
@@ -1012,10 +1034,12 @@ Owner also decided 2026-11-15 [FIXED (owner-delegated, 2026-11-15, #25)]: the M3
|
||||
|
||||
Out of M3 accept, unchanged: concurrency (M5) and the 127.0.0.1 bind check (M6 deploy) [FIXED, #12]. **Measured 2026-11-15 on the final tree:** `devbox run test` exit 0 (Nim suite all pass; 103 Node harness tests, 0 fail) and `devbox run mutation` exit 0 (control passes, all 63 mutations fail >= 1 expected test, the new `d3` included; log `results/mutation.log`). See 6.1, 10.3, 10.4, 13.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #41]: the height model. Heights are metres, decimal; map distances stay px and no map scale is introduced, because see-over compares heights with heights (research #39 3.3). `height` and `eye_height` are properties, not fields: a character carries the base value, a plain token must carry its own (`token.create` without one is refused), a linked token uses the character's value and may carry a temporary on-map override that never writes the character. Effective token height = token override, else character, else the plain token's own. Eye height follows the same pattern; if nobody set one by hand anywhere it is 93% of the effective token height and follows changes live [93% FIXED (owner-delegated)]. A wall is full height (nobody sees over it) unless the GM gives it one in metres; existing walls are unchanged. Both keys live in the `gm` bucket, so players see only the outcome, their sight. They are the first two keys of the property-schema registry (`number`, `gm`), so "the server never interprets props in v1" becomes "the server interprets only registered keys used by core sight rules". Limits [FIXED (owner-delegated)]: all heights > 0; `height` <= 100 m; `eye_height` <= 100 m and may exceed `height`; a wall's height > 0 and <= 100 m. Deferred: the target's height in see-over (#44) and the height existing tokens and characters get at migration (#49); wall kinds were settled afterwards by #42 (5.8, v0.22), while thickness (#45) and what a low wall hides (#44) stay with map #38. See 5.7, 6.1, 8, 9.
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #41]: the height model. Heights are metres, decimal; map distances stay px and no map scale is introduced, because see-over compares heights with heights (research #39 3.3). `height` and `eye_height` are properties, not fields: a character carries the base value, a plain token must carry its own (`token.create` without one is refused), a linked token uses the character's value and may carry a temporary on-map override that never writes the character. Effective token height = token override, else character, else the plain token's own. Eye height follows the same pattern; if nobody set one by hand anywhere it is 93% of the effective token height and follows changes live [93% FIXED (owner-delegated)]. A wall is full height (nobody sees over it) unless the GM gives it one in metres; existing walls are unchanged. Both keys live in the `gm` bucket, so players see only the outcome, their sight. They are the first two keys of the property-schema registry (`number`, `gm`), so "the server never interprets props in v1" becomes "the server interprets only registered keys used by core sight rules". Limits [FIXED (owner-delegated)]: all heights > 0; `height` <= 100 m; `eye_height` <= 100 m and may exceed `height`; a wall's height > 0 and <= 100 m. Deferred: the target's height in see-over (#44) and the height existing tokens and characters get at migration (#49); wall kinds were settled afterwards by #42 (5.8, v0.22), and what a low wall hides (#44) and thickness (#45) were settled afterwards in 5.9 and 5.10. See 5.7, 6.1, 8, 9.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #42]: the wall model. A wall's behaviour is **independent switches**, and a named kind is only a **preset** over them: never a fixed kind enum in the record, and never client-interpreted free flags (the client may send a preset name; the server expands and validates it). v1 switches are `blocks_sight` and `blocks_movement` plus the door settings `door`, `open`, `secret`, `locked` and one direction field `sight_dir` (`both|left|right`); no light or sound axis. Direction is **sight only**: movement is two-way governed by its switch. A door is a wall with `door` set and independent `open`/`secret`/`locked` settings, not a separate kind or a state enum, and `door.set` keeps working as "set `open`". The switches describe the closed wall: an open door blocks neither sight nor movement. A secret door is always closed and two-way (`open:true` or `sight_dir != both` on it is `invalid`), so it can look exactly like a solid wall. `secret` and `locked` are GM-only and never observable to a player in any form; the obligations are byte-identical player frames and refusals for a closed secret door against a solid wall, and one uniform move nack. v1 presets (one-drag editor defaults and the GM's label) are `wall` (default), `door`, `secret door`, `locked door`, `terrain` (blocks movement, not sight: railing, bushes) and `one-way wall`; there is no `window` preset until #47 gives windows a rule, and "blocks nothing" is not a preset. The record stores the switches; `kind` survives on the wire as a derived read-only label (exact preset match, else `custom`), never an input and never the authority [FIXED (owner-delegated)]. The switches are typed validated fields on the record and in the payloads, not entries in the never-interpreted `flags`; columns vs one validated object, and the existing-row migration, are #49's [FIXED (owner-delegated)]. The GM editor has a preset row plus an **advanced** toggle that exposes the raw switches [FIXED (owner decision)]. Thickness and height compose through the switches (a wall with `blocks_sight=false` never reaches the sight predicate) and are decided in #45 and #44. See 1, 3.1, 5.1, 5.5, 5.8, 6.1, 7.4, 8, 14.
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #42]: the wall model. A wall's behaviour is **independent switches**, and a named kind is only a **preset** over them: never a fixed kind enum in the record, and never client-interpreted free flags (the client may send a preset name; the server expands and validates it). v1 switches are `blocks_sight` and `blocks_movement` plus the door settings `door`, `open`, `secret`, `locked` and one direction field `sight_dir` (`both|left|right`); no light or sound axis. Direction is **sight only**: movement is two-way governed by its switch. A door is a wall with `door` set and independent `open`/`secret`/`locked` settings, not a separate kind or a state enum, and `door.set` keeps working as "set `open`". The switches describe the closed wall: an open door blocks neither sight nor movement. A secret door is always closed and two-way (`open:true` or `sight_dir != both` on it is `invalid`), so it can look exactly like a solid wall. `secret` and `locked` are GM-only and never observable to a player in any form; the obligations are byte-identical player frames and refusals for a closed secret door against a solid wall, and one uniform move nack. v1 presets (one-drag editor defaults and the GM's label) are `wall` (default), `door`, `secret door`, `locked door`, `terrain` (blocks movement, not sight: railing, bushes) and `one-way wall`; there is no `window` preset until #47 gives windows a rule, and "blocks nothing" is not a preset. The record stores the switches; `kind` survives on the wire as a derived read-only label (exact preset match, else `custom`), never an input and never the authority [FIXED (owner-delegated)]. The switches are typed validated fields on the record and in the payloads, not entries in the never-interpreted `flags`; columns vs one validated object, and the existing-row migration, are #49's [FIXED (owner-delegated)]. The GM editor has a preset row plus an **advanced** toggle that exposes the raw switches [FIXED (owner decision)]. Thickness and height compose through the switches (a wall with `blocks_sight=false` never reaches the sight predicate) and are decided in 5.10 and 5.9. See 1, 3.1, 5.1, 5.5, 5.8, 6.1, 7.4, 8, 14.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #44]: low walls. A token is visible iff **its top clears every sight wall the line from the viewer's eye crosses**, strictly: the sight line's height at the wall (`h_e + (h_t - h_e)·d_W/d_T`) must exceed the wall's height, and one failing wall hides it. The target's own height therefore matters (a giant's head over a fence, a crouched figure hidden next to the wall it would clear from further away); there is no adjacent-visible exception and no distance rule. The visibility polygon stays **strict**, so the floor behind a low wall stays unexplored and black, no tile is sent, and a visible token may stand on a black cell; no per-cell height is tested anywhere. Movement never reads height: `blocks_movement` alone decides, so a knee-high wall with the switch on stops a walker. Players get a binary answer and the whole token, with no clipping and no cover percentages (a rules-engine judgement, still a non-goal). The GM gets a GM-only **who-sees-it** view: per token, which player(s)/characters see it and its visible fraction (the share of its height above the highest blocking sight line, 100 % unobstructed), derived from data the GM already receives, never on a player wire, its panel shape M4's. Knobs delegated: strict comparison with equality hidden, evaluated at the wall near face; every crossed wall must clear; the hook sits at `visibleTo` as `insideAny or predicate` with heights never entering `visibilityPolygon`; no "see-over" switch on the wall; the hidden band's cells and tiles are oracle-*maybe*, a band-hidden token gives no frame, name or churn, and the leak checker's clear-line oracle gets its own height test. See 5.7, 5.8, 5.9, 7.4.
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #44]: low walls. A token is visible iff **its top clears every sight wall the line from the viewer's eye crosses**, strictly: the sight line's height at the wall (`h_e + (h_t - h_e)·d_W/d_T`) must exceed the wall's height, and one failing wall hides it. The target's own height therefore matters (a giant's head over a fence, a crouched figure hidden next to the wall it would clear from further away); there is no adjacent-visible exception and no distance rule. The visibility polygon stays **strict**, so the floor behind a low wall stays unexplored and black, no tile is sent, and a visible token may stand on a black cell; no per-cell height is tested anywhere. Movement never reads height: `blocks_movement` alone decides, so a knee-high wall with the switch on stops a walker. Players get a binary answer and the whole token, with no clipping and no cover percentages (a rules-engine judgement, still a non-goal). The GM gets a GM-only **who-sees-it** view: per token, which player(s)/characters see it and its visible fraction (the share of its height above the highest blocking sight line, 100 % unobstructed), derived from data the GM already receives, never on a player wire, its panel shape M4's. Knobs delegated: strict comparison with equality hidden, evaluated at the wall near face (a thick wall: every crossed face, 5.10, #45); every crossed wall must clear; the hook sits at `visibleTo` as `insideAny or predicate` with heights never entering `visibilityPolygon`; no "see-over" switch on the wall; the hidden band's cells and tiles are oracle-*maybe*, a band-hidden token gives no frame, name or churn, and the leak checker's clear-line oracle gets its own height test. See 5.7, 5.8, 5.9, 7.4.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #46]: secret and locked doors. (1) **Player door opening is out of v1** [FIXED (owner decision)]: only the GM opens or closes a door; `door.set` stays G-only and a player sender is `not-allowed` at the role step (6.5) whatever the door's settings. Player-opened doors, lock refusals addressed to players and player discovery of secret doors (searching, revealing, finding a way in) are future effort, not v1 and not this map; the lock is GM authoring state. (2) **A locked door does not open** [FIXED (owner decision)]: `door.set open:true` on a door with `locked` is `invalid`, exactly like a secret door, and the GM unlocks first (editor hint "locked: unlock first"); any write that would store `open:true` with `locked` or `secret` — `wall.add`, `wall.update`, a preset expansion — is `invalid`; closing a locked door is allowed. Otherwise a locked door is an ordinary closed door. (3) **The equivalence oracle** [FIXED (owner-delegated)]: `tools/doors.test.mjs` is a new Node accept group (built-ins only, 10.4) in the shape of `tools/probing.test.mjs` — two servers, fresh state, one identical script, scenes differing only in one segment (solid wall vs secret door; solid wall vs secret+locked; closed door vs locked closed door), player frames and per-tile statuses identical after canonicalisation with **no** normalisation; the positive control is the same script against an open door, which must differ; the negative control is `LEAK_FAULT=secretgap` (a secret door not blocking the player-facing computation), which must fail the doors group while a clean build passes and ships no fault string; `tools/leakcheck.nim`'s banned-key scan grows `secret`, `locked`, `door`, `blocks_sight`, `blocks_movement`, `sight_dir` (and #49's names) into `WALLDATA`, with a new fault leaking one door setting key and asserting exactly `WALLDATA`; a GM `door.set` on a secret or locked door is `invalid` and a player `door.set` is `not-allowed` for every door; timing and size side channels (T11) stay accepted and untested. See 1, 3.4, 5.8, 6.1, 6.5, 7.4, 10.3.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #45]: thick walls. (1) **Placement** [FIXED (owner decision)]: `position` is `center` (default), `left` or `right` of the drawn `a -> b` line, using 5.8's side convention; the line is the room's interior, the body grows outward, and a flip changes only the body, never `a`/`b`. (2) **Body** [FIXED (owner decision)]: a rectangle `|ab|` x `thickness` with square ends, offset per `position`; `thickness: 0` is today exactly and every existing wall migrates to zero and unchanged. It is opaque floor: never in a player polygon, never newly explored, no tile newly revealed under it. (3) **One shape** [FIXED (owner decision)]: sight footprint and movement collider are the same exact rectangle, sight as the 4-face quad hoisted per wall edit (#43 measured) and movement as exact circle-vs-rectangle distance with a centre inside the body counting as overlap; one rectangle-distance primitive serves `pathClear`, the overlap/`stuck` check, the door push, `pushOutOfWalls` and resize; a `blocks_sight:false` wall contributes nothing to sight, body included, while its collider keeps the thickness. (4) **Default thickness** [FIXED (owner decision)]: a new wall starts at the GM's last-used thickness, 0 in a fresh editor. (5) **See-over** [FIXED (owner decision)]: 5.9's line must clear **every crossed face** of the body, near and far, strictly; the faces coincide at zero thickness, so 5.9 stands. (6) **Edits never push** [FIXED (owner decision)]: a thickness change, flip or move that covers a token leaves it in place and `stuck`; only a door close pushes. (7) **A viewer inside a sight-blocking body sees nothing** [FIXED (owner decision)]: empty polygon until it leaves. (8) **No dead end** [FIXED (owner decision)]: v1 walls stay straight rectangles (a cave is a chain of walls; joints overlap with a small outer notch and no crack), the shape sits behind one seam, and curved/freeform walls and tracing walls from a map image are future effort. Delegated: px thickness `0..256`; the `(-dy, dx)` side formula; joints by overlap, no mitre; field names `thickness` and `position`; the last-used default as editor state. Downstream: thick doors and push geometry #50, one-way body occlusion #47, wire/schema/migration #49. See 1, 5.1, 5.3, 5.5, 5.7, 5.8, 5.9, 5.10, 6.1, 7.4, 8, 13.
|
||||
|
||||
Reference in New Issue
Block a user