design: terrain dropped, presets, window markers (#48)

This commit is contained in:
2026-11-16 22:39:20 +01:00
parent b8f04c2faf
commit 7ac915ae6c
2 changed files with 69 additions and 52 deletions
+56 -43
View File
@@ -1,6 +1,6 @@
# FFF_vtt design
Status: draft v0.26, 2026-11-16 (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; v0.26 records #47 (windows as see-through wall pieces with no sill or top and the `window` preset, one-way direction wording, the body opaque from both sides, and the one-way oracle and fault class) in 1, 5.1, 5.8, 5.9, 5.10, 6.1, 7.4, 8, 10.3, 14. All of Q1-Q24 are RESOLVED or DEFERRED; none OPEN). Audience: the owner and coding agents.
Status: draft v0.27, 2026-11-16 (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; v0.26 records #47 (windows as see-through wall pieces with no sill or top and the `window` preset, one-way direction wording, the body opaque from both sides, and the one-way oracle and fault class) in 1, 5.1, 5.8, 5.9, 5.10, 6.1, 7.4, 8, 10.3, 14; v0.27 records #48 (`terrain` dropped, four presets, the `player_marker` switch and its player-wire exception, the GM-only wall `label`, and the "fewest things" principle) in 1, 3.1, 3.4, 5.1, 5.8, 5.9, 5.10, 6.1, 7.4, 8, 10.3, 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.
@@ -22,10 +22,13 @@ Evidence roots (relative to repo root):
### Goal
A browser virtual tabletop for one table (1 GM + up to 6 players [FIXED, Q1]), self-hosted, where the **server alone decides what each player sees**. A modified client must learn nothing it is not entitled to.
### Principles [FIXED (owner decision), 2026-11-16, #48]
- **Do the most with the fewest things: one object, switches on top, names are only labels.** A wall is one record; its behaviour is a small set of independent switches; preset names (`wall`, `door`, `window`, `one-way`) are editor shortcuts and labels over those switches, never storage and never a second kind of object. Apply this principle to future cards: prefer a new switch or field on the existing object over a new object, a new message or a new enum. Corollary: if two features have the same switches, they have the same rules and the same name — no parallel implementations.
### 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`, `window`) 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, windows, 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.
- 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, player marker) plus door settings; the editor's four presets (`wall`, `door`, `window`, `one-way`) are one-drag defaults over them, and `secret`/`locked` are checkboxes on any door (5.8; supersedes Q6's `wall`|`door` only and #42/#47's longer preset list). A wall also has a per-wall thickness and height (5.10, 5.7).
- GM tools: author walls, doors, windows 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.
- Persistence across restarts; reconnect resync; backups.
@@ -33,7 +36,8 @@ A browser virtual tabletop for one table (1 GM + up to 6 players [FIXED, Q1]), s
### Non-goals for v1 (later or never)
- RPG rules, dice, character sheets, initiative. FFF engine plug-in: seam only (section 9).
- Dynamic lighting, light sources, darkvision tiers, per-token vision radius beyond one numeric property. Windows that see only within a distance: a v1 window is see-through along its whole drawn length, with no distance rule (5.8, #47). Windows with a real sill and top height, and light coming through windows, are future effort, to be discussed when lighting arrives.
- Dynamic lighting, light sources, darkvision tiers, per-token vision radius beyond one numeric property. Windows that see only within a distance: a v1 window is see-through along its whole drawn length, with no distance rule (5.8, #47). Windows with a real sill and top height, light coming through windows, and per-wall material (stone, wood, glass): future effort, to be discussed when lighting arrives (#48).
- Difficult terrain, movement cost and pit/fall semantics: a rules-engine judgement (FFF), not a wall behaviour; v1 walls only block or pass movement (5.9, #48).
- Accounts, passwords, OAuth, multiple tables/campaigns per server, public hosting.
- 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).
@@ -98,7 +102,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 (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 |
| Walls: geometry (thickness and the body's side included, 5.10), switches, door settings, `player_marker`, `label` and the derived `kind` label (5.8) | all, always | **never**, with one exact exception: the player's own marker — an anchor point and nothing else (5.8, #48) | 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 |
@@ -122,6 +126,7 @@ Notes:
- `hello` to a player carries world size, tile size, explored cell size, scene default token and vision radius, art version, own player id and name. None of these is secret (owned token ids travel as `mine` on `token`, 6.1). It must not carry scene/entity counts or wall counts.
- A token's radius and statuses go to every recipient who sees the token [FIXED, owner decision 2026-11-10, #4]. Amended 2026-11-14: a status entry's `source` goes to the GM only; viewers see the status (e.g. `squeezed`), not its cause. The controlling owner gets no `source` either (the doc has no owner-view rule for statuses; revisit if wanted).
- [FIXED, #14] Names and lists: no code path sends an actual name, a reveal state, or another player's character or encountered entry to a player, unless the rules in 8 allow it. Players learn a character only through a token they saw or controlled, or through their own encountered list. A character owner change never changes token controllers.
- **The one exception: a player marker [FIXED (owner decision), 2026-11-16, #48].** A wall with `player_marker` on sends a player, once that player has seen part of it, exactly one thing: an **anchor point** (px) and the player's own opaque marker id. No type, no `kind`, no `open`/`closed`, no `sight_dir`, no `label`, no thickness, height, wall id or switch. The client draws the window icon from the anchor alone. Everything else about walls stays GM-only (T2), and the marker never carries a second fact: this is the only wall-derived data on a player wire in v1. Details (defaults, anchor, lifetime, retraction) are in 5.8; the message name is `marker` and its shape is #49's.
### 3.2 Authentication: shared link, player keys, GM key
- **Shared site link [FIXED, #6].** One link for everyone: `https://host/`. Without a session it shows only the sign-in page, no data.
@@ -157,7 +162,7 @@ Notes:
| # | Threat | Mitigation | Test |
|---|---|---|---|
| T1 | Player reads hidden token/entity/prop from WS | view builder filters by LOS, `gm_only`, bucket; single egress | leak test + fault classes |
| T2 | Player reads wall/door data | walls only in GM view | fault `walls` [MEASURED caught]; door-equivalence test (T17, 10.3) |
| T2 | Player reads wall/door data | walls only in GM view; the sole exception is a player's own marker (anchor point + opaque id, nothing else, 3.1/5.8, #48) | fault `walls` [MEASURED caught]; `MARKER_EARLY`/`MARKER_EXTRA`/`MARKER_OFF` (10.3); door-equivalence test (T17, 10.3) |
| T3 | Player reads other player's vision/explored/ownership | per-player view only | faults `other-*` [MEASURED caught] |
| T4 | Player fetches unexplored tiles | Nim gate + internal nginx location | leak (d) against the independent oracle, smoke steal check, direct `/_tiles/` -> 404 (M3 test nginx) |
| T5 | Tile-edge over-disclosure: one 32 px cell grazed by vision, never revoked | tile_size = explored cell = 32 px, no server masking, authoring rule ~32 px (Q4 FIXED) | documented, not testable as a leak; M4 timing gates (13) |
@@ -282,7 +287,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 (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 skipped for a viewer on its blind side (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 window (`blocks_sight:false`) are absent from it, and a one-way wall is skipped for a viewer on its blind side (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.
@@ -375,38 +380,41 @@ What the vertical dimension is made of, and in what unit. Vision only: what a lo
- 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) were settled afterwards in 5.9 and 5.10.
### 5.8 Wall switches, presets, doors, windows and one-way [FIXED (owner decision), 2026-11-15, #42; windows and the direction settled 2026-11-16, #47]
### 5.8 Wall switches, presets, doors, windows and one-way [FIXED (owner decision), 2026-11-15, #42; windows and the direction settled 2026-11-16, #47; presets, `player_marker` and `label` settled 2026-11-16, #48]
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).
- **v1 switches [FIXED (owner decision), Q2; `player_marker` added 2026-11-16, #48].** `blocks_sight: bool`, `blocks_movement: bool`, `player_marker: bool` (default `false`; what it sends a player is below); door settings `door: bool`, `open: bool`, `secret: bool`, `locked: bool`; one direction field `sight_dir: "both"|"left"|"right"` (default `both`). `label` is a separate GM-only free-text field, not a switch (below). No light axis, no sound axis and no material in v1 (and none on the map) (#48: material is future lighting effort).
- **One object, names are labels [FIXED (owner decision), 2026-11-16, #48].** There is no `terrain` name, preset or derived kind: a railing, a bush, a pit edge and a fixed window are all the same switch set (`blocks_sight:false`, `blocks_movement:true`) and all derive `window`. They differ only in the GM's `label`. This is the §1 principle applied to walls: one object, switches on top, names are labels.
- **Direction is sight only, and `left` names the blind side [FIXED (owner decision), Q4; wording settled 2026-11-16, #47].** `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: **left is the `(-dy, dx)` normal of `a -> b`**, the same side and the same formula as `position` (5.10) and 5.5's default door-push side. **`sight_dir:"left"` means a viewer standing on the left side cannot see across the wall; a viewer on the right side sees across it** — the field names the side that is blind, never the side that sees. The `one_way` preset defaults to `sight_dir:"left"`, and the editor's flip swaps `left`/`right` without moving `a`/`b` (7.4). `sight_dir != "both"` with `blocks_sight:false` is `invalid` (a direction with nothing to block), and a secret door stays two-way (below).
- **Doors are walls with `door` set, and their settings are independent [FIXED (owner decision), Q3].** `open`, `secret` and `locked` exist only with `door` (`invalid` otherwise). `door.set` keeps working and keeps meaning "set `open`" (6.1); it is not replaced by a door-state enum, and secret/locked are not separate kinds.
- **Closed vs open.** The switches describe the *closed* wall. An open door blocks neither sight nor movement, both sides and direction included, and its stored switches are unchanged; closing restores them. This keeps today's rule (`blocks = not (door and open)`, 5.5) and makes opening a door the only way a door stops blocking.
- **A secret door is always closed.** `door.set open:true` on a secret door is `invalid`; the GM clears `secret` first (one click in the editor). `secret` with `sight_dir != both` is also `invalid`; `secret` with `locked` is allowed. Why: a secret door must be indistinguishable from a solid wall to every player (3.1), and an open or one-way secret door would show a gap or a sight seam.
- **Player-observability [FIXED (owner-delegated), #42].** `secret` and `locked` never reach a player in any form: wall data is GM-only (3.1), and the only player-visible effects of a wall are the vision polygon, the explored grid, tiles and token frames. Consequences: a closed secret door must give byte-identical player frames and identical refusals to a solid wall of the same switches; a locked door is just a closed door to sight and movement; no refusal names locked, secret, solid or any other cause (the uniform move nack, 5.5/6.5, already holds). The oracle that pins this is the differential door-equivalence test (10.3, T17, #46).
- **A secret door is always closed, two-way and opaque.** `door.set open:true` on a secret door is `invalid`; the GM clears `secret` first (one click in the editor). `secret` with `sight_dir != both`, with `blocks_sight:false` or with `blocks_movement:false` is also `invalid`; `secret` with `locked` is allowed. Why: a secret door must be indistinguishable from a solid wall to every player (3.1), and an open, one-way or see-through secret door would show a gap or a sight seam. A see-through door cannot be secret; it can be locked (an opening window whose lock the GM must clear first).
- **Player-observability [FIXED (owner-delegated), #42; marker exception 2026-11-16, #48].** `secret` and `locked` never reach a player in any form: wall data is GM-only (3.1), and the only player-visible effects of a wall are the vision polygon, the explored grid, tiles, token frames and — for a marked wall only — the marker (next two bullets). Consequences: a closed secret door must give byte-identical player frames and identical refusals to a solid wall of the same switches; a locked door is just a closed door to sight and movement; no refusal names locked, secret, solid or any other cause (the uniform move nack, 5.5/6.5, already holds). The oracle that pins this is the differential door-equivalence test (10.3, T17, #46). **No other hint of a barrier ever reaches a player**: a refused move stays the uniform nack, with no marker added, no shape change and no cause.
- **Player marker: the one wall fact a player receives [FIXED (owner decision), 2026-11-16, #48; shape delegated].** `player_marker` is a switch on the wall. On for the `window` preset, **off** for every other preset and for raw switches (a GM may toggle it on any wall). It sends a player **one anchor point and nothing else** — no type, no `kind`, no open/closed, no `sight_dir`, no `label`, no thickness, no height, no wall id, no switch — and the client draws the window icon there. An invisible barrier is simply a window with the marker off. This is the exact, only exception to "walls never reach a player" (3.1) and it is deliberately thin: the marker says "a window is around here", never what it does.
- **Anchor [FIXED (owner-delegated), #48].** The anchor is the wall's drawn midpoint, fixed for the wall (it never follows the viewer). The marker qualifies for a player once **any point of the wall's visible extent** — the segment for a zero-thickness wall, the body's boundary for a thick one — has been inside that player's vision polygon: the same polygon that decides token visibility (5.1). *Why not the midpoint inside the polygon:* a thick wall's midpoint lies inside its own opaque body (5.10), which is never in any polygon, so a thick marked window would never fire. *Why this cannot leak:* the gate is the player's own vision polygon, so nothing behind a sight-blocking wall qualifies; the marker carries no geometry, so the only imprecision is that the anchor may sit up to half a wall piece beyond the visible end — and a window piece is short by construction (`wall | window | wall`), like a door.
- **Lifetime [FIXED (owner-delegated), #48].** Once seen, the marker is that player's memory, like the explored grid: it rides with explored, is persisted per player (storage is #49's), survives disconnect and never retracts because the player walked away, a door closed or sight was lost. It **is** retracted when the GM changes the cause: the wall is removed, `player_marker` is turned off, the wall stops being a window (a switch or `sight_dir` change), or its geometry moves (`a`/`b`, `thickness`, `position`). A retraction reveals only that the GM changed something there, never a new position: a moved wall re-earns its marker only when the player sees the new geometry. Retraction never un-explores a cell and never revokes a tile.
- **Wire [FIXED (owner-delegated), #48].** The message is the dotless server noun `marker`; its fields, its full-set/diff form and the removal spelling are #49's. The id is opaque and **per player** (assigned by the server, never the wall id, never shared between players) so the frame can be diffed and a marker removed without exposing wall identity or count.
- **Wall `label` [FIXED (owner-delegated), 2026-11-16, #48].** Every wall may carry an optional GM-only free-text `label` (e.g. "railing", "pit edge", "the king's window"): at most 64 code points, trimmed, no control characters, the 6.5 text rule. It has no behaviour, is stored verbatim, never derived from the switches and never feeds the derived `kind`. It never reaches a player: it is in the leak checker's `BannedAlways` key scan (`10.3`), so a player frame carrying `label` is `WALLDATA`.
- **Only the GM touches a door [FIXED (owner decision), 2026-11-15, #46].** In v1 `door.set` stays G-only: a player sender is refused `not-allowed` at the role step (6.5), whatever the door's settings and whether it is locked or secret. Player-opened doors, lock refusals addressed to a player and player discovery of secret doors (searching, revealing, finding a way in) are not in v1 and not in this map; they are future effort (1). The lock and `secret` are therefore GM authoring state: no player-facing lock message, no lock/unlock intent, and the uniform move nack (5.5) is the only refusal a player ever gets from a wall.
- **A locked door does not open [FIXED (owner decision), 2026-11-15, #46].** `door.set open:true` on a door with `locked` is `invalid`, exactly as for a secret door: the GM unlocks first (editor: one click, hint "locked: unlock first", 7.4). Any write that would store `open:true` together with `locked` or `secret` is `invalid` too — `wall.add`, `wall.update` and a preset expansion alike (6.1) — so no path reaches that state. Closing a locked door is allowed (it is already closed; the setting only refuses opening). Otherwise a locked door is an ordinary closed door: same sight, same explored cells, same tiles, same door push, same refusals.
- **v1 presets [FIXED (owner-delegated), #42; `window` added 2026-11-16, #47].** A preset is a named switch set used by the editor's one-drag default (7.4) and as the GM's label; never storage.
- **v1 presets: four [FIXED (owner decision), 2026-11-16, #48; supersedes #42/#47's longer list].** A preset is a named switch set used by the editor's one-drag default (7.4) and as the GM's label; never storage. The editor shows four buttons; `secret` and `locked` are checkboxes on any door, not presets.
| preset | `blocks_sight` | `blocks_movement` | door settings |
|---|---|---|---|
| wall (default) | yes | yes | none |
| door | yes | yes | `door`, closed |
| secret door | yes | yes | `door`, closed, `secret` |
| locked door | yes | yes | `door`, closed, `locked` |
| terrain | no | yes | none (railing, bushes, a low barrier, a fixed window: one preset) |
| one-way wall | yes, one side (`sight_dir:"left"` default) | yes | none |
| window | no | yes | `door`, closed (an opening window) |
| preset | `blocks_sight` | `blocks_movement` | door settings | `player_marker` |
|---|---|---|---|---|
| wall (default) | yes | yes | none | no |
| door | yes | yes | `door`, closed | no |
| window | no | yes | `door`, closed | **yes** |
| one-way | yes, one side (`sight_dir:"left"` default) | yes | none | no |
`window` is the **opening** form: see-through while closed, passable once opened, because opening a door clears both blocks (above). The **fixed** window is the `terrain` switch set exactly and derives `terrain` (below). There is no distance-limited window: Foundry's distance rule is not expressible with switches, is not in v1 (1), and belongs to the lighting-era effort. No "blocks nothing" preset either: a segment that blocks nothing is a marker, not a barrier, and the editor deletes instead.
`window` is the **opening** form: see-through while closed, passable once opened, because opening a door clears both blocks (above). The **fixed** window is the same see-through switch set with `door` off (the preset, then uncheck `door`): it derives `window` too, keeps `player_marker` on, and needs no second preset. `secret`/`locked` on a door are checkboxes: a secret door is `door` + `secret` (opaque, closed, two-way), a locked door is `door` + `locked`, a locked opening window is `window` + `locked`. There is no distance-limited window: Foundry's distance rule is not expressible with switches, is not in v1 (1), and belongs to the lighting-era effort. No "blocks nothing" preset either: a segment that blocks nothing is not a barrier, and the editor deletes instead; the marker switch belongs to a real wall, it is not a wall of its own.
- **Window [FIXED (owner decision), 2026-11-16, #47].** A window is **see-through along its whole drawn length**: it is not a hole with a sill and a top, and no sill/top height is stored or used (a window's wall `height` is irrelevant, because its sight switch is off and 5.9/5.10 never read it). It is drawn as **its own wall piece inside a wall**, like a door — `wall | window | wall`, three segments — so it needs no new geometry, thickness rule or position rule. Two forms, both already expressible by the switches: **fixed** (`blocks_sight:false`, `blocks_movement:true`, no door: see through, never pass) and **opening** (the same plus `door:true`: see through while closed, pass when opened). A window piece of a thick wall is a thick window: its body occludes sight from both sides (5.10), so it is a see-through slot in a deep wall, not a widened hole.
- **Derived kind for the two window forms [FIXED (owner-delegated), 2026-11-16, #47].** The `window` preset is the opening form and derives `kind:"window"`. The fixed form's switches are exactly `terrain`'s, so it derives `kind:"terrain"`, and there is no second preset and no new kind. That collision is intended: the rules are identical (see through, do not pass) and `terrain` is the broader name (railing, pit edge, fixed window). The editor may annotate a `terrain` piece that sits between two `wall` pieces as a fixed window (M4 UI), but nothing on the wire distinguishes it.
- **Derived kind: a shape label, never a preset match [FIXED (owner-delegated), 2026-11-16, #48; supersedes #47's two-form kind rule].** With `secret`/`locked` as flags and two window forms, exact preset matching can no longer work. `kind` is derived by shape, in this order: `window` (`blocks_sight:false`, `blocks_movement:true`; door either way), else `one_way` (`blocks_sight:true`, `sight_dir != "both"`), else `door` (`blocks_sight:true`, `blocks_movement:true`, `door:true`), else `wall` (`blocks_sight:true`, `blocks_movement:true`, `door:false`, `sight_dir:"both"`), else `custom`. So the kind list is exactly `wall`, `door`, `window`, `one_way`, `custom`: `secret` and `locked` are flags that never change the label, and a one-way door is labelled `one_way`. The label is GM-facing only (a player sees no wall frame; the marker carries no type).
- **What a one-way wall does to the floor [FIXED (owner decision), 2026-11-16, #47].** Explored cells and tiles differ per side **by construction, not by a new mechanism**: each viewer's sight wall list drops the one-way walls whose blind side that viewer stands on, so polygon, `cellsTouched`, explored and therefore tiles differ between the two sides with no extra state. Explored only grows (5.4), so flipping the direction or `a`/`b` never un-explores a cell and never revokes a tile; a flip only widens what the newly-seeing side may explore next. Movement is two-way (above). With a low wall the direction filters first, then 5.9/5.10 evaluate every crossed face of the walls that remain.
- **Per-viewer filter [FIXED (owner-delegated), 2026-11-16, #47].** Nothing per-viewer is stored or copied: the 5.10 quad faces stay hoisted and viewer-independent, and the fan skips a sight-blocking wall inline when it is one-way and the viewer is on its blind side — one sign test per **one-way** wall per viewer (cross product with `(-dy, dx)`), after the radius-bbox cull; two-way walls pay only a type check. Rejected: a per-viewer copy of the wall list (the prototype measured ~0.15 ms per viewer per frame for the copy, times tokens) and two prebuilt left/right lists (choosing between them needs the same per-viewer side test, and they duplicate the list).
- **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.
- **Derived label, not a stored kind [FIXED (owner-delegated), #42; derivation rule #48].** The record stores the switches. `kind` survives on the wire as a read-only shape label derived from them (rule 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 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 blind side, 5.8), 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.
- **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 blind side, 5.8), 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 a window 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 fixed or closed window 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 5.10 (#45); the wire and the migration are #49. Answers #41's open question: the *target's* height matters.
@@ -425,7 +433,7 @@ What a wall shorter than a figure does to sight and movement. Heights and units
- 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.*
- In the GM view a player's fraction for a token = the **maximum** over that player's tokens that see it. *Why: the player does see it from that one.*
- 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.
- Deferred: nothing about see-over itself. A window is unaffected (its `blocks_sight` is off, so 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.
@@ -434,7 +442,7 @@ What a wall's thickness does to the floor it covers, the vision fan and the coll
- **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; both sides for a one-way wall, #47].** 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. This holds on both sides of a one-way wall (5.8). 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.
- **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 window'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. A one-way wall's own body is opaque floor on **both** sides (5.8, #47): the blind side gets no face at all, and the seeing side sees up to the near face — never into or past the body's floor.
- **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.
@@ -495,22 +503,24 @@ Every row also carries `reqId` (omitted below). Codes are those of 6.5; `not-all
| t | fields | who | ack ok / extra codes | effects and recipients |
|---|---|---|---|---|
| `scene.set` | `scene`; any of `name, grid_size, vision_radius_default, token_radius_default, extra` (at least one) | G | `{}`; `invalid`, `not-found` | `hello` plus full resync to **every** connection (hello-equivalent reset; no `scene.activate`, Q3). `token_radius_default` change resizes tokens using the default with grow push (5.6): `token` updates per view, `vision`/`explored` as needed. `w, h, tile_size, cell, art_version` are not settable on the wire (import is M6 CLI) |
| `wall.add` | `scene, a:[x,y], b:[x,y]`, then either a preset name (`preset:"wall"|"door"|"secret_door"|"locked_door"|"terrain"|"one_way"|"window"`) or the raw 5.8 switches (`blocks_sight?, blocks_movement?, sight_dir?, door?, open?, secret?, locked?`), `flags?` | G | `{id}`; `invalid`, `not-found` | `wall` to GM; vision recompute for all players (`vision`, `explored`, `token` as their views change); tokens whose circle overlaps get `stuck` source `walls` (5.5): `token` per view |
| `wall.update` | `scene, id`; any of `a, b`, a preset name or the raw switches, `flags` | G | `{}`; `not-found`, `invalid` | as `wall.add` (update = remove + add for the status rules, 5.5; PROPOSED there) |
| `wall.add` | `scene, a:[x,y], b:[x,y]`, then either a preset name (`preset:"wall"|"door"|"window"|"one_way"`) or the raw 5.8 switches (`blocks_sight?, blocks_movement?, sight_dir?, player_marker?, door?, open?, secret?, locked?`), `label?`, `flags?` | G | `{id}`; `invalid`, `not-found` | `wall` to GM; vision recompute for all players (`vision`, `explored`, `token` as their views change); tokens whose circle overlaps get `stuck` source `walls` (5.5): `token` per view; a newly seen marker (5.8) to the players who see it |
| `wall.update` | `scene, id`; any of `a, b`, a preset name or the raw switches, `label`, `flags` | G | `{}`; `not-found`, `invalid` | as `wall.add` (update = remove + add for the status rules, 5.5; PROPOSED there); a marker whose cause changed is retracted, a moved one is re-earned (5.8) |
| `wall.remove` | `scene, id` | G | `{}`; `not-found` | `wall_gone` to GM; recompute; `walls`-sourced entries re-evaluated (Keep/Clear, 5.5) |
| `door.set` | `scene, id, open:bool` | G | `{}`; `not-found`, `invalid` (wall is not a door, is a secret door, or is a locked door and `open:true`) | `wall` to GM (a door is a wall); recompute all players; close pushes overlapped tokens aside (server-originated position change: `token` per view; `squeezed` only if no side is valid), open re-evaluates `walls`-sourced entries (5.5). Players learn only through LOS changes. A player sender is `not-allowed` at the role step for every door (5.8, #46) |
Validation for `wall.*`: `a != b`, both in bounds; each switch a boolean and `sight_dir` one of `both|left|right`, with a non-`both` `sight_dir` requiring `blocks_sight:true` (#47); `open`/`secret`/`locked` only with `door`; a secret door closed and two-way; `open:true` with `secret` or `locked` is `invalid` (#46, 5.8); `preset` and any raw switch in the same payload is `invalid` (5.8).
Validation for `wall.*`: `a != b`, both in bounds; each switch a boolean and `sight_dir` one of `both|left|right`, with a non-`both` `sight_dir` requiring `blocks_sight:true` (#47); `open`/`secret`/`locked` only with `door`; a secret door closed, two-way and opaque (`blocks_sight` and `blocks_movement` both true); `open:true` with `secret` or `locked` is `invalid` (#46, 5.8); `label` an optional 6.5 text string of 1..64 code points; `preset` is `wall|door|window|one_way` and never with a raw switch in the same payload (5.8, #48).
**Wall payload rules [FIXED (owner-delegated, 2026-11-15, #19); amended by the 5.8 wall model, #42]** (6.1 was silent on these; slice 4 builds them):
- `scene` is an integer scene id. v1 has exactly one scene (Q3), seeded by migration step 3 with id `1` (4.4); any other value is `not-found`, a non-integer is `invalid`.
- `a`/`b` are `[x,y]` arrays of exactly two finite JSON numbers (integers accepted); `a == b` and any endpoint outside `0 <= x <= w, 0 <= y <= h` are `invalid`. The border itself is in bounds.
- A wall's behaviour is the 5.8 switches, defaulted as the `wall` preset (`blocks_sight:true`, `blocks_movement:true`, `sight_dir:"both"`, `door:false`, `open:false`, `secret:false`, `locked:false`). A payload gives either `preset` (the server expands it from the 5.8 table) or raw switches, never both; a switch that is not a boolean or a `sight_dir` outside the three values is `invalid`.
- `open`, `secret` and `locked` without `door:true` are `invalid`; a secret door with `open:true` or with `sight_dir != "both"` is `invalid` (5.8: it must look exactly like a solid wall), and so is a locked door with `open:true` (#46, 5.8: unlock first). A `sight_dir` other than `"both"` with `blocks_sight:false` is `invalid` (a direction with nothing to block, #47). A stored non-door always has `open=false`, `secret=false`, `locked=false`, so clearing `door` through `wall.update` closes and de-secrets it.
- A wall's behaviour is the 5.8 switches, defaulted as the `wall` preset (`blocks_sight:true`, `blocks_movement:true`, `sight_dir:"both"`, `player_marker:false`, `door:false`, `open:false`, `secret:false`, `locked:false`). A payload gives either `preset` (the server expands it from the 5.8 table; `window` also sets `player_marker:true`) or raw switches, never both; a switch that is not a boolean or a `sight_dir` outside the three values is `invalid`. A raw switch payload defaults `player_marker` to `false`: the marker is on by default only through the `window` preset (5.8, #48).
- `open`, `secret` and `locked` without `door:true` are `invalid`; a secret door with `open:true`, with `sight_dir != "both"`, or with either block switch off is `invalid` (5.8: it must look exactly like a solid wall), and so is a locked door with `open:true` (#46, 5.8: unlock first). A `sight_dir` other than `"both"` with `blocks_sight:false` is `invalid` (a direction with nothing to block, #47). A stored non-door always has `open=false`, `secret=false`, `locked=false`, so clearing `door` through `wall.update` closes and de-secrets it.
- `label` is optional: absent or `null` clears it; otherwise a string of 1..64 code points, trimmed, no control characters (the 6.5 text rule). It is GM-only, has no behaviour and never appears in a player frame (5.8, #48).
- `player_marker` is a boolean switch (default `false`; the `window` preset sets `true`). It only decides whether a player gets a marker once they have seen part of the wall (5.8); it changes no sight, movement or status rule.
- `flags` is a JSON object or absent (absent = `{}`); anything else is `invalid`. It is stored verbatim and never interpreted — the switches are fields, not flags (5.8).
- `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.
- `wall.update` patches `a`, `b`, the switches (or one `preset`), `label` 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 window turns it into a closed opaque door, and `preset:"window"` sets `player_marker:true` as part of the expansion. `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`, `window`, 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.
- `kind` is **output only** on the `wall`/`walls` frames: the shape label derived from the switches (`wall`, `door`, `window`, `one_way`, else `custom`; `secret`/`locked` never change it, 5.8 #48). 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.
@@ -606,8 +616,8 @@ All are built per recipient at egress (single egress rule, 2). "Sent" always mea
| `ack` | see Conventions | sender connection only |
| `error` | `code` (`malformed` or `rate-limited`; 6.5) | sender connection only; only for frames that cannot be acked |
| `roster` | `players:[{id, name, role, colour, connected}]`, always the full list | everyone (Q9). Players receive named players only (an unused key is not visible); GM receives all, `name:null` for unnamed |
| `walls` | `scene, walls:[{id, a, b, kind, blocks_sight, blocks_movement, sight_dir, door, open, secret, locked, flags}]`; `kind` is the derived 5.8 label | GM, on connect and resync (6.3) |
| `wall` | `scene, id, a, b, kind, blocks_sight, blocks_movement, sight_dir, door, open, secret, locked, flags` (upsert; doors included; this replaces the old `door` message) | GM only |
| `walls` | `scene, walls:[{id, a, b, kind, blocks_sight, blocks_movement, sight_dir, player_marker, door, open, secret, locked, label, flags, thickness, position}]`; `kind` is the derived 5.8 label | GM, on connect and resync (6.3) |
| `wall` | `scene, id, a, b, kind, blocks_sight, blocks_movement, sight_dir, player_marker, door, open, secret, locked, label, flags, thickness, position` (upsert; doors included; this replaces the old `door` message) | GM only |
| `wall_gone` | `scene, id` | GM only |
| `vision` | `polys:[{id:<token id>, pts:[[x,y],...]}]` integer px, the full set for this player's controlled tokens with `vision` | player only; never GM |
| `explored` | `full:true, rle:[[cy, x0, len, x0, len, ...], ...]` on connect and resync; `full:false, cells:[[cx,cy],...]` afterwards (fresh cells) [format PROPOSED, 6.4] | player only; never GM |
@@ -618,7 +628,7 @@ All are built per recipient at egress (single egress rule, 2). "Sent" always mea
| `encountered` | `full:bool, set:[{id:<token id>, name, grey:bool}], del:[id]`; `full:true` replaces the whole list (on connect, resync); (GM) adds `player:<id>` | player: own list only; GM: one message per player and list. `name` = the name that recipient's player knows (8); `grey` = no longer in that player's view ("met before, whereabouts unknown"); no position, no `character_id` for players |
| `closing` | `reason` (one of the static strings of 6.5: `revoked`, `evicted`, `proto-mismatch`, `malformed-flood`) and `code` (the 6.5 close code: 4001, 4002, 4003, 1008) | sender connection only; the last frame a server-initiated close sends, immediately before the close frame (FIXED #18, 6.5). No other frame follows it |
Count: 15 server messages. Reserved, not built: `event` (9).
Count: 15 server messages. Reserved, not built: `event` (9). **Not rowed here:** the player marker of 5.8 (#48) travels in a dotless server message named `marker`; its fields, full/diff form and removal spelling are #49's, and it is the only player-bound wall frame (3.1).
Leak notes (R5 review, #11): (1) `kind` is GM-only because a value like `npc` would tell a player what a visible token is; the client names tokens from `name` and `props`. (2) `character_id` goes only to the character's owner and the GM; showing it to others would link two tokens of one character and mark a token as "a character, not a monster". (3) `cprops` is public bucket only and always present (even empty) for non-owners so presence does not mark a token as character-linked. (4) The roster omits unnamed players for players so an unused key (or the number of keys) is not visible. (5) `hello` carries `vision_radius_default` so the client can respect the step cap (5.5); it states a distance only, no wall fact. (6) `statuses[].source` goes to the GM only (amends #4, 2026-11-14): viewers see the status, not its cause, so a player does not learn that a wall or GM action caused it. Open: a `walls`-sourced status still tells a viewer that some blocking wall touches the token; #4 argued LOS covers that, owner to confirm. (7) `encountered.grey` flipping and `token`/`token_gone` carry the same fact (the token left view), so deletion and moving away look identical to the player.
@@ -736,7 +746,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, 5.10, #47]: 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`, `window`) sets the switches for a one-drag default, so a window is authoring `wall | window | wall`; 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). A **one-way wall is drawn as an arrow at the wall's middle** pointing the way the view goes — from the seeing side toward the watched side — with a **direction flip** that swaps `sight_dir` `left`/`right` and never moves `a`/`b`, the same flip control as the position flip. Arrow and flip are GM-only like every wall fact and never on a player wire (3.1); the editor draws `kind` (the derived label) only, and 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).
- Wall editor (GM) [FIXED, Q6, extended by 5.8, 5.10, #47, #48]: click-click segments, snap to grid/endpoints optional, delete, undo of last edit [PROPOSED]; submits `wall.*` intents; server is the validator. A preset row of **four** buttons (`wall` (default), `door`, `window`, `one-way`) sets the switches for a one-drag default, so a window is authoring `wall | window | wall`; `secret` and `locked` are **checkboxes on any door**, so a secret door is the door preset with `secret` ticked (no separate preset), and an opening window can be locked. A **fixed window** is the window preset with `door` unticked. A **`player_marker` checkbox** ("players see a marker", on by default for a window, off otherwise) and a free-text **`label`** field (GM-only, at most 64 characters) sit beside the preset row; neither changes vision or movement. An **advanced** toggle exposes the raw switches (`blocks_sight`, `blocks_movement`, `sight_dir`, `player_marker`, `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). A **one-way wall is drawn as an arrow at the wall's middle** pointing the way the view goes — from the seeing side toward the watched side — with a **direction flip** that swaps `sight_dir` `left`/`right` and never moves `a`/`b`, the same flip control as the position flip. Arrow, flip, marker and label are GM-only like every wall fact and never on a player wire, except the marker itself (3.1, 5.8); the editor draws `kind` (the derived label) only, and 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.
@@ -755,7 +765,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`, `window`, 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. **Windows and one-way [FIXED, 2026-11-16, #47]**: a window is the `window` preset (an opening see-through door) or, fixed, the `terrain` switch set; a one-way wall is `sight_dir` with `blocks_sight` on, naming the blind side — neither adds a field. 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.
- **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')`, `player_marker` (bool, default false, 5.8 #48), the door settings `door, open, secret, locked`, the GM-only free-text `label` (optional, <= 64 code points, 5.8 #48) and the free `flags`. Behaviour comes from the switches (5.8); `kind` is only a derived output label (`wall`, `door`, `window`, `one_way`, else `custom`; `secret`/`locked` are flags, not kinds, #48) and is never stored. `blocks = blocks_movement and not (door and open)`; a window (`blocks_sight:false`) is absent from the sight input. GM-only everywhere except the player marker: a player receives only an anchor point and its own opaque marker id (3.1, 5.8), and the per-player marker set is state like the explored grid (persisted per player, retracted only by a GM change). **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. **Windows and one-way [FIXED, 2026-11-16, #47; #48]**: a window is the see-through switch set (`blocks_sight:false`, `blocks_movement:true`, `door` either: fixed or opening) and derives `window`; a one-way wall is `sight_dir` with `blocks_sight` on, naming the blind side. 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 `terrain` preset or kind (#48).
- **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].
@@ -816,9 +826,10 @@ Principles carried from the prototype: the checker must be independent of the co
- **Characters and names (#14)**: tests for reveal per player and reveal to all; owner sees own actual name; character owner change leaves token controllers unchanged; encountered entries survive token removal and scene change and are removed only by the GM; `gm_only` tokens never enter an encountered list. Fault classes: `ACTUAL_NAME` = unrevealed actual name sent to a player; `CHAR_LIST` = another player's character or encountered entry sent; `CONTROLLER_CHANGE` = owner change altering controllers; `CHAR_OWNER_PROP` = character owner-bucket prop sent to a non-owner. **Built in slice 8** as the `tools/characters.test.mjs` group, which also carries the two checks 10.3 was missing: "a status source is not shown to a non-GM" (the controller included) and "an encountered entry survives a `gm_only` flip and a token removal" (greyed, never deleted).
- **Tiles (#24)**: `tools/tiles.test.mjs` is the group's leak check (d) and the smoke tile-steal checks, through the real binary and a test nginx (`tools/nginx.mjs`, nginx from devbox; config generated per run in the state dir). An **independent explored oracle** (born in 10.2) recomputes visibility per cell from the GM's walls and the token's vision radius with its own clear-segment maths (inscribed 64-gon radius - 0.5 px for "sure", radius + 0.5 px and proper crossings for "maybe"): a `200` must be oracle-maybe (no invented disclosure) and oracle-sure must be `200` (no withheld tile). The 32x32-tile sweep is 1024 requests; slice 9's scene allows 283, all 283 oracle-sure, 0 maybe-refused. Also checked: a player with no sight state gets `403`; another player gets `403` on a tile its neighbour sees; direct `/_tiles/` is `404` (the file exists) for every identity; malformed/canonical/out-of-range/stale-version/scene paths are `404` (with and without a session, including the GM); traversal and encoded shapes never reach a file; the direct-from-Nim answer carries `X-Accel-Redirect: /_tiles/1/v1/<x>_<y>.png`, `Cache-Control: private` and an empty body. Fixture tiles are 32 px PNGs written by `tools/tilefixture.mjs` under the state dir at test time; the test asserts the repo tracks no `.png` at all.
- **Probing test (T8)**: M2, in-process against the move-rules module (5.5): arbitrary far moves; assertion: facts about walls/doors beyond LOS recoverable from replies <= a bounded amount (step cap), and uniform nack shape. M3: same test over WS with a hostile client (moved from M2).
- **Door equivalence (#46, T17)**: `tools/doors.test.mjs` is the accept group for the "a player cannot tell a secret or locked door from a wall" obligation 5.8 states. Node harness, built-ins only (10.4), shaped like `tools/probing.test.mjs`: two servers, fresh state, two scenes identical except one segment, one identical scripted sequence. Pairs: (i) solid `wall` (preset) vs `secret door`; (ii) solid wall vs `secret door` with `locked`; (iii) closed `door` vs closed `locked door`. Script, run against both servers in lockstep: player tokens with vision near and around the segment; player moves along, into and across it (accepted, collision nacks, over-cap nacks); the GM adds the segment over a player token (`stuck`); the GM edits and toggles unrelated walls and doors elsewhere and moves tokens; a resync/reconnect; a GM `door.set open` on the secret/locked segment, refused `invalid` and GM-side only. **Assertion:** each player's complete received frame sequence — `hello`, `vision`, `explored` (full and delta), `token` (statuses included), `encountered`, and every `ack`/nack with its `code` and `pos` — is identical between the two runs after JSON canonicalisation (keys sorted, no numeric reformatting). **Normalisation allowed: none**; `n` is per connection and wall ids never reach a player, so nothing run-local leaks into the comparison. If the build ever forces a run-local difference it must be named in the test header with the reason. **Tiles:** the same per-player tile sweep in both runs, through the test nginx (`tools/nginx.mjs`, 11.1), must give the same status per tile. **Positive control:** the same script against a third scene whose segment is an open door (or absent) must produce *different* transcripts, otherwise the harness cannot fail (10, first paragraph). **Negative control:** a `-d:leakfault` build with `LEAK_FAULT=secretgap` makes a secret door not block sight (or movement) in the player-facing computation; the doors group must fail with that build, pass on a clean one, and the shipped binary must carry no fault hook (10.1, `tools/fault.test.mjs`). **Refusal codes:** `door.set` on a secret or locked door is `invalid` for the GM; a player `door.set` is `not-allowed` for every door (6.5), so the player side has one code and no oracle. **Not covered:** timing and size side channels (T11), accepted and unchanged.
- **Door equivalence (#46, T17)**: `tools/doors.test.mjs` is the accept group for the "a player cannot tell a secret or locked door from a wall" obligation 5.8 states. Node harness, built-ins only (10.4), shaped like `tools/probing.test.mjs`: two servers, fresh state, two scenes identical except one segment, one identical scripted sequence. Pairs: (i) solid `wall` vs a closed `door` with `secret`; (ii) solid wall vs a closed door with `secret` and `locked`; (iii) closed `door` vs a closed `door` with `locked` (since #48 there are no `secret_door`/`locked_door` presets: the switches are the same, only the name changed). Script, run against both servers in lockstep: player tokens with vision near and around the segment; player moves along, into and across it (accepted, collision nacks, over-cap nacks); the GM adds the segment over a player token (`stuck`); the GM edits and toggles unrelated walls and doors elsewhere and moves tokens; a resync/reconnect; a GM `door.set open` on the secret/locked segment, refused `invalid` and GM-side only. **Assertion:** each player's complete received frame sequence — `hello`, `vision`, `explored` (full and delta), `token` (statuses included), `encountered`, and every `ack`/nack with its `code` and `pos` — is identical between the two runs after JSON canonicalisation (keys sorted, no numeric reformatting). **Normalisation allowed: none**; `n` is per connection and wall ids never reach a player, so nothing run-local leaks into the comparison. If the build ever forces a run-local difference it must be named in the test header with the reason. **Tiles:** the same per-player tile sweep in both runs, through the test nginx (`tools/nginx.mjs`, 11.1), must give the same status per tile. **Positive control:** the same script against a third scene whose segment is an open door (or absent) must produce *different* transcripts, otherwise the harness cannot fail (10, first paragraph). **Negative control:** a `-d:leakfault` build with `LEAK_FAULT=secretgap` makes a secret door not block sight (or movement) in the player-facing computation; the doors group must fail with that build, pass on a clean one, and the shipped binary must carry no fault hook (10.1, `tools/fault.test.mjs`). **Refusal codes:** `door.set` on a secret or locked door is `invalid` for the GM; a player `door.set` is `not-allowed` for every door (6.5), so the player side has one code and no oracle. **Not covered:** timing and size side channels (T11), accepted and unchanged.
- **Door settings in the leak checker (#46)**: `tools/leakcheck.nim`'s `BannedAlways` deep-key scan grows the wall setting keys — `secret`, `locked`, `door`, `blocks_sight`, `blocks_movement`, `sight_dir`, plus whatever names #49 fixes — so a door setting that reaches a player frame is `WALLDATA` (T2/T17). The existing `walls` fault already injects the frame class; a new fault variant leaks one door setting key inside a player frame and asserts exactly `WALLDATA`, nothing more. Because the scan is deep, the leak and doors fixtures must not name a player-visible prop like a wall setting (that would be a false positive).
- **One-way direction (#47)**: `tools/leakcheck.nim` and the independent explored/tile oracle apply **their own** side test — sign of the cross product of `viewer - a` with the `(-dy, dx)` normal of `a -> b`, positive = left — never by calling `vision.nim`: a sight-blocking one-way wall is dropped from the oracle's wall list for a viewer on its blind side, and a wall that is `blocks_sight:false` is dropped for everyone. Assertions: a token on the blind side gets no polygon point, explored cell or tile beyond the wall, and a token across it gives no `token` frame, no name and no encountered entry; a viewer on the seeing side does see across (the positive control, so the oracle can fail). Tolerances as elsewhere: the 0.5 px boundary band along the blind side is oracle-*maybe* (a `200` there is legitimate, but never *sure*), and anything clearly behind the blind wall is oracle-refused (a withheld proof cell still fails). New fault class `ONEWAY` — the player-facing computation drops `sight_dir` and lets the blind side see across — with its injected fault and exact-class assertion, shaped like the existing classes.
- **Player marker (#48)**: the first wall-derived player data, so it gets its own oracle. `tools/leakcheck.nim` computes by its own code (never calling `vision.nim`) that a marker frame exists for a player exactly when some point of the wall's visible extent (segment, or body boundary for a thick wall) has entered that player's vision polygon, and that the frame carries **only** the player's opaque marker id and the anchor point: any `kind`, `open`/`closed`, `sight_dir`, `label`, `thickness`, `height`, wall id or switch in a player frame is `WALLDATA`/`MARKER_EXTRA`. Positive control: a window placed in the open yields exactly one marker once its anchor is seen (so the oracle can fail); a marker-bearing wall behind a sight-blocking wall, or a `player_marker:false` wall, yields none. The `BannedAlways` deep-key scan grows `label` and `player_marker` alongside the door keys, with the same caveat that fixtures must not name a player-visible prop with those keys. Three fault classes, each with an injected fault and an exact-class set, shaped like the existing ones: **`MARKER_EARLY`** — a marker sent before any part of the wall entered the polygon; **`MARKER_EXTRA`** — a marker frame carrying one extra field (a `kind`, a `label` or the wall id); **`MARKER_OFF`** — a marker sent for a wall whose `player_marker` is off. Retraction is checked on the GM side: removing the wall, clearing the marker switch or moving the geometry retracts the marker and never sends the new position early; a marker change writes no explored cell and revokes no tile.
- **Auth tests**: key replace (old key invalid, sessions revoked, live connections closed), remove player (key invalid, characters and tokens pass to GM), one key reused on several devices (Q10 FIXED), Origin mismatch rejected, cookie flags present.
- **Protocol tests** (#18, `tools/protocol.test.mjs`): proto missing/non-integer (HTTP 400) and mismatch (`closing` 4003, no `hello`); unknown intent type (`unknown-type`) with unknown fields ignored; exactly one `ack` per `reqId` (reqId 0 and 2^31-1 included); `hello` first with `n = 1` and a per-connection `n` thereafter; `error malformed` for unreadable frames; the malformed flood (nine tolerated, the tenth closes 1008); the intent bucket (burst then `rate-limited`, connection stays open, a refused intent applies nothing, `error rate-limited` for an unreadable frame on an empty bucket); the 64 KB inbound boundary (exactly 64 KB is a message, 64 KB + 1 drops the TCP connection with no close frame); unmasked and bad-opcode frames; the server Ping and the Pong answer to a client Ping; the connection cap (503 + `Retry-After: 5`); and every server-initiated close as `closing` then 1005.
- **Persistence**: migration tests (old DB -> new), chunked explored round trip, restart test extended to wall CRUD and entity props. **Slice 6 built** the explored half: `tests/texplored.nim` (chunk layout pinned, whole-chunk encoding, upsert replacement, per-player keying, restore, write cost) and `tools/persistence.test.mjs` (round trip through a fresh resync, per-player isolation, SIGTERM and SIGKILL restart equality, a wall removal's revealed cells after the wall returns, chunk rows decoded independently, move-ack timing, and a fixture schema-4 DB migrated by the real binary).
@@ -964,7 +975,7 @@ Each is small, ends with a green gate, and no milestone depends on browser UI be
3. Q3 - Multiple scenes in v1 (GM switches the active scene, per-scene explored grids), or exactly one scene per table to start? **RESOLVED [FIXED (owner decision), 2026-11-08]:** exactly one scene in v1; schema may stay `scene_id`-keyed.
4. Q4 - Tile-edge leak: accept as documented, or reduce it (smaller tiles = more requests; gate tiles only when explored cells cover a minimum fraction; or server-side masked tiles at the cost of image processing in Nim)? What detail do you paint in map art that must stay secret? **RESOLVED [FIXED (owner decision), 2026-11-08]:** `tile_size` = explored cell size = 32 px. Residual leak is at most one cell, never revoked; no server-side masking. Authoring rule shrinks from ~256 px to ~32 px. M4 acceptance: (a) headless mobile-emulation test on the real server path, (b) one manual phone run; fallback 64 px (per-scene config). Evidence: `prototype-tile-leak/README.md`. Applied in 3.3, 3.4 (T5), 8, 12 (H8), 13 (M4, M6).
5. Q5 - Map import: CLI-only for v1, or upload + tiling from the browser (GM) from the start? **RESOLVED [FIXED (owner decision), 2026-11-08]:** map import is CLI-only in v1; browser upload is post-v1.
6. Q6 - Wall/door authoring: is an in-browser GM wall editor required in v1 (no generator feeds in), or is hand-edited/imported wall data acceptable at first? What other wall kinds are needed soon (windows, one-way, secret doors, locked doors)? **RESOLVED [FIXED (owner decision), 2026-11-08]:** in-browser GM wall editor in v1; wall kinds `wall` and `door` only. **Kind set SUPERSEDED [FIXED (owner decision), 2026-11-15, #42]** by 5.8: a wall's behaviour is independent switches and named kinds are presets; v1 presets are `wall`, `door`, `secret door`, `locked door`, `terrain` and `one-way wall`, and `window` was added by #47 (2026-11-16) as a see-through opening, its fixed form being `terrain`. The editor requirement is unchanged.
6. Q6 - Wall/door authoring: is an in-browser GM wall editor required in v1 (no generator feeds in), or is hand-edited/imported wall data acceptable at first? What other wall kinds are needed soon (windows, one-way, secret doors, locked doors)? **RESOLVED [FIXED (owner decision), 2026-11-08]:** in-browser GM wall editor in v1; wall kinds `wall` and `door` only. **Kind set SUPERSEDED [FIXED (owner decision), 2026-11-15, #42]** by 5.8: a wall's behaviour is independent switches and named kinds are presets; v1 presets are `wall`, `door`, `secret door`, `locked door`, `terrain` and `one-way wall`, and `window` was added by #47 (2026-11-16) as a see-through opening, its fixed form being `terrain`. **Preset list SUPERSEDED AGAIN [FIXED (owner decision), 2026-11-16, #48]:** there are four presets (`wall`, `door`, `window`, `one-way`), `secret` and `locked` are checkboxes on any door rather than presets, and `terrain` is dropped entirely (the name, the preset and the kind); the derived kinds are `wall`, `door`, `window`, `one_way`, `custom`. The editor requirement is unchanged.
7. Q7 - Vision model: single radius per token or per-token property from day one? Is any "darkvision/light" concept needed before FFF? **RESOLVED [FIXED (owner decision), 2026-11-08]:** per-entity numeric `vision_radius` plus scene default; no light sources or darkvision.
8. Q8 - Which "table convenience" features come first after v1, if any: freehand drawing (exists in the perf prototype), pings, ruler, chat, dice, token images/portraits, initiative tracker? **DEFERRED [FIXED (owner decision), 2026-11-08]:** decided at M7.
9. Q9 - Should players see each other's names/presence, and should party members share vision (shared explored/LOS) or is it strictly per player? **RESOLVED [FIXED (owner decision), 2026-11-08]:** vision and explored strictly per player; player names visible to all.
@@ -1050,4 +1061,6 @@ Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #46]: secret
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.
Owner also decided 2026-11-16 [FIXED (owner decision), 2026-11-16, #47]: windows and one-way walls. (1) **Window** [FIXED (owner decision)]: v1 has no sill and no top — a window is see-through along its whole drawn length, height unused, drawn as its own wall piece inside a wall (`wall | window | wall`, like a door), with two forms: fixed (no pass) and opening (door settings; pass when open). The editor gets a `window` preset. No distance-limited window. (2) **One-way** [FIXED (owner decision)]: a thick one-way wall's body is opaque floor from **both** sides — no player polygon, never explored, no tile — and only pass-through past the wall is directional; explored cells and tiles differ per side with no new mechanism (per-viewer sight), and explored only grows, so a flip never takes anything back. (3) **Editor** [FIXED (owner decision)]: a one-way wall shows an arrow at its middle pointing the way the view goes (from the seeing side toward the watched side) plus a flip that swaps `sight_dir` without moving `a`/`b`; GM-only, never on a player wire. (4) **`left` wording** [FIXED (owner-delegated)]: `sight_dir:"left"` means a viewer on the left side — the `(-dy, dx)` normal of `a -> b`, the same side as `position` — cannot see across; a viewer on the right sees across. The one-way preset defaults to `left`; `sight_dir != "both"` with `blocks_sight:false` is `invalid`; `left` and `right` both derive `one_way`. (5) **Filter shape** [FIXED (owner-delegated)]: hoisted viewer-independent faces plus one sign test per one-way wall per viewer inline in the fan, no per-viewer list copy (the prototype's ~0.15 ms per viewer per frame, times tokens, rejected). (6) **Windows as a kind** [FIXED (owner-delegated)]: the `window` preset is the opening form and derives `window`; the fixed form's switches are `terrain`'s and derive `terrain` (the rules are identical), with no second preset and no new kind — the editor may hint at it. Downstream: the wire/schema/migration and the preset list are #49; terrain stays #48. Out of scope for v1: windows with a real sill and top height, and light through windows (future effort with lighting). See 1, 5.1, 5.8, 5.9, 5.10, 6.1, 7.4, 8, 10.3, 14.
Owner also decided 2026-11-16 [FIXED (owner decision), 2026-11-16, #47]: windows and one-way walls. (1) **Window** [FIXED (owner decision)]: v1 has no sill and no top — a window is see-through along its whole drawn length, height unused, drawn as its own wall piece inside a wall (`wall | window | wall`, like a door), with two forms: fixed (no pass) and opening (door settings; pass when open). The editor gets a `window` preset. No distance-limited window. (2) **One-way** [FIXED (owner decision)]: a thick one-way wall's body is opaque floor from **both** sides — no player polygon, never explored, no tile — and only pass-through past the wall is directional; explored cells and tiles differ per side with no new mechanism (per-viewer sight), and explored only grows, so a flip never takes anything back. (3) **Editor** [FIXED (owner decision)]: a one-way wall shows an arrow at its middle pointing the way the view goes (from the seeing side toward the watched side) plus a flip that swaps `sight_dir` without moving `a`/`b`; GM-only, never on a player wire. (4) **`left` wording** [FIXED (owner-delegated)]: `sight_dir:"left"` means a viewer on the left side — the `(-dy, dx)` normal of `a -> b`, the same side as `position` — cannot see across; a viewer on the right sees across. The one-way preset defaults to `left`; `sight_dir != "both"` with `blocks_sight:false` is `invalid`; `left` and `right` both derive `one_way`. (5) **Filter shape** [FIXED (owner-delegated)]: hoisted viewer-independent faces plus one sign test per one-way wall per viewer inline in the fan, no per-viewer list copy (the prototype's ~0.15 ms per viewer per frame, times tokens, rejected). (6) **Windows as a kind** [FIXED (owner-delegated)]: the `window` preset is the opening form and derives `window`; the fixed form's switches are `terrain`'s and derive `terrain` (the rules are identical), with no second preset and no new kind — the editor may hint at it. Downstream: the wire/schema/migration and the preset list are #49; terrain stays #48. Out of scope for v1: windows with a real sill and top height, and light through windows (future effort with lighting). See 1, 5.1, 5.8, 5.9, 5.10, 6.1, 7.4, 8, 10.3, 14. **[Superseded 2026-11-16, #48: `terrain` is dropped, the fixed form is a window, and the presets are four.]**
Owner also decided 2026-11-16 [FIXED (owner decision), 2026-11-16, #48]: terrain walls, and the principle behind the answer. (1) **`terrain` is dropped, everywhere** [FIXED (owner decision)]: no preset, no derived kind and no stored name. The switch set `blocks_sight:false`, `blocks_movement:true`, no door, is a **fixed window** and derives `kind:"window"`. A railing, a bush, a pit edge and a fixed window are one object with one switch set; they differ only in the GM's `label`. This supersedes #42's and #47's `terrain` preset/kind (and #47's fixed-form wording) and is itself an application of the new principle. (2) **Principle** [FIXED (owner decision)]: "Do the most with the fewest things: one object, switches on top, names are only labels" — recorded in §1 and to be applied to future cards. (3) **Four editor presets** [FIXED (owner decision)]: `wall` (default), `door`, `window`, `one_way`; `secret` and `locked` are checkboxes on any door, including an opening window (`door` + `blocks_sight:false`), and keep #46's semantics (GM-only, a locked door refuses to open until the GM unlocks, never observable to a player). (4) **Preset names and kinds resolved** [FIXED (owner-delegated)]: `secret_door` and `locked_door` are **removed** as wire preset names (the wire takes `wall|door|window|one_way`; #49 implements), and the derived kind list is `wall`, `door`, `window`, `one_way`, else `custom`, derived by shape (window first, then one-way, then door, then wall) with `secret`/`locked` as flags that never change the label. A secret door also requires both block switches on and `sight_dir:"both"` (a secret window would show itself); a locked window is allowed. (5) **Player marker** [FIXED (owner decision); name and shape delegated]: a new wall switch `player_marker`, on by default for the `window` preset and off for every other preset (GM may toggle it on any wall); an invisible barrier is simply a window with the marker off. It is the **first and only wall-derived data on a player wire**, an exact exception to 3.1: once any point of the wall's visible extent has entered that player's vision polygon, the player receives an anchor (the wall's drawn midpoint; a thick wall's midpoint is inside its own opaque body, so the gate is the visible extent, not the midpoint in the polygon) and its own opaque marker id, and **nothing else** — no type, kind, open/closed, direction, label, thickness, height or wall id; the client draws the window icon. The marker is per-player memory like explored: persisted, survives disconnect, never lost to LOS or a door, and retracted only when the GM removes the wall, clears `player_marker`, makes it not a window, or moves its geometry; a moved wall re-earns its marker only when the new geometry is seen. (6) **Wall `label`** [FIXED (owner-delegated)]: every wall may carry an optional GM-only free-text `label`, at most 64 code points (the 6.5 text rule), no behaviour, never on a player wire and in `BannedAlways` (`WALLDATA`). (7) **No other hint** [FIXED (owner decision)]: players get no other sign of a barrier; a refused move stays the uniform nack. (8) **Out of scope** [FIXED (owner decision)]: per-wall material (stone, wood, glass) waits for the lighting effort, alongside sill/top and light through windows; difficult terrain, movement cost and pit/fall semantics are rules-engine work, not wall behaviour. Downstream: the preset set, `player_marker`, `label` and the player `marker` message are inputs to #49 (wire/schema/migration); locked/secret as door checkboxes and window doors are inputs to #50. See 1, 3.1, 3.4, 5.1, 5.8, 5.9, 5.10, 6.1, 7.4, 8, 10.3.