design: wall wire format, schema and migration (#49)
This commit is contained in:
+7
-3
@@ -9,7 +9,7 @@ How big a token is on the map, as a radius in map pixels. A token uses its own s
|
||||
_Avoid_: token scale, token diameter, size preset
|
||||
|
||||
**Height**:
|
||||
How tall a figure is, in metres. A character has a base height; a token may carry its own instead, a temporary on-map override (a spell that enlarges the figure) that never changes the character and disappears with the token. A plain token has only its own height and must have one. Players never see the number, only what it lets them see.
|
||||
How tall a figure is, in metres. A character has a base height; a token may carry its own instead, a temporary on-map override (a spell that enlarges the figure) that never changes the character and disappears with the token. A plain token has only its own height and must have one. Players never see the number, only what it lets them see. A wall's height is a different thing with the same unit: an optional field on the wall itself, in metres (see Wall).
|
||||
_Avoid_: elevation, z, altitude (those are position above the ground)
|
||||
|
||||
**Eye height**:
|
||||
@@ -51,13 +51,17 @@ 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, (for sight) a direction, and whether players see a marker; 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). A wall has no thickness unless the GM gives it one; then it occupies a strip of floor on one side or both sides of the drawn line (see Wall body), and an older wall has none and hides exactly what is behind the line. Only the GM opens or closes a door in v1.
|
||||
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, (for sight) a direction, and whether players see a marker; 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. The wall's height is its own field, never a token property, and only the GM sees the number. A low wall hides only what fails the see-over line (see Low wall, See-over). A wall has no thickness unless the GM gives it one; then it occupies a strip of floor on one side or both sides of the drawn line (see Wall body), and an older wall has none and hides exactly what is behind the line. Only the GM opens or closes a door in v1.
|
||||
_Avoid_: blocker, collider, obstacle, sight blocker, wall type (use preset)
|
||||
|
||||
**Player marker**:
|
||||
The one wall fact a player ever receives: an anchor point on a wall whose `player_marker` switch is on, sent once that player has seen part of the wall and then kept like explored memory. It is a point and nothing else — no kind, no open/closed, no direction, no label, no thickness, no wall id — and the client draws the window icon there. A wall with the marker off is invisible to players; a GM can turn the marker on for any wall. Only the GM's changes take it back (wall removed, marker off, no longer a window, geometry moved), and a moved wall has to be seen again before its marker returns.
|
||||
The one wall fact a player ever receives: an anchor point on a wall whose `player_marker` switch is on, sent once that player has seen part of the wall and then kept like explored memory. It is a point and nothing else — no kind, no open/closed, no direction, no label, no thickness, no wall id — and the client draws the window icon there. A wall with the marker off is invisible to players; a GM can turn the marker on for any wall, but a marker is only sent for a wall that is still a window. Only the GM's changes take it back (wall removed, marker off, no longer a window, geometry moved), and a moved wall has to be seen again before its marker returns. Each player gets their own markers as a full set when they connect and only changes after that; the GM never receives them.
|
||||
_Avoid_: window marker, wall hint, marker flag (the switch is `player_marker`)
|
||||
|
||||
**Marker id**:
|
||||
The opaque name a player's marker has on the wire: a short random string the server assigns per player, never the wall's id and never shared between players. It exists so the client can add a marker once and remove that exact one later without the frame revealing which wall it is or how many walls exist.
|
||||
_Avoid_: wall id, marker index, window id
|
||||
|
||||
**Wall label**:
|
||||
An optional free-text name the GM gives a wall, e.g. "railing", "pit edge", "the king's window". It has no behaviour, never changes the derived kind, and never reaches a player. It is how one object can be many things in the GM's head: a railing, a bush and a fixed window are the same wall with the same switches and different labels.
|
||||
_Avoid_: wall name, wall description, wall type
|
||||
|
||||
+65
-34
@@ -1,6 +1,6 @@
|
||||
# FFF_vtt design
|
||||
|
||||
Status: draft v0.28, 2026-11-17 (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; v0.28 records #50 (door geometry: the door leaf is the wall's own body, an open door is only a gap, and the thick-door push geometry) in 5.4, 5.5, 5.8, 5.10, 10.3, 14. All of Q1-Q24 are RESOLVED or DEFERRED; none OPEN). Audience: the owner and coding agents.
|
||||
Status: draft v0.29, 2026-11-17 (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; v0.28 records #50 (door geometry: the door leaf is the wall's own body, an open door is only a gap, and the thick-door push geometry) in 5.4, 5.5, 5.8, 5.10, 10.3, 14; v0.29 records #49 (the wall record's wire fields, typed columns with CHECK constraints, migration step 8 with the legacy `kind` dropped and `marker_seen` added, existing heights backfilled to 1.8 m, the player `marker` message, and `proto` 2) in 3.1, 4.4, 5.7, 5.8, 5.9, 5.10, 6.1, 6.2, 6.3, 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.
|
||||
@@ -102,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, `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 |
|
||||
| Walls: geometry (`a`/`b`, `thickness`, `position` and the body's side, 5.10; `height` in metres, 5.7), the 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 integer-px anchor and an opaque per-player id, nothing else (5.8, 6.1, #48/#49) | 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 |
|
||||
@@ -126,7 +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.
|
||||
- **The one exception: a player marker [FIXED (owner decision), 2026-11-16, #48; shape 2026-11-17, #49].** A wall with `player_marker` on and a derived `kind` of `window` sends a player, once that player has seen part of it, exactly one thing: an **anchor point** (integer px, 6.1 `marker`) 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 is `marker {full, set:[{id, pos}], del}`, player-bound only. **The GM receives no `marker` frame:** a player's marker set is that player's own memory, like their explored grid (this table's "Explored grid" row: GM `none`), and the GM already holds every wall fact the marker could carry. The marker id is a per-player opaque 12-character string from the token alphabet, never the wall id.
|
||||
|
||||
### 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.
|
||||
@@ -252,7 +252,11 @@ player_key(player_id PK FK, secret, created_at) -- indicative; one current key
|
||||
session(id PK, player_id FK, token_hash, created_at, last_seen) -- never expires (Q10)
|
||||
scene(id PK, name, w, h, tile_size, cell, grid_size, vision_radius_default, token_radius_default,
|
||||
art_version, active, next_wall_id, extra_json) -- next_wall_id: monotonic, §8 [FIXED, #3]; token_radius_default [FIXED, #4]
|
||||
wall(scene_id FK, id, ax, ay, bx, by, kind, open, flags, PRIMARY KEY(scene_id, id)) -- behaviour = switches (5.8); `kind` is a derived label, never the authority; columns vs a validated object are #49's
|
||||
wall(scene_id FK, id, ax, ay, bx, by, thickness, position, blocks_sight, blocks_movement, sight_dir,
|
||||
player_marker, door, open, secret, locked, height NULL, label NULL, flags, PRIMARY KEY(scene_id, id))
|
||||
-- behaviour = typed switch columns (5.8, #49); `kind` is derived, never stored
|
||||
marker_seen(player_id FK, scene_id, wall_id, marker_id, PRIMARY KEY(player_id, scene_id, wall_id),
|
||||
UNIQUE(player_id, marker_id), FK(scene_id, wall_id) -> wall ON DELETE CASCADE)
|
||||
character(id PK, owner_player_id FK NOT NULL, descriptive_name, actual_name, reveal_all BOOL,
|
||||
props_public JSON, props_owner JSON, props_gm JSON) -- NOT NULL: exactly one owner; GM owns via the GM's player id [FIXED, #14]
|
||||
entity(id TEXT PK, scene_id FK, kind, character_id FK NULL, descriptive_name NULL, actual_name NULL, reveal_all BOOL,
|
||||
@@ -279,6 +283,17 @@ explored_chunk(player_id, scene_id, cx, cy, bits BLOB, PRIMARY KEY(player_id, sc
|
||||
- **`encountered` has no FK to `entity` or `character`.** Entries survive token removal, character removal and a `gm_only` flip (8), and only `encountered.remove` deletes one. `character_id` is stored so a rename and a `reveal_all` can follow the snapshots of everyone who met the character; `actual_name NULL` means "this player was never told it" (the writer stores `''`, db_connector cannot bind NULL).
|
||||
- **`entity.character_id` is nullable and written as a SQL literal**, because db_connector quotes every bound argument as text and cannot send NULL; the value is always an id from the checked alphabet (`tokens.sqlLitId` raises otherwise). The FK is what makes a dangling link impossible, and `character.remove` pre-checks `in-use` so the FK never fires.
|
||||
- **`entity.descriptive_name`/`actual_name` stay `NOT NULL`**: a token linked to a character stores `''` in both and its names come from the character record (8). Validation refuses a linked token that carries names and a plain token that lacks them, in both directions (6.1).
|
||||
- Step 8 (wall record: fields, storage and migration) [FIXED (owner-delegated, 2026-11-17, #49)]: rebuilds `wall` into the typed record 8 describes and adds `marker_seen`; the legacy `kind` column is **dropped** (its values are mapped, not preserved; the project has no real data before M4). The `Migration` entry gains a `data` hook (a `proc(db: DbConn)` run inside the same transaction, after `stmts`, before the history row) for the one part SQL cannot express portably: the height backfill. Statements:
|
||||
1. `ALTER TABLE wall RENAME TO wall_v1`
|
||||
2. `CREATE TABLE wall (scene_id INTEGER NOT NULL REFERENCES scene(id) ON DELETE CASCADE, id INTEGER NOT NULL, ax/ay/bx/by REAL NOT NULL, thickness REAL NOT NULL DEFAULT 0 CHECK (thickness >= 0 AND thickness <= 256), position TEXT NOT NULL DEFAULT 'center' CHECK (position IN ('center','left','right')), blocks_sight INTEGER NOT NULL DEFAULT 1 CHECK (blocks_sight IN (0,1)), blocks_movement INTEGER NOT NULL DEFAULT 1 CHECK (blocks_movement IN (0,1)), sight_dir TEXT NOT NULL DEFAULT 'both' CHECK (sight_dir IN ('both','left','right')), player_marker INTEGER NOT NULL DEFAULT 0 CHECK (player_marker IN (0,1)), door INTEGER NOT NULL DEFAULT 0 CHECK (door IN (0,1)), open INTEGER NOT NULL DEFAULT 0 CHECK (open IN (0,1)), secret INTEGER NOT NULL DEFAULT 0 CHECK (secret IN (0,1)), locked INTEGER NOT NULL DEFAULT 0 CHECK (locked IN (0,1)), height REAL NULL CHECK (height IS NULL OR (height > 0 AND height <= 100)), label TEXT NULL CHECK (label IS NULL OR (length(label) >= 1 AND length(label) <= 64)), flags TEXT NOT NULL DEFAULT '{}', PRIMARY KEY (scene_id, id), CHECK (open = 0 OR door = 1), CHECK (secret = 0 OR (door = 1 AND open = 0 AND blocks_sight = 1 AND blocks_movement = 1 AND sight_dir = 'both')), CHECK (locked = 0 OR door = 1), CHECK (sight_dir = 'both' OR blocks_sight = 1))`
|
||||
3. `INSERT INTO wall (...) SELECT ..., 0, 'center', 1, 1, 'both', 0, CASE kind WHEN 'door' THEN 1 ELSE 0 END, CASE kind WHEN 'door' THEN open ELSE 0 END, 0, 0, NULL, NULL, flags FROM wall_v1` — every existing wall becomes today's behaviour: `thickness 0`, `position center`, `blocks_sight`/`blocks_movement` 1, `sight_dir both`, `player_marker` 0, `secret`/`locked` 0, `height` NULL (full height), `label` NULL; `kind='door'` becomes `door=1` with the **same `open`**, `kind='wall'` becomes `door=0` with `open=0`.
|
||||
4. `DROP TABLE wall_v1`
|
||||
5. `CREATE TABLE marker_seen (player_id INTEGER NOT NULL REFERENCES player(id) ON DELETE CASCADE, scene_id INTEGER NOT NULL, wall_id INTEGER NOT NULL, marker_id TEXT NOT NULL, PRIMARY KEY (player_id, scene_id, wall_id), UNIQUE (player_id, marker_id), FOREIGN KEY (scene_id, wall_id) REFERENCES wall(scene_id, id) ON DELETE CASCADE)`
|
||||
- **Why a rebuild and not `ALTER TABLE ... DROP COLUMN`:** the step must drop `kind` and add nine NOT NULL columns (plus two nullable) with CHECKs at once, and SQLite's `DROP COLUMN` refuses a column named in a CHECK constraint; the table is thousands of rows at most, so one rebuild is cheaper than a chain of ALTERs plus a rewrite, and it leaves exactly one schema shape. Nothing references `wall` except `marker_seen`, created after it in the same step, so no other FK moves.
|
||||
- **Why columns and not one JSON object:** precedent (`scene` and `entity` keep every interpreted field as a typed column and reserve `flags`/`props_*` for data the server never reads); CHECKs (a JSON object cannot reject `open:true` on a non-door or a one-way window without triggers); the load path (`loadScene` reads a row into a typed `WallRec`, no parse-and-validate step at every startup beside the wire's own validation); the closed switch set (a new axis is a schema step either way). 5.8's "one object" is about the domain and the wire; the columns are how that one object is stored.
|
||||
- **Height backfill (the `data` hook):** for every row of `entity` and `character`, if `props_gm` parses as a JSON object without a `height` key, set `height: 1.8` and write it back with a bound TEXT parameter (JSON, so no NULL problem); `eye_height` is never written (the 93 % rule derives it, 5.7). A row with a hand-set `height` is untouched. This is #41's deferred question and #49's answer (5.7).
|
||||
- **`label` and `height` NULL binding:** db_connector quotes every bound argument as text and cannot bind NULL, so both columns are written as SQL literals (`NULL` when absent) by one helper in `server/world.nim` (`world.sqlLitText` doubles `'`; a real is formatted with a fixed locale-free form). The `''`-for-NULL trick used by `encountered.actual_name` does not apply: `''` is not a legal label (`1..64`) and `0` is not a legal height (`> 0`), so a sentinel would make the load path lie about the domain.
|
||||
- **Startup and write timing:** `marker_seen` rows are loaded per player with the explored chunks before the first connection (like `explored.restore`); marker inserts/deletes are derived player memory and ride the mutation's `NORMAL` transaction (the same one as the explored chunks), never the `FULL` authoring one. They run before the ack, after the wall row commits, so a retraction's `del` can never precede the wall change it reports.
|
||||
- Startup: load everything into memory, recompute vision for all players (prototype does, in one transaction) so `vision` is never stale vs walls. Slice 5 loads the scene and its tokens; a player's sight state (`PlayerVision`) is created on that player's first connection and recomputed from the current walls, so nothing is stale after a restart. Slice 6 (#21) restores every stored `explored_chunk` row into that player's set before the first connection (`explored.restore`), so a reloaded grid is the grid the player had; polygons are never stored (they are recomputed, 8).
|
||||
- Shutdown: install a SIGTERM handler [prototype has only SIGINT, `HANDOFF.md`]: stop accepting, close sockets, final `wal_checkpoint(TRUNCATE)`, exit. Durability does not depend on it (WAL commit before ack).
|
||||
|
||||
@@ -368,20 +383,21 @@ Notation: token centre `c`, radius `r` (entity `radius` if set, else scene `toke
|
||||
- Wire intents: `token.resize`, `status.set`, `status.clear` (6.1) [FIXED (owner-delegated, 2026-11-14, #11)].
|
||||
|
||||
### 5.7 Heights [FIXED (owner decision), 2026-11-15, #41]
|
||||
What the vertical dimension is made of, and in what unit. Vision only: what a low wall does to sight is 5.9 (#44), thickness is 5.10 (#45), the wall kinds were #42 (5.8), the wire and migration are #49.
|
||||
What the vertical dimension is made of, and in what unit. Vision only: what a low wall does to sight is 5.9 (#44), thickness is 5.10 (#45), the wall kinds were #42 (5.8), the wire, the storage and the migration are settled by #49 (6.1, 8).
|
||||
- **Unit: metres, decimal.** Map distances stay px and no map scale is introduced: see-over compares heights with heights, so no px -> m conversion exists anywhere [FIXED (owner decision), 2026-11-15, #41]. Research #39 3.3 needs only `h_eye` and `h_wall` for the hidden band behind a low wall (`d_floor = s * h_eye / (h_eye - h_wall)`), never a ground distance in metres.
|
||||
- **Height is a property, not a field.** `height` and `eye_height` live in the `gm` bucket of the three-bucket `props` (8), on the character or on the token; there is no dedicated column and no wire field of their own.
|
||||
- **Height is a property, not a field.** `height` and `eye_height` live in the `gm` bucket of the three-bucket `props` (8), on the character or on the token; there is no dedicated column and no wire field of their own. **[Narrowed 2026-11-17, #49: this bullet is about tokens and characters. A wall has no `props` buckets, so a wall's height is a typed field on the wall record (metres, optional, absent/`null` = full height), stored as a wall column and carried on the GM `wall`/`walls` frames only; it never reaches a player, and the property-schema registry still holds exactly `height` and `eye_height`.]**
|
||||
- **Token height.** A character carries its base `height` (the character-sheet value). A plain token (no character) carries its own `height`, and `token.create` without one is refused `invalid` (`invalid`, not `not-found`: a missing field, 6.5). A linked token uses its character's `height` by default; it may carry its own `height` as a temporary on-map override (an enlarge spell doubling it) that never writes the character. Removing the override restores the character's value. **Effective token height** = the token's override, else the character's `height`, else the plain token's own `height`.
|
||||
- **Eye height** follows the same pattern: `eye_height` on the character (base) with an optional token override. Effective eye height = the token override, else the character's `eye_height`, else, if nobody set one by hand anywhere, **93% of the effective token height**, following height changes live (an enlarge doubles the eyes too). A hand-set value is used as is and is never rescaled [93% FIXED (owner-delegated), 2026-11-15, #41].
|
||||
- **Walls**: a wall is full height unless the GM gives it a height in metres; full height means nobody sees over it, a giant included. Existing walls (no height stored) keep behaving exactly as today [FIXED (owner decision), 2026-11-15, #41]. The field is GM-only like all wall data.
|
||||
- **Walls**: a wall is full height unless the GM gives it a height in metres; full height means nobody sees over it, a giant included. Existing walls (no height stored) keep behaving exactly as today [FIXED (owner decision), 2026-11-15, #41]. The field is GM-only like all wall data. **The field itself [FIXED (owner-delegated), 2026-11-17, #49]:** `height` is a typed wall field, metres, a finite number `> 0` and `<= 100`; absent or `null` means full height and is stored as SQL `NULL`, never as `0` or `100`. It is set by `wall.add`/`wall.update` (6.1), stored as a wall column (8), and carried only on the GM's `wall`/`walls` frames — it is in leakcheck's `BannedAlways` (`WALLDATA`, 10.3) because no player frame ever carries it. 100 m is a finite wall: every legal figure is `<= 100 m` tall and equality is hidden (5.9), so a 100 m wall hides everyone, and `NULL` differs from it only in a hypothetical taller thing.
|
||||
- **GM-only.** Both keys are in the `gm` bucket, so no player frame carries either: the `token` frame's `props` is `public` plus `owner` for the controller (6.1), and a player never reads the `gm` bucket. Players see only the outcome, their sight.
|
||||
- **Limits** [FIXED (owner-delegated), 2026-11-15, #41]: every height > 0; `height` <= 100 m; `eye_height` <= 100 m and **may exceed** `height` (a floating eye); a wall's height > 0 and <= 100 m. The registered kind is enforced on write, so a non-number is `invalid` (8, 9).
|
||||
- **First registered keys.** `height` and `eye_height` are the first two keys of the property-schema registry (8, 9): `kind` number, bucket `gm`. This is the first time the server interprets props, so the "the server never interprets props in v1" wording of 8 and 9 is narrowed to **the server interprets only registered keys used by core sight rules** (6.1, 8, 9).
|
||||
- Deferred: what height existing tokens and characters get at migration (`height` is required) -> #49 "Wall wire format, schema and migration". The *target's* height in see-over (a giant's head over a fence) is settled by #44 (5.9): the target's top is what has to clear the line.
|
||||
- **Migration [FIXED (owner decision), 2026-11-17, #49].** Every existing token and every existing character gets `height: 1.8 m` in its `gm` bucket, filled in code by migration step 8 only when the key is absent (4.4, 8). 1.8 m is a standing adult, so the 93 % rule gives an eye height of 1.674 m live and an old figure sees over a 1.0 m low wall from behind, matching the scenario #43 prototyped. `eye_height` is not written by the migration: the 93 % rule derives it, and a hand-set value is never overwritten.
|
||||
- Deferred: nothing. What height existing tokens and characters get at migration is settled above (#49); 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; presets, `player_marker` and `label` settled 2026-11-16, #48; the door leaf and its push settled 2026-11-17, #50]
|
||||
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.
|
||||
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 fields, the storage and the migration are settled by #49 (6.1, 8, 4.4).
|
||||
- **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; `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.
|
||||
@@ -391,10 +407,10 @@ What a wall's behaviour is made of. Heights are 5.7; what a low wall does to sig
|
||||
- **The door leaf is its own body [FIXED (owner decision), 2026-11-17, #50].** There is no separate leaf rectangle inside an opening and no clamp to the neighbouring pieces: a door stores the same `a`, `b`, `thickness` and `position` as any wall (5.10) and its leaf **is** that body, for sight, movement and the push alike. A thick door therefore bulges out of the doorway on its placement's side, or leaves a step behind its jambs, exactly as the GM drew it; that is authoring, not a rule. A deep opening between thick jambs keeps the thick-jamb tunnel/keyhole view accepted in #43. Nothing swings, slides or hinges: opening and closing are the same body appearing and disappearing, so a close never sweeps an arc through the room.
|
||||
- **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.
|
||||
- **Player marker: the one wall fact a player receives [FIXED (owner decision), 2026-11-16, #48; shape and storage 2026-11-17, #49].** `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). A marker is emitted only for a wall that is **both** `player_marker:true` and derives `kind:"window"`: that is the retraction rule (above) read forward, so a solid wall with the switch on stores the switch and sends nothing. 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.
|
||||
- **Lifetime [FIXED (owner-delegated), #48; storage #49].** Once seen, the marker is that player's memory, like the explored grid: it rides with explored, is persisted per player in `marker_seen` (8), 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; shape #49].** The message is the dotless server noun `marker`: `{full:bool, set:[{id, pos}], del:[id]}`, mirroring `encountered`'s full/set/del spelling, with `pos` in integer px (the wall's drawn midpoint, rounded once) and `id` an opaque per-player 12-character string from the token alphabet. It is sent to a player only, never to the GM (3.1). The full set goes on connect and resync (6.3); afterwards a diff carries additions in `set` and retractions in `del`, never both for one id, and a marker is never updated in place (a moved anchor is a retraction plus a re-earned marker). 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.
|
||||
@@ -413,12 +429,12 @@ What a wall's behaviour is made of. Heights are 5.7; what a low wall does to sig
|
||||
- **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; 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.
|
||||
- **Where the switches live [FIXED (owner-delegated), #42; columns #49].** 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). **They are columns [FIXED (owner-delegated), 2026-11-17, #49]:** one typed column per switch with CHECK constraints, one per geometry field (`thickness`, `position`, `height`), plus `label`; `flags` keeps only data the server never interprets. The rationale and the DDL are in 8 and 4.4; "one object" holds in the domain and on the wire, columns are how the one object is stored.
|
||||
- **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 exactly as a solid wall; a closed opening window or a secret door pushes exactly as a solid wall would on a close, with no signal; a fixed window (`door:false`) never closes, so it never pushes (5.5, #50); a one-way wall blocks movement both ways.
|
||||
|
||||
### 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.
|
||||
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 settled by #49 (6.1, 8). Answers #41's open question: the *target's* height matters.
|
||||
|
||||
- **Movement is blind to height [FIXED (owner decision), #44].** "Does a low wall block movement?" is answered by `blocks_movement` alone, exactly as in 5.5/5.8. Height is a sight input and never enters the move rules, the collider, `stuck`/`squeezed` or the door push: a knee-high wall with the switch on stops a walker, and a wall with it off is walked through however tall it is.
|
||||
- **See-over is a per-target predicate, not a wall flag [FIXED (owner decision), #43].** A token is visible iff its top clears the wall on the line from the viewer's eye; the visibility polygon stays **strict**, i.e. it still stops at every sight wall's line (5.1). Consequence, accepted: a visible token may stand on a cell its viewer has not explored ("floating on black"). Rejected: a permissive polygon that fogs a band nobody can see, and a "see-over" switch on the wall.
|
||||
@@ -437,7 +453,7 @@ What a wall shorter than a figure does to sight and movement. Heights and units
|
||||
- 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 is the body itself and its push is 5.5 (settled 2026-11-17, #50, 5.8).
|
||||
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 settled by #49 (6.1, 8); a thick door's leaf is the body itself and its push is 5.5 (settled 2026-11-17, #50, 5.8).
|
||||
|
||||
- **The body.** Thickness is a strip of floor: a rectangle of length `|ab|` with **square ends** and no extension past `a` or `b`, and width `thickness`. `position` places it: `center` (default) straddles the drawn `a -> b` line, half the thickness each side; `left` keeps the whole body on the left of `a -> b`, so the line is the inner face and the room's interior; `right` on the other side. A flip moves only the body: `a` and `b` never move, so the GM draws the exact interior size and puts the thickness outward. `left`/`right` are the sides of the `a -> b` order, the same pair `sight_dir` uses (5.8): left is the `(-dy, dx)` normal of `a -> b`, the same left as 5.5's default door-push side. The editor draws each one-way wall's direction as an arrow at its middle and offers a flip (7.4, 5.8, #47).
|
||||
- **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].
|
||||
@@ -451,9 +467,9 @@ What a wall's thickness does to the floor it covers, the vision fan and the coll
|
||||
- **A wall edit never pushes [FIXED (owner decision), #45].** A thickness change, a position flip or a move that puts a body over a token leaves the token where it is and makes it `stuck` (5.5's rule for a wall edit over a token: it may only move to reduce or leave the overlap). Only a door **closing** pushes (5.5; with thickness the push is measured from this same body, and the body is the leaf, 5.8 and 5.5, #50). So the GM can thicken a wall through a crowd and nobody teleports.
|
||||
- **Joints: overlap, never a mitre [FIXED (owner-delegated), #45].** Two walls meeting at a corner keep their own rectangles; the bodies overlap at the joint and the outside corner shows a small notch. No mitre, no merged joint, no joint object, and no crack: the overlap is what closes it. A cave is a chain of straight walls. #43 measured that joints need no thickness: zero-width corners show no crack either.
|
||||
- **Shape behind a seam [FIXED (owner-delegated), #45].** A wall's occupied area is produced by **one** wall-shape function, and no other code reads `a`/`b` to build geometry; in v1 that function returns the 5.10 rectangle. Curved, freeform and image-traced walls are out of v1 (1) and land by changing that function alone, so no sight, move, editor or wire code may assume "a wall is a straight segment".
|
||||
- **Editor and fields** [FIXED (owner-delegated), #45]. The GM editor gains a thickness control and a **position flip** with a live preview of the body, the flip never moving `a`/`b` (7.4). A new wall starts at the GM's last-used thickness, held as editor state for the session (not a scene field, not on the wire); a fresh editor starts at 0. The record and the payloads carry `thickness` (number, px, 0..256) and `position` (`center|left|right`, default `center`); the payload shape, columns vs one validated object, and the existing-row migration are #49's (6.1, 8).
|
||||
- **Editor and fields** [FIXED (owner-delegated), #45]. The GM editor gains a thickness control and a **position flip** with a live preview of the body, the flip never moving `a`/`b` (7.4). A new wall starts at the GM's last-used thickness, held as editor state for the session (not a scene field, not on the wire); a fresh editor starts at 0. The record and the payloads carry `thickness` (number, px, 0..256) and `position` (`center|left|right`, default `center`); the payload shape and the existing-row migration are settled in 6.1 and 8 (#49).
|
||||
- Oracles: the independent explored/tile oracle and the leak checker build the body rectangle from `a`, `b`, `thickness` and `position` with their own code, never by calling `vision.nim` or the move rules, and use it for both the sight footprint and the distance test. Assertions land with the build tickets (10.2, 10.3).
|
||||
- Deferred: columns, payload shape and migration -> #49. What a door is with thickness is settled: the leaf is the wall's own body (5.8) and the push is measured from that body, reducing to today exactly at zero thickness (5.5) [FIXED, 2026-11-17, #50].
|
||||
- Deferred: nothing about thickness. The columns, the payload shape and the migration are settled in 6.1, 8 and 4.4 (#49). What a door is with thickness is settled: the leaf is the wall's own body (5.8) and the push is measured from that body, reducing to today exactly at zero thickness (5.5) [FIXED, 2026-11-17, #50].
|
||||
|
||||
---
|
||||
|
||||
@@ -461,7 +477,7 @@ What a wall's thickness does to the floor it covers, the vision fan and the coll
|
||||
|
||||
Transport: one WebSocket per client at `/ws`, JSON text frames (a binary frame counts as malformed, 6.5). Envelope: `{t: string, ...fields}`; every server frame adds a per-connection counter `n` (starts at 1 on the connection's first frame; replaces the global `gseq` for everyone, section 3.1).
|
||||
|
||||
The whole of 6 is [FIXED (owner-delegated, 2026-11-14, #11)] unless a line says otherwise: the owner delegated the wire shapes and accepted the set. It is the complete M3 wire catalogue (29 intents, 15 server messages); nothing outside it exists in M3.
|
||||
The whole of 6 is [FIXED (owner-delegated, 2026-11-14, #11)] unless a line says otherwise: the owner delegated the wire shapes and accepted the set. It is the complete M3 wire catalogue (29 intents, 15 server messages); `marker` is the one M4-era message added by #49 (2026-11-17), so the current catalogue is 29 intents and 16 server messages, of which M3 has built 15 and M4's wall-model build adds `marker` plus the new wall fields (6.2 `proto` 2). Nothing outside it exists in M3.
|
||||
|
||||
Conventions:
|
||||
- **Naming.** Client -> server `t` is `<noun>.<verb>`: lowercase ASCII, exactly one dot. Nouns follow GLOSSARY.md: `token` (the map figure; the word "entity" never appears on the wire), `character`, `player`, `key` (a player key), `status`, `name`, `encountered`, plus `wall`, `door`, `scene`, `prop`, `conn`, `act`. Server -> client `t` is a bare state or event noun, snake_case, **no dot** (`token`, `token_gone`). A server `t` therefore never equals a client `t`.
|
||||
@@ -470,7 +486,7 @@ Conventions:
|
||||
- **Uniform move refusal (T9).** A refused move by a controller (locked, over step cap, wall collision; 5.5) and a GM move out of bounds both give `ack {ok:false, pos:<old position>}` with **no `code`**: one shape, no reason. Every other refusal carries a `code` and never carries a position.
|
||||
- **Effects.** An intent's effects reach clients only as state messages, each built per recipient (3.1, 8) and sent only when that recipient's view changed (T11). "GM" below = every GM connection; "player X" = every connection of player X; "visible" = per the view rules in 3.1.
|
||||
- **Roles.** Sender column: P = player, G = GM. A P-sender intent from a connection whose player has no name yet is refused `not-allowed`, except `conn.ping` and `player.setname`.
|
||||
- **Not in M3:** `act.do` is reserved (v1 answers `no-rules`); server -> client `event` is reserved (9); GM `view.player` (7.3) is later; none is built in M3. Wire changes for M4/M5/M6 are limited to what 6.5 marks.
|
||||
- **Not in M3:** `act.do` is reserved (v1 answers `no-rules`); server -> client `event` is reserved (9); GM `view.player` (7.3) is later; `marker` and the new wall fields plus `proto` 2 are M4's (6.2, #49); none of these is built in M3. Wire changes for M4/M5/M6 are limited to what 6.5 marks.
|
||||
- **Slice-3 rollout note [FIXED (owner-delegated), #18].** The catalogue below is the contract; the handlers land slice by slice. Until a slice lands, its intents still get exactly one `ack` with the static code `unknown-type` and no state, so a half-built server never lies about having applied anything. Slice 3 builds the envelope, `hello`, `error`, `closing`, `conn.ping`, `act.do` (`no-rules`), and the three auth intents of slice 2 (`key.create`, `key.replace`, `player.remove`). Slice 4 (#19) builds `wall.add`, `wall.update`, `wall.remove` and `door.set`, plus the `walls` snapshot a GM gets on connect; everything else still answers `unknown-type`. Slice 10 (#25) builds `scene.set`: with it every one of the 29 catalogue intents has a handler, and `unknown-type` remains only the answer for a `t` outside the catalogue.
|
||||
|
||||
### 6.1 Catalogue
|
||||
@@ -504,12 +520,12 @@ 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"|"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.add` | `scene, a:[x,y], b:[x,y]`; geometry `thickness?` (px, 0..256, default 0), `position?` (`center|left|right`, default `center`), `height?` (metres, `>0`..`<=100`, `null`/absent = full height); 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, thickness, position, height (null = full height)`, a preset name or the raw switches, `label` (`null` clears), `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, 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).
|
||||
Validation for `wall.*`: `a != b`, both in bounds; `thickness` a finite number `0 <= t <= 256`; `position` one of `center|left|right`; `height` a finite number `> 0` and `<= 100` or `null`; 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, or `null`; `preset` is `wall|door|window|one_way` and never with a raw switch in the same payload (5.8, #48). **One expand-and-validate path [FIXED (owner-delegated), 2026-11-17, #49]:** `wall.add`, `wall.update` and the M6 UVTT importer build the same candidate (geometry + expanded switches + label) and run the same validation function; a preset is expanded before validation and sets only switches, never `thickness`, `position` or `height` (#50).
|
||||
|
||||
**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`.
|
||||
@@ -517,12 +533,15 @@ Validation for `wall.*`: `a != b`, both in bounds; each switch a boolean and `si
|
||||
- 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.
|
||||
- `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 **and the wall derives `window`** (5.8: a solid wall with the switch on sends nothing); 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`), `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.
|
||||
- `wall.update` patches `a`, `b`, `thickness`, `position`, `height`, the switches (or one `preset`), `label` and `flags`; at least one of them is required, otherwise `invalid`. A patch is absolute, not additive: everything named is set to the value given (`null` clears `height` and `label`), and 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 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.
|
||||
- `thickness`, `position` and `height` are the wall's geometry fields and are typed, validated server-side, and never live in `flags` (5.10, 5.7). `thickness` is a finite number in px `0 <= t <= 256` (absent/default `0`, the drawn line); `position` is one of `center|left|right` (absent/default `center`); `height` is metres, a finite number `> 0` and `<= 100`, and **absent or `null` means full height** (5.7, #49). A preset never implies or resets them: `wall.add {preset:"door", thickness:20, position:"left"}` is legal, and a `wall.update {preset:"window"}` on a thick wall keeps the thick body. `height:null` in `wall.update` restores full height; `height` absent leaves it alone.
|
||||
- **Preset or raw switches, and what a patch replaces [FIXED (owner-delegated), 2026-11-17, #49].** A payload carries `preset` or raw switches, never both (`player_marker` counts as a raw switch). `preset` replaces the **whole** switch set with its expansion, exactly as before. A raw-switch payload on `wall.add` leaves every switch it omits at the `wall` preset default; on `wall.update` it patches **only** the switches present, so `{player_marker:false}` is how a GM turns off the `window` preset's marker without restating the switches, and `{door:true, open:true}` on a fixed window turns it into a closed opening window.
|
||||
- `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). **No sender may rely on that** — an old client's `{"kind":"door"}` would silently create a solid wall — which is why the field set changes with `proto` 2 (6.2). Storage, field names, defaults and the existing-row migration are 8 and 4.4; the rule here is that the switches are the authority and the label is derived.
|
||||
- **Storage [FIXED (owner-delegated), 2026-11-17, #49].** Every field above is a typed column on `wall` with CHECK constraints (8, 4.4 step 8); `flags` stays a JSON object for GM data the server never interprets. The wire names and the column names are identical, and booleans are `0`/`1` in storage.
|
||||
- **The M6 UVTT importer uses this same path [FIXED (owner-delegated), 2026-11-17, #49].** UVTT expresses only sight lines and `closed` (#40), so an imported wall is `thickness:0, position:"center", blocks_sight:true, blocks_movement:true, sight_dir:"both", player_marker:false, height:null, label:null`; a portal imports as `door:true` with `open = not closed`, everything else as `door:false, open:false`; `secret`/`locked`/`flags` stay off/`{}` and no marker is written. No ticket: the M6 import CLI carries it.
|
||||
- `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.
|
||||
|
||||
@@ -617,8 +636,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, 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 |
|
||||
| `walls` | `scene, walls:[{id, a, b, thickness, position, height, kind, blocks_sight, blocks_movement, sight_dir, player_marker, door, open, secret, locked, label, flags}]`; `kind` is the derived 5.8 label; `height` and `label` are always present, `null` when unset (GM-only frame, so presence marks nothing) | GM, on connect and resync (6.3) |
|
||||
| `wall` | `scene, id, a, b, thickness, position, height, kind, blocks_sight, blocks_movement, sight_dir, player_marker, door, open, secret, locked, label, flags` (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 |
|
||||
@@ -628,18 +647,20 @@ All are built per recipient at egress (single egress rule, 2). "Sent" always mea
|
||||
| `character_gone` | `id` | GM; and the previous owner on reassign |
|
||||
| `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 |
|
||||
| `marker` | `full:bool, set:[{id, pos}], del:[id]`; `id` an opaque per-player 12-char string (never the wall id), `pos` integer px (the wall's drawn midpoint, rounded once); `full:true` replaces the whole set on connect/resync; a diff carries additions in `set` and retractions in `del`, never both for one id | player only, own markers only; **never the GM** (a player's markers are their own memory, like `explored`; 3.1, 5.8) |
|
||||
|
||||
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).
|
||||
Count: 16 server messages (15 M3 + `marker`, 6.2 `proto` 2). Reserved, not built: `event` (9). The player marker of 5.8 (#48/#49) is the only player-bound wall frame.
|
||||
|
||||
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.
|
||||
|
||||
### 6.2 Versioning [PROPOSED]
|
||||
- `proto` is an integer compiled into both client and server; M3 ships `proto = 1`. The client announces it in the upgrade request (`/ws?proto=N`), and the parameter is required: absent or not a plain integer is HTTP 400, no upgrade (6.5 row 3). Any mismatch, older or newer, is refused (6.5 row 5): the upgrade completes and the server sends `closing {reason:"proto-mismatch", code:4003}` and closes, because a browser `WebSocket` cannot read an HTTP status, only a close code (and the code itself cannot be sent at the mummy pin, 3.2). The client then shows "reload" (assets are content-hashed by Vite, so a reload fetches the matching client). No `hello` and no state are sent on a mismatch. `hello.proto` is checked again on receipt as a backstop.
|
||||
- `proto` is an integer compiled into both client and server. `proto = 1` is M3 as shipped. **`proto = 2` is the wall-model build [FIXED (owner decision), 2026-11-17, #49]**: `wall.add`/`wall.update` take `thickness`, `position`, `height`, `label` and the typed switches/`preset` instead of `kind`, `walls`/`wall` carry `height`, and the `marker` message exists. This is breaking because an old client sends `{"kind":"door"}` and the server, which ignores unknown fields, would silently create a solid wall; nothing else in the catalogue changes. The client announces it in the upgrade request (`/ws?proto=N`), and the parameter is required: absent or not a plain integer is HTTP 400, no upgrade (6.5 row 3). Any mismatch, older or newer, is refused (6.5 row 5): the upgrade completes and the server sends `closing {reason:"proto-mismatch", code:4003}` and closes, because a browser `WebSocket` cannot read an HTTP status, only a close code (and the code itself cannot be sent at the mummy pin, 3.2). The client then shows "reload" (assets are content-hashed by Vite, so a reload fetches the matching client). No `hello` and no state are sent on a mismatch. `hello.proto` is checked again on receipt as a backstop.
|
||||
- Within one proto version: additive only (new optional fields, new message types). The client ignores unknown server message types and unknown fields; the server ignores unknown fields in intents and answers an unknown `t` with `ack {ok:false, code:"unknown-type"}` (or `error {code:"malformed"}` if there is no `reqId`).
|
||||
- Breaking change -> bump `proto`, document in `docs/` changelog.
|
||||
- **Proto history.** `1` (M3, 2026-11-15): 29 intents, 15 server messages, `wall` records as `kind` + `open` + `flags`. `2` (#49, 2026-11-17): the wall record's typed fields (`thickness`, `position`, `height`, `label`, `player_marker`, the eight switches), `kind` output-only, and the player `marker` message; the same build ships migration step 8, so a `proto` 1 client and a migrated DB cannot be paired by accident.
|
||||
|
||||
### 6.3 Reconnect and resync
|
||||
- Reconnect = full resync. After `hello` the server sends, in this order: `roster`; GM: `walls`, `character` for all, `encountered` per player (full), then `token` for all; player: `character` for owned, `encountered` (full), `vision`, `explored` (full), then `token` for all visible and controlled. Slice 4 sends the `walls` part: one frame to every GM connection immediately after `hello` (players never get one). Slice 5 sends the token half of the sequence: the GM's `token` for every token, and for a named player `vision`, `explored` (full) then `token` for every token it may see or control. Slice 6 built the explored restore, and slice 8 (#23) completes the sequence: `roster`, `character` and `encountered` are sent in the order above, and a sighting is recorded before the list is built, so a token that walked into an offline player's sight is in their `encountered` list on the next connect. An unnamed player gets only `hello` until `player.setname` succeeds, which triggers the same sequence on that connection. The client reducer resets everything on `hello` (reconnect-reset bug fixed in prototype, test in `client/src/state.test.ts`, 4/4 pass) [MEASURED]. Clients must tolerate any order after `hello`.
|
||||
- Reconnect = full resync. After `hello` the server sends, in this order: `roster`; GM: `walls`, `character` for all, `encountered` per player (full), then `token` for all; player: `character` for owned, `encountered` (full), `vision`, `explored` (full), `marker` (full), then `token` for all visible and controlled. **`marker` sits after `explored` because it is the same kind of state [FIXED (owner-delegated), 2026-11-17, #49]:** it is that player's persisted memory, restored at startup with the explored chunks (`marker_seen`, 4.4, 8), and the client draws it over the fog the `explored` frame has just rebuilt. The GM sequence does not change: no `marker` frame is ever sent to the GM (3.1, 6.1). Slice 4 sends the `walls` part: one frame to every GM connection immediately after `hello` (players never get one). Slice 5 sends the token half of the sequence: the GM's `token` for every token, and for a named player `vision`, `explored` (full) then `token` for every token it may see or control. Slice 6 built the explored restore, and slice 8 (#23) completes the sequence: `roster`, `character` and `encountered` are sent in the order above, and a sighting is recorded before the list is built, so a token that walked into an offline player's sight is in their `encountered` list on the next connect. An unnamed player gets only `hello` until `player.setname` succeeds, which triggers the same sequence on that connection. The client reducer resets everything on `hello` (reconnect-reset bug fixed in prototype, test in `client/src/state.test.ts`, 4/4 pass) [MEASURED]. Clients must tolerate any order after `hello`.
|
||||
- No gap detection and no `resume(since)`: WS over TCP is ordered and lossless while connected, and a reconnect restarts from a full snapshot. Full resync on every reconnect [FIXED, Q15]. Revisit if a measured snapshot exceeds ~100 KB.
|
||||
- Client reconnect: exponential backoff with jitter, cap ~10 s (prototype: fixed 2 s). Pending `reqId`s are dropped with the old connection (client-side, M4); a `hello` on a live connection (`scene.set`, first name) does **not** drop them: their acks still arrive. Assets (tiles) are kept across reconnect because explored only grows [MEASURED prototype behaviour].
|
||||
- Same player on two connections: both synced; each has its own `known` table. Multiple devices per player allowed (Q10, FIXED), up to 4 (4.3).
|
||||
@@ -766,7 +787,10 @@ Prototype `client/src/main.ts`: explored rects appended to a `Graphics` mask for
|
||||
All ids are server-assigned. **Walls [FIXED, owner decision 2026-11-10, #3]**: per-scene ids, each scene counts from 1. Removal never renumbers; ids are never reused. Each scene stores `next_wall_id` (monotonic, never decreases, even if the newest wall is deleted). 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')`, `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. **A door's leaf is this same body** [FIXED, 2026-11-17, #50]: opening and closing change only `open`, never the geometry, and a door stores no leaf field of its own (5.8, 5.5). **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).
|
||||
- **Wall [FIXED, owner decision 2026-11-15, #42; fields, storage and migration 2026-11-17, #49]**: `scene, id` (per-scene, see above), `a:[x,y], b:[x,y]`, the geometry `thickness` (px, 0..256, default 0 = the drawn line), `position` (`center|left|right`, default `center`; 5.10) and `height` (metres, optional, `> 0` and `<= 100`, absent = full height; 5.7), 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, 1..64 code points, 5.8 #48) and the free `flags`. Behaviour comes from the switches (5.8); `blocks = blocks_movement and not (door and open)`; a window (`blocks_sight:false`) is absent from the sight input. `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: the legacy `kind` column is dropped by migration step 8 (4.4). GM-only everywhere except the player marker: a player receives only an integer-px anchor and its own opaque marker id (3.1, 5.8, 6.1), and the per-player marker set is state like the explored grid (persisted per player in `marker_seen` below, retracted only by a GM change).
|
||||
- **Storage: typed columns, not one JSON object [FIXED (owner-delegated), 2026-11-17, #49].** One column per field listed above, with CHECK constraints for the invariants the wire enforces (`open`/`secret`/`locked` require `door`; a secret door is closed, two-way and opaque; a `sight_dir` other than `both` requires `blocks_sight`), so the store cannot hold a switch set the server would refuse. `flags` stays a JSON object for GM data the server never interprets. *Why columns:* the precedent is columns for everything the server reads (`scene`, `entity.radius`, `vision_radius`, `gm_only`) while `flags` and `props_*` exist for data it never reads; CHECKs can reject an impossible switch set, which a JSON blob cannot without triggers; `loadScene` reads a row straight into the typed `WallRec`, with no second parse-and-validate path at startup beside the wire's own; and the switch set is closed in v1, so a new axis is a schema step either way. 5.8's "one object" is about the domain and the wire; the columns are how that one object is stored. `height` and `label` are nullable and are written as SQL literals because db_connector cannot bind NULL (4.4).
|
||||
- **Marker storage: `marker_seen` [FIXED (owner-delegated), 2026-11-17, #49].** `marker_seen(player_id INTEGER NOT NULL REFERENCES player(id) ON DELETE CASCADE, scene_id INTEGER NOT NULL, wall_id INTEGER NOT NULL, marker_id TEXT NOT NULL, PRIMARY KEY (player_id, scene_id, wall_id), UNIQUE (player_id, marker_id), FOREIGN KEY (scene_id, wall_id) REFERENCES wall(scene_id, id) ON DELETE CASCADE)`. One row per `(player, wall)` once seen; `marker_id` is the opaque per-player 12-character id on the wire. Cascades mirror explored/`name_reveal`: a removed player takes their markers, a removed scene takes them through its walls, and a removed wall retracts its marker for everyone (5.8's retraction rule; the composite FK is why a marker can never dangle). The other retraction causes (`player_marker` off, no longer a window, geometry moved) are a deliberate delete in the update path, not an FK.
|
||||
- **Migration [FIXED (owner decision), 2026-11-17, #49].** Step 8 (4.4) rebuilds `wall` and maps every existing row to today's behaviour exactly: `thickness 0`, `position center`, `blocks_sight`/`blocks_movement` 1, `sight_dir both`, `player_marker` 0, `secret`/`locked` 0, `height` NULL, `label` NULL; `kind='door'` becomes `door=1` with the same `open`, `kind='wall'` becomes `door=0` with `open=0`. Every existing token and character gets `height: 1.8 m` in `props_gm` (5.7). The M6 UVTT importer's defaults are in 6.1. #45's "existing walls get `0`/`center`" and #41's "existing walls carry no height" are the same rows under this step. A door stores no leaf field of its own: its leaf is this same body (5.8, 5.5).
|
||||
- **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].
|
||||
@@ -829,9 +853,14 @@ Principles carried from the prototype: the checker must be independent of the co
|
||||
- **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` 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 push with thickness (#50)**: in-process pins in `tests/tmoverules.nim` (5.5). **Zero-thickness regression gate:** the existing push tests run **unchanged** and keep their exact positions (including "past the end", where the along-axis coordinate does not move), so a zero-thickness door's `pushFrom` must return byte-identical values to today's — no expectation may be rewritten to fit the generalised rule. **Thick cases:** a token beside a long face is pushed off the body face by `r` with its along-axis coordinate kept; a token past an end is pushed to `r` around the nearest end corner with its along-axis coordinate kept; a token inside the body is pushed out of its `prev` side (left with no history); the first side's target overlapping another blocking body or leaving the map falls back to the other side, and both invalid leaves the token in place with `squeezed` while the door closes; the validity check runs over the full collider, so a neighbouring thick body or the thick closed door itself refuses a target the old segment test would have accepted; `position` `left`/`right` move the body, and with it the pushed target, by the thickness. **Equivalence:** the #46 two-server test (T17) gains thick pairs — a thick secret door against a thick solid wall of the same body, and a thick locked door against a thick plain door — with byte-identical player frames, statuses, refusals and per-tile statuses. Also pinned: a fixed window (`door:false`) and an open door never push, and neither does any wall edit. **Mutations:** the push measured from the drawn line instead of the body; the push ignoring the body's normal span; the ambiguous side ignoring `prev`; the validity check testing only the door instead of every blocking body. Each must fail >= 1 test.
|
||||
- **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).
|
||||
- **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 `thickness`, `position`, `height`, `player_marker` and `label` (#49's names, 10.3 below) — so a door or wall field 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; `height` is safe: it is a `gm`-bucket key, 5.7).
|
||||
- **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.
|
||||
- **Player marker (#48; shape fixed by #49)**: the first wall-derived player data, so it gets its own oracle. The frame is `marker {full:bool, set:[{id, pos}], del:[id]}` (6.1), `pos` integer px, `id` a 12-character per-player string that is never a wall id; `tools/leakcheck.nim` must add `"marker"` to its allowed server types, compute 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** the wall is `player_marker:true` and derives `window`, and check 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, a `player_marker:false` wall or a solid wall with the switch on yields none. The `BannedAlways` deep-key scan grows `label`, `player_marker`, `thickness`, `position` and `height` 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.
|
||||
- **Wall fields, storage and migration (#49)**: the record's new surface gets three gates (leak, migration, behaviour) plus a fixture list; the assertions land with the build tickets (/to-spec), not here.
|
||||
- **Leak gate.** `tools/leakcheck.nim`'s `BannedAlways` grows every wall field name — `thickness`, `position`, `height`, `blocks_sight`, `blocks_movement`, `sight_dir`, `player_marker`, `door`, `open`, `secret`, `locked`, `label`, `a`, `b` — so any of them in a player frame is `WALLDATA`; `marker` joins the allowed server types and its oracle above applies. Positive control: the same scene with one wall's `height` injected into a player `token` frame fails with exactly `WALLDATA`.
|
||||
- **Migration gate.** A **schema-7 fixture** (pre-#49: `wall` rows of both `kind`s including an open door and a non-empty `flags`, tokens and a character with props) migrates under the real binary to schema 8, and the decoded rows must equal the mapping exactly: `thickness 0`, `position center`, both block switches 1, `sight_dir both`, `player_marker`/`secret`/`locked` 0, `height`/`label` NULL, `door` from `kind` with the same `open`, `flags` byte-identical; `props_gm` has `height: 1.8` on every token and character and `eye_height` is untouched. A second run is a no-op (`migrate` returns 0), and a failing step rolls back completely (existing `tdb` checks).
|
||||
- **Behaviour-preservation gate.** Because the project has no real user data (pre-M4), correctness is proven on the wire, not on rows: one scene created through `wall.add` with today's switch set (`wall`, closed `door`, open `door`) and one migrated schema-7 scene holding the same walls must produce **byte-identical player frames, refusals and per-tile statuses** for the same scripted session — the #46 two-server harness with the migration as the third arm, same canonicalisation and no normalisation. The #50 zero-thickness push tests stay unchanged and must pass against the migrated rows, and the 5.8 rule that a player frame carries no wall fact is the leak gate above.
|
||||
- **Fixture churn (build tickets).** `tests/tdb.nim`: `LatestVersion == 7` -> `8`, the "steps 3 to 7" count -> "3 to 8", the newer-DB fixture stays above the latest. `tools/persistence.test.mjs`: the schema-4 fixture's assertion `schema_version=7 applied=3` -> `schema_version=8 applied=4`, plus the new schema-7 fixture and its mapping assertions. `server/world.nim` (`WallRec`, `rowToWall`, `insertRow`/`replaceRow`, `WallPatch`, the parsers), `server/worldmap.nim` (`ruleWall` reads switches, not `kind`), `server/views.nim` and `tests/tworld.nim`, `tests/tviews.nim`, `tests/tokens.nim`, `tests/tcharacters.nim`, `tools/walls.test.mjs`, `tokens.test.mjs`, `details.test.mjs`, `scene.test.mjs`, `restart.test.mjs`, `walls.test.mjs`, `doors.test.mjs` and the leak/fault fixtures all gain the new fields, the `marker` message or the height backfill; any test that builds a `wall` row by hand gains the columns.
|
||||
- **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).
|
||||
@@ -1068,3 +1097,5 @@ Owner also decided 2026-11-16 [FIXED (owner decision), 2026-11-16, #47]: windows
|
||||
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.
|
||||
|
||||
Owner also decided 2026-11-17 [FIXED (owner decision), 2026-11-17, #50]: door geometry. (1) **The door leaf is the wall's own body** [FIXED (owner decision)]: a door is a wall like any other, and its leaf is the 5.10 body rectangle with the same `thickness` and `position` fields — no separate leaf inside a deep opening, no clamp to the neighbouring pieces. The jambs are ordinary walls, so the doorway is the gap between wall pieces. A thick door bulges out of its doorway or leaves a step behind the jambs, exactly as drawn (authoring, not a rule), and a deep opening between thick jambs keeps the tunnel/keyhole view accepted in #43. Opening and closing add and remove that body and nothing else: no swing, no slide, no hinge, no arc, and an open door is absent from sight and movement as today. (2) **The close push** [FIXED (owner decision)]: each token whose centre is within `r` of the door's **body** is pushed out of the side its centre is on, by the minimal distance that ends `>= r` from the body (+ `PushEps`); a centre inside the body takes the side of `prev` (its position before the most recent move or push), and the left side of `a -> b` when that is undetermined; if the first side's position is invalid (out of bounds or within `r` of any blocking body) the other side is tried; if both are invalid the token stays and gets `squeezed`, and the door still closes. No axial slide, no chain, no retry. Each token is pushed independently, tokens never block tokens, and scene order only rewrites `prev`. Edits never push (5.10) and height never enters (5.9). (3) **Delegated and picked** [FIXED (owner-delegated)]: within the body's axial span the target is the face offset by `r`; past an end it is the offset from the nearest end corner **keeping the along-axis coordinate**, i.e. today's `foot + n·sqrt(r^2 - e^2)` generalised to the end face — a radial displacement from the corner was rejected because it also moves the token along the axis and would break the zero-thickness gate. A centre "inside the body" for the side test means inside the body or past an end but within the body's normal span, which reduces to today's centre-on-the-line test at zero thickness. The target and the validity check use the same rectangle-distance primitive as the collider (other thick bodies included), and `PushEps` = 1e-6 px is reused. **Zero thickness must return byte-identical values to today's `pushFrom` on the same inputs**, and the existing push tests are the regression gate, unchanged (10.3). (4) **Settled consequences** [FIXED (owner decision)]: a locked door and an opening window push exactly like a plain closed door; a fixed window (`door:false`) never closes, so it never pushes; a secret door pushes exactly as a solid wall, so #46's equivalence holds for thick doors too; the independent-per-token, no-token-collision, `prev`-rewriting order rule above is final and not a later "fix". (5) **Downstream**: #49 needs **no new wire field for doors** — the leaf is the existing `thickness`/`position` body and the existing switch set, and an open door changes no geometry, only `open`. See 5.4, 5.5, 5.8, 5.10, 10.3.
|
||||
|
||||
Owner also decided 2026-11-17 [FIXED (owner decision), 2026-11-17, #49]: the wall record's wire format, storage and migration. (1) **Wall height is a typed wall field** [FIXED (owner decision)]: metres, optional, `> 0` and `<= 100`, absent/`null` = full height; GM-only, carried on the GM `wall`/`walls` frames and never on a player frame (`WALLDATA`). This resolves the old contradiction — 5.7's "no dedicated column and no wire field" (narrowed there with a dated tag to tokens and characters, which have `props` buckets; a wall has none), 6.1's wall frames (which already carried the other fields) and 5.8's "no behaviour in `flags`". The property registry is unchanged: still `height` and `eye_height` for tokens and characters. (2) **Migration** [FIXED (owner decision)]: every existing token and character gets `height: 1.8 m` in `props_gm` (the 93 % eye rule is unchanged and `eye_height` is not written); every existing wall migrates to today's behaviour exactly — `thickness 0`, `position center`, `blocks_sight`/`blocks_movement` 1, `sight_dir both`, `player_marker` 0, `label` NULL, `height` NULL, `secret`/`locked` 0, `kind='door'` -> `door=1` with the same `open`, `kind='wall'` -> `door=0`. No real user data exists (pre-M4), so correctness is fixture/history hygiene plus byte-identical behaviour gates (5.8 player frames, #50 zero-thickness push). (3) **Storage: typed columns with CHECK constraints** [FIXED (owner-delegated)]: one column per field, CHECKs for the switch invariants, `flags` kept for uninterpreted GM data; chosen by precedent (interpreted data is always a column, `flags`/`props_*` are for unread data), because CHECKs can reject an impossible switch set, and because `loadScene` then has no second parse/validate path. 5.8's "one object" is the domain/wire object; the columns are its storage. (4) **Migration step 8, forward-only** [FIXED (owner-delegated)]: the `Migration` entry gains a `data` hook for the height backfill; the `wall` table is rebuilt and the legacy `kind` column is **dropped** (`kind` is output-only derived); the rebuild is preferred to `ALTER TABLE ... DROP COLUMN` because it must drop `kind` and add six NOT NULL CHECKed columns atomically and SQLite refuses to drop a column named in a CHECK. (5) **Wire** [FIXED (owner-delegated)]: `wall.add`/`wall.update` carry `thickness`, `position`, `height`, `label` and the switches; a preset XOR raw switches, raw switches patch only what is present, a preset replaces the whole switch set, and a preset never implies geometry; `wall.update` stays absolute and `door.set` unchanged; add, update and the M6 UVTT importer share one expand-and-validate path; `walls`/`wall` gain `height` and keep the derived `kind`. (6) **`proto` 2** [FIXED (owner decision)]: the input `kind` disappears and an old client's `{"kind":"door"}` would silently create a solid wall, so the version goes up with a 6.2 changelog line; `marker` is the one new server message. (7) **The `marker` message** [FIXED (owner-delegated)]: `{full:bool, set:[{id,pos}], del:[id]}`, mirroring `encountered`; `pos` is the drawn midpoint in integer px; `id` is an opaque per-player 12-character string, never the wall id; emission needs `player_marker` on **and** the wall deriving `window`; the full set goes after `explored` in the 6.3 player order; the GM never receives marker frames (a player's markers are their own memory, like explored); storage is `marker_seen` with cascades on player and wall (and through the scene via the wall). (8) **Label NULL** [FIXED (owner-delegated)]: `label` and `height` are written as SQL literals (`NULL` when absent) by one helper, because db_connector cannot bind NULL and neither `''` nor `0` is a legal value, unlike `encountered.actual_name`'s `''`. (9) **UVTT importer** [FIXED (owner-delegated)]: `thickness 0`, `center`, both blocks on, `sight_dir both`, `player_marker` false, no label/height; a portal is `door:true, open = not closed`; recorded in 6.1/8, no ticket. (10) **Oracles and tests**: `BannedAlways` gains every wall field name and `marker` joins the allowed types; the marker oracle's shape is fixed; the migration gets a schema-7 fixture, the mapping assertions and a byte-identical behaviour gate against a freshly built scene (10.3). See 3.1, 4.4, 5.7, 5.8, 5.9, 5.10, 6.1, 6.2, 6.3, 8, 10.3.
|
||||
|
||||
Reference in New Issue
Block a user