design: secret and locked doors (#46)
This commit is contained in:
+3
-3
@@ -51,7 +51,7 @@ A figure on the map. It may belong to a character; a plain token (monster, item)
|
||||
_Avoid_: entity, piece, counter
|
||||
|
||||
**Wall**:
|
||||
A barrier on the map with a length, a thickness and a height. It hides what its dimensions hide. What it *does* is a set of **switches** it carries: blocks sight, blocks movement, and (for sight) a direction; a door is a wall with the door setting plus open/secret/locked. A named wall kind is only a preset over those switches, never the wall's own identity. A wall is full height unless the GM gives it a height in metres, so by default nobody sees over it; an older wall without a height keeps hiding everything behind it. A low wall hides only what fails the see-over line (see Low wall, See-over). In v1 a wall has zero thickness; per-wall thickness is pending (map #38, #45).
|
||||
A barrier on the map with a length, a thickness and a height. It hides what its dimensions hide. What it *does* is a set of **switches** it carries: blocks sight, blocks movement, and (for sight) a direction; a door is a wall with the door setting plus open/secret/locked. A named wall kind is only a preset over those switches, never the wall's own identity. A wall is full height unless the GM gives it a height in metres, so by default nobody sees over it; an older wall without a height keeps hiding everything behind it. A low wall hides only what fails the see-over line (see Low wall, See-over). In v1 a wall has zero thickness; per-wall thickness is pending (map #38, #45). Only the GM opens or closes a door in v1.
|
||||
_Avoid_: blocker, collider, obstacle, sight blocker, wall type (use preset)
|
||||
|
||||
**Low wall**:
|
||||
@@ -79,11 +79,11 @@ A wall whose sight switch carries a direction: it blocks sight from one side and
|
||||
_Avoid_: one-sided wall, directed wall, mirror wall
|
||||
|
||||
**Secret door**:
|
||||
A door the players never learn exists. It is always closed and, to a player, behaves exactly like a solid wall: same sight, same explored cells, same refusals, nothing that marks it as a door. The GM reveals it by making it an ordinary door and opening it.
|
||||
A door the players never learn exists. It is always closed and, to a player, behaves exactly like a solid wall: same sight, same explored cells, same refusals, nothing that marks it as a door. The GM reveals it by making it an ordinary door and opening it. In v1 no player action finds or opens a door, so the reveal is always the GM's.
|
||||
_Avoid_: hidden door, concealed door, illusionary wall
|
||||
|
||||
**Locked door**:
|
||||
A closed door the server refuses to open until it is unlocked. The lock is the GM's business only: players get no signal of it, and a locked door behaves exactly as a closed door to sight and movement. In v1 only the GM opens doors, so the setting is authoring state waiting for player door interaction.
|
||||
A closed door the GM must unlock before it will open: opening a locked door is refused until the lock is cleared, while closing one is always allowed. The lock is the GM's business only: players get no signal of it, and a locked door behaves exactly as a closed door to sight and movement. In v1 only the GM opens or closes doors, so the setting is authoring state.
|
||||
_Avoid_: barred door
|
||||
|
||||
**Terrain**:
|
||||
|
||||
+18
-10
@@ -1,6 +1,6 @@
|
||||
# FFF_vtt design
|
||||
|
||||
Status: draft v0.23, 2026-11-15 (owner decisions recorded in section 14; v0.4 records Q4 (tile_size 32 px), the outbox lock invariant (4.2, 4.3), and the follow-ups in 3.4, 8, 11.1, 12, 13; v0.5 records the M2 move-rule decisions in 5.5 and updates 3.4, 4.2, 5.1, 5.4, 6.1, 7.4, 8, 10.3, 12, 13; v0.6 records #14 (characters and player data) in 3.1, 3.4, 4.1, 4.4, 6.1, 8, 9, 10.3, 13, 14; v0.7 records #6 (players and invites) in 3.1, 3.2, 3.4, 4.4, 6.1, 8, 12, 13, 14; v0.8 records #7 (map tiles) in 3.3, 3.4, 11.1, 13, 14; v0.9 records #9 (test tools) in 2, 10.4, 13, 14; v0.10 records #12 (what M3 done means) in 13, 14; v0.11 records #15 (M3 limits) in 4.3, 6.4, 10.1, 13, 14; v0.12 records #11 (M3 message list) in 3.1, 3.2, 3.4, 4.2, 4.3, 5.5, 5.6, 6, 7.5, 13, 14; v0.13 records the owner review of #11 flags in 1, 3.1, 5.5, 6.1, 8, 14; v0.14 records #17 (getting in: keys, sessions, the auth slice) in 3.2, 4.4, 6.5, 6.6, 8, 11.1, 13, 14; v0.15 records #18 (talking safely: the protocol shell and the `closing` close-reason message) in 3.2, 4.3, 6, 6.1, 6.2, 6.4, 6.5, 10.3, 13, 14; v0.16 records #19 (walls and doors: the scene/wall schema, the wall payload rules and the slice-4 rollout) in 4.4, 6.1, 8, 13, 14; v0.17 records #20 (tokens and sight: the `entity` step, the typed views and the single egress, vision and explored, and the slice-5 rollout) in 4.4, 6.1, 6.3, 8, 10.3, 13, 14; v0.18 records #23 (characters and names: the `character`/`name_reveal`/`encountered` step, the name rule, the players' names and the `roster` frame, and the four name/character fault classes) in 4.1, 4.4, 6.1, 6.3, 6.4, 6.5, 8, 10.3, 13, 14; v0.19 records the owner confirmation of the #22 property-schema registry (keep the empty registry with the permissive fallback in v1; strict mode comes with the FFF seam, post-v1) in 6.1, 14; v0.20 records the #27-#31 correctness and cost fixes (per-player reveal persistence, one encountered rewrite path, link-by-update, the borrowed egress context, one scene read per request) in 4.3, 6.1, 10.3, 14; v0.21 records #41 (the height model: metres, `height` and `eye_height` as GM-only registered props with a token override, eye height 93% by default, walls full height unless the GM gives a height) in 5.7, 6.1, 8, 9, 14; v0.22 records #42 (the wall model: independent sight/movement switches with door settings and a sight-only direction, kinds as presets, a derived `kind` label, the v1 preset table, and secret/locked unobservable to players) in 1, 3.1, 5.1, 5.5, 5.8, 6.1, 7.4, 8, 14; v0.23 records #44 (low walls: see-over as a per-target predicate over the strict fog polygon, movement blind to height, the floor behind a low wall left unexplored, and the GM-only who-sees-it view) in 5.7, 5.8, 5.9, 7.4, 14. All of Q1-Q24 are RESOLVED or DEFERRED; none OPEN). Audience: the owner and coding agents.
|
||||
Status: draft v0.24, 2026-11-15 (owner decisions recorded in section 14; v0.4 records Q4 (tile_size 32 px), the outbox lock invariant (4.2, 4.3), and the follow-ups in 3.4, 8, 11.1, 12, 13; v0.5 records the M2 move-rule decisions in 5.5 and updates 3.4, 4.2, 5.1, 5.4, 6.1, 7.4, 8, 10.3, 12, 13; v0.6 records #14 (characters and player data) in 3.1, 3.4, 4.1, 4.4, 6.1, 8, 9, 10.3, 13, 14; v0.7 records #6 (players and invites) in 3.1, 3.2, 3.4, 4.4, 6.1, 8, 12, 13, 14; v0.8 records #7 (map tiles) in 3.3, 3.4, 11.1, 13, 14; v0.9 records #9 (test tools) in 2, 10.4, 13, 14; v0.10 records #12 (what M3 done means) in 13, 14; v0.11 records #15 (M3 limits) in 4.3, 6.4, 10.1, 13, 14; v0.12 records #11 (M3 message list) in 3.1, 3.2, 3.4, 4.2, 4.3, 5.5, 5.6, 6, 7.5, 13, 14; v0.13 records the owner review of #11 flags in 1, 3.1, 5.5, 6.1, 8, 14; v0.14 records #17 (getting in: keys, sessions, the auth slice) in 3.2, 4.4, 6.5, 6.6, 8, 11.1, 13, 14; v0.15 records #18 (talking safely: the protocol shell and the `closing` close-reason message) in 3.2, 4.3, 6, 6.1, 6.2, 6.4, 6.5, 10.3, 13, 14; v0.16 records #19 (walls and doors: the scene/wall schema, the wall payload rules and the slice-4 rollout) in 4.4, 6.1, 8, 13, 14; v0.17 records #20 (tokens and sight: the `entity` step, the typed views and the single egress, vision and explored, and the slice-5 rollout) in 4.4, 6.1, 6.3, 8, 10.3, 13, 14; v0.18 records #23 (characters and names: the `character`/`name_reveal`/`encountered` step, the name rule, the players' names and the `roster` frame, and the four name/character fault classes) in 4.1, 4.4, 6.1, 6.3, 6.4, 6.5, 8, 10.3, 13, 14; v0.19 records the owner confirmation of the #22 property-schema registry (keep the empty registry with the permissive fallback in v1; strict mode comes with the FFF seam, post-v1) in 6.1, 14; v0.20 records the #27-#31 correctness and cost fixes (per-player reveal persistence, one encountered rewrite path, link-by-update, the borrowed egress context, one scene read per request) in 4.3, 6.1, 10.3, 14; v0.21 records #41 (the height model: metres, `height` and `eye_height` as GM-only registered props with a token override, eye height 93% by default, walls full height unless the GM gives a height) in 5.7, 6.1, 8, 9, 14; v0.22 records #42 (the wall model: independent sight/movement switches with door settings and a sight-only direction, kinds as presets, a derived `kind` label, the v1 preset table, and secret/locked unobservable to players) in 1, 3.1, 5.1, 5.5, 5.8, 6.1, 7.4, 8, 14; v0.23 records #44 (low walls: see-over as a per-target predicate over the strict fog polygon, movement blind to height, the floor behind a low wall left unexplored, and the GM-only who-sees-it view) in 5.7, 5.8, 5.9, 7.4, 14; v0.24 records #46 (secret and locked doors: doors stay GM-only in v1, a locked door refuses to open, and the differential door-equivalence oracle with its fault, leakcheck and tile sweeps) in 1, 3.4, 5.8, 6.1, 6.5, 7.4, 10.3, 14. All of Q1-Q24 are RESOLVED or DEFERRED; none OPEN). Audience: the owner and coding agents.
|
||||
|
||||
Legend:
|
||||
- **[FIXED]** owner decision, not up for debate here.
|
||||
@@ -35,6 +35,7 @@ A browser virtual tabletop for one table (1 GM + up to 6 players [FIXED, Q1]), s
|
||||
- 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: v1 has see-through/pass-through switches and a one-way sight direction (5.8), but no distance rule (window semantics are #47; the see-over, impassable barrier is the `terrain` preset).
|
||||
- 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).
|
||||
- Freehand drawing, rulers, pings, chat, audio, video (order decided at M7, Q8).
|
||||
- Mobile-first UI polish (the client must work on a phone [MEASURED render], but layout is not a v1 goal). Devices in scope: phones, tablets, laptops (Q1, FIXED).
|
||||
@@ -155,7 +156,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] |
|
||||
| T2 | Player reads wall/door data | walls only in GM view | fault `walls` [MEASURED caught]; 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) |
|
||||
@@ -170,6 +171,7 @@ Notes:
|
||||
| T14 | Boundary ambiguity: token exactly on vision edge | documented epsilon; tests use 0.5 px tolerance [MEASURED] | leak test |
|
||||
| T15 | Backend reachable bypassing nginx (prototype nginx binds 0.0.0.0, `HANDOFF.md`) | Nim binds 127.0.0.1 only [MEASURED: prototype does], systemd `IPAddressAllow`, TLS at nginx | deploy check |
|
||||
| T16 | Name leak: actual name or reveal state of an unrevealed character/token, another player's character or encountered entry, or a browsable character list reaches a player | names and lists built per recipient at egress (8); no list-all message; encountered list is per player | fault classes `ACTUAL_NAME`, `CHAR_LIST` (10.3) |
|
||||
| T17 | **Player tells a secret or a locked door from a solid wall**, by any observable: frames, explored cells, tiles, refusal shapes, move outcomes, churn | the door settings never leave the GM view (3.1); a secret or locked door is a closed barrier to sight, movement and the door push with no other signal (5.8); same closed geometry in both scenes | differential door-equivalence test `tools/doors.test.mjs` (10.3, #46), positive control on an open door, fault `secretgap`, door-key scan in `tools/leakcheck.nim` -> `WALLDATA` |
|
||||
|
||||
---
|
||||
|
||||
@@ -379,7 +381,9 @@ What a wall's behaviour is made of. Heights are 5.7; what a low wall does to sig
|
||||
- **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 oracles that pin this are #46's.
|
||||
- **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).
|
||||
- **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].** 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.
|
||||
|
||||
| preset | `blocks_sight` | `blocks_movement` | door settings |
|
||||
@@ -468,18 +472,18 @@ Every row also carries `reqId` (omitted below). Codes are those of 6.5; `not-all
|
||||
| `wall.add` | `scene, a:[x,y], b:[x,y]`, then either a preset name (`preset:"wall"|"door"|"secret_door"|"locked_door"|"terrain"|"one_way"`) 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.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, or is a secret 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 |
|
||||
| `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`; `open`/`secret`/`locked` only with `door`; a secret door closed and two-way; `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`; `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).
|
||||
|
||||
**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). A stored non-door always has `open=false`, `secret=false`, `locked=false`, so clearing `door` through `wall.update` closes and de-secrets it.
|
||||
- `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 stored non-door always has `open=false`, `secret=false`, `locked=false`, so clearing `door` through `wall.update` closes and de-secrets it.
|
||||
- `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.
|
||||
- `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).
|
||||
- `id` is an integer; lookup failures are `not-found` (a GM's missing target, 6.5 step 8). `door.set` on a row whose `door` is false is `invalid`, and so is `open:true` on a secret door (5.8) or on a locked door (#46, 5.8).
|
||||
- `kind` is **output only** on the `wall`/`walls` frames: the label derived from the switches (`wall`, `door`, `secret_door`, `locked_door`, `terrain`, `one_way`, else `custom`). It is not accepted as an input field; an input `kind` is an unknown field (ignored, 6.2). Field names, defaults and the existing-row migration are #49's; the rule here is that the switches are the authority and the label is derived.
|
||||
- `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.
|
||||
@@ -619,7 +623,7 @@ Leak notes (R5 review, #11): (1) `kind` is GM-only because a value like `npc` wo
|
||||
3. Rate limit (token bucket, 6.4): empty bucket -> `ack rate-limited` (or `error rate-limited` if step 2 failed).
|
||||
4. Unknown `t` -> `ack unknown-type`.
|
||||
5. P sender without a name, other than `conn.ping` and `player.setname` -> `not-allowed`.
|
||||
6. Role: a G-only intent from a player -> `not-allowed`.
|
||||
6. Role: a G-only intent from a player -> `not-allowed`. `door.set` is included, whatever the door's settings: one code for every door, open, closed, locked or secret, so the reply carries no door oracle (5.8, #46).
|
||||
7. Field types and ranges -> `invalid`.
|
||||
8. Target lookup. Player senders: a target that is not theirs or does not exist is one and the same `not-allowed` (no existence oracle, T9). GM senders: missing target -> `not-found`.
|
||||
9. Semantic validation (GM: `invalid`; player move: the uniform nack, 5.5).
|
||||
@@ -630,7 +634,7 @@ Leak notes (R5 review, #11): (1) `kind` is GM-only because a value like `npc` wo
|
||||
|---|---|
|
||||
| `rate-limited` | token bucket empty (6.4); nothing applied |
|
||||
| `unknown-type` | `t` is not in 6.1 |
|
||||
| `not-allowed` | wrong role, not the controller, unknown or not-theirs target (players), unnamed player, GM key via the wire, `player.setname` when already named |
|
||||
| `not-allowed` | wrong role (a player `door.set` included, any door), not the controller, unknown or not-theirs target (players), unnamed player, GM key via the wire, `player.setname` when already named |
|
||||
| `not-found` | GM-only: scene, wall, token, character, player or entry does not exist |
|
||||
| `invalid` | missing or mistyped field, out of bounds, bad geometry, names/links inconsistent, bad name text |
|
||||
| `name-taken` | player name already used (case-insensitive, includes `GM`) |
|
||||
@@ -705,7 +709,7 @@ Prototype `client/src/main.ts`: explored rects appended to a `Graphics` mask for
|
||||
|
||||
### 7.4 Input and UI
|
||||
- Mouse: wheel zoom, drag pan, drag token. Touch: one finger drag/pan, two-finger pinch/pan [MEASURED works on Note 10].
|
||||
- Wall editor (GM) [FIXED, Q6, extended by 5.8]: click-click segments, snap to grid/endpoints optional, delete, undo of last edit [PROPOSED]; submits `wall.*` intents; server is the validator. A preset row (`wall` (default), `door`, `secret door`, `locked door`, `terrain`, `one-way wall`) sets the switches for a one-drag default; an **advanced** toggle exposes the raw switches (`blocks_sight`, `blocks_movement`, `sight_dir`, `door`, `open`, `secret`, `locked`) for a custom wall. The editor draws `kind` (the derived label) only; no preset is a stored kind. Thickness and height controls arrive with #45 and M4.
|
||||
- Wall editor (GM) [FIXED, Q6, extended by 5.8]: click-click segments, snap to grid/endpoints optional, delete, undo of last edit [PROPOSED]; submits `wall.*` intents; server is the validator. A preset row (`wall` (default), `door`, `secret door`, `locked door`, `terrain`, `one-way wall`) sets the switches for a one-drag default; an **advanced** toggle exposes the raw switches (`blocks_sight`, `blocks_movement`, `sight_dir`, `door`, `open`, `secret`, `locked`) for a custom wall. The editor draws `kind` (the derived label) only; no preset is a stored kind. Thickness and height controls arrive with #45 and M4. A locked door's open action is the `invalid` case of 5.8, so the editor shows the hint "locked: unlock first" and offers the one click that clears `locked`; no door action is offered to players (#46).
|
||||
- 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.
|
||||
|
||||
@@ -785,6 +789,8 @@ 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 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).
|
||||
- **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).
|
||||
@@ -1011,3 +1017,5 @@ Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #41]: the hei
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #42]: the wall model. A wall's behaviour is **independent switches**, and a named kind is only a **preset** over them: never a fixed kind enum in the record, and never client-interpreted free flags (the client may send a preset name; the server expands and validates it). v1 switches are `blocks_sight` and `blocks_movement` plus the door settings `door`, `open`, `secret`, `locked` and one direction field `sight_dir` (`both|left|right`); no light or sound axis. Direction is **sight only**: movement is two-way governed by its switch. A door is a wall with `door` set and independent `open`/`secret`/`locked` settings, not a separate kind or a state enum, and `door.set` keeps working as "set `open`". The switches describe the closed wall: an open door blocks neither sight nor movement. A secret door is always closed and two-way (`open:true` or `sight_dir != both` on it is `invalid`), so it can look exactly like a solid wall. `secret` and `locked` are GM-only and never observable to a player in any form; the obligations are byte-identical player frames and refusals for a closed secret door against a solid wall, and one uniform move nack. v1 presets (one-drag editor defaults and the GM's label) are `wall` (default), `door`, `secret door`, `locked door`, `terrain` (blocks movement, not sight: railing, bushes) and `one-way wall`; there is no `window` preset until #47 gives windows a rule, and "blocks nothing" is not a preset. The record stores the switches; `kind` survives on the wire as a derived read-only label (exact preset match, else `custom`), never an input and never the authority [FIXED (owner-delegated)]. The switches are typed validated fields on the record and in the payloads, not entries in the never-interpreted `flags`; columns vs one validated object, and the existing-row migration, are #49's [FIXED (owner-delegated)]. The GM editor has a preset row plus an **advanced** toggle that exposes the raw switches [FIXED (owner decision)]. Thickness and height compose through the switches (a wall with `blocks_sight=false` never reaches the sight predicate) and are decided in #45 and #44. See 1, 3.1, 5.1, 5.5, 5.8, 6.1, 7.4, 8, 14.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #44]: low walls. A token is visible iff **its top clears every sight wall the line from the viewer's eye crosses**, strictly: the sight line's height at the wall (`h_e + (h_t - h_e)·d_W/d_T`) must exceed the wall's height, and one failing wall hides it. The target's own height therefore matters (a giant's head over a fence, a crouched figure hidden next to the wall it would clear from further away); there is no adjacent-visible exception and no distance rule. The visibility polygon stays **strict**, so the floor behind a low wall stays unexplored and black, no tile is sent, and a visible token may stand on a black cell; no per-cell height is tested anywhere. Movement never reads height: `blocks_movement` alone decides, so a knee-high wall with the switch on stops a walker. Players get a binary answer and the whole token, with no clipping and no cover percentages (a rules-engine judgement, still a non-goal). The GM gets a GM-only **who-sees-it** view: per token, which player(s)/characters see it and its visible fraction (the share of its height above the highest blocking sight line, 100 % unobstructed), derived from data the GM already receives, never on a player wire, its panel shape M4's. Knobs delegated: strict comparison with equality hidden, evaluated at the wall near face; every crossed wall must clear; the hook sits at `visibleTo` as `insideAny or predicate` with heights never entering `visibilityPolygon`; no "see-over" switch on the wall; the hidden band's cells and tiles are oracle-*maybe*, a band-hidden token gives no frame, name or churn, and the leak checker's clear-line oracle gets its own height test. See 5.7, 5.8, 5.9, 7.4.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #46]: secret and locked doors. (1) **Player door opening is out of v1** [FIXED (owner decision)]: only the GM opens or closes a door; `door.set` stays G-only and a player sender is `not-allowed` at the role step (6.5) whatever the door's settings. Player-opened doors, lock refusals addressed to players and player discovery of secret doors (searching, revealing, finding a way in) are future effort, not v1 and not this map; the lock is GM authoring state. (2) **A locked door does not open** [FIXED (owner decision)]: `door.set open:true` on a door with `locked` is `invalid`, exactly like a secret door, and the GM unlocks first (editor hint "locked: unlock first"); any write that would store `open:true` with `locked` or `secret` — `wall.add`, `wall.update`, a preset expansion — is `invalid`; closing a locked door is allowed. Otherwise a locked door is an ordinary closed door. (3) **The equivalence oracle** [FIXED (owner-delegated)]: `tools/doors.test.mjs` is a new Node accept group (built-ins only, 10.4) in the shape of `tools/probing.test.mjs` — two servers, fresh state, one identical script, scenes differing only in one segment (solid wall vs secret door; solid wall vs secret+locked; closed door vs locked closed door), player frames and per-tile statuses identical after canonicalisation with **no** normalisation; the positive control is the same script against an open door, which must differ; the negative control is `LEAK_FAULT=secretgap` (a secret door not blocking the player-facing computation), which must fail the doors group while a clean build passes and ships no fault string; `tools/leakcheck.nim`'s banned-key scan grows `secret`, `locked`, `door`, `blocks_sight`, `blocks_movement`, `sight_dir` (and #49's names) into `WALLDATA`, with a new fault leaking one door setting key and asserting exactly `WALLDATA`; a GM `door.set` on a secret or locked door is `invalid` and a player `door.set` is `not-allowed` for every door; timing and size side channels (T11) stay accepted and untested. See 1, 3.4, 5.8, 6.1, 6.5, 7.4, 10.3.
|
||||
|
||||
Reference in New Issue
Block a user