design: height model for tokens, eyes and walls (#41)
This commit is contained in:
+11
-3
@@ -5,9 +5,17 @@ A browser virtual tabletop for one table: the GM and players share a map with wa
|
||||
## Language
|
||||
|
||||
**Token size**:
|
||||
How big a token is on the map, as a radius in map pixels. A token uses its own size if one is set, otherwise the scene's default size.
|
||||
How big a token is on the map, as a radius in map pixels. A token uses its own size if one is set, otherwise the scene's default size. This is its footprint on the map, not how tall the figure is (see Height).
|
||||
_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.
|
||||
_Avoid_: elevation, z, altitude (those are position above the ground)
|
||||
|
||||
**Eye height**:
|
||||
How high a figure's eyes are, in metres. Follows the same rule as Height: a character value with an optional token override. Unless someone sets it by hand it is 93% of the figure's height and follows any change to that height; it may also be higher than the figure itself (a floating eye).
|
||||
_Avoid_: eye level, vision height
|
||||
|
||||
**Stuck**:
|
||||
A lock condition meaning the token is held in place: a wall runs through it, or something holds it (ropes, a magic grasp). A player cannot move a stuck token; the GM always can.
|
||||
_Avoid_: blocked
|
||||
@@ -43,11 +51,11 @@ 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. In v1 a wall has zero thickness and full height, so it hides exactly the points behind it, including those on a line with the viewer; per-wall thickness and height (low walls one can see over) are pending (#37).
|
||||
A barrier on the map with a length, a thickness and a height. It hides what its dimensions hide. 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. In v1 a wall has zero thickness; per-wall thickness and the wall kinds are pending (map #38).
|
||||
_Avoid_: blocker, collider, obstacle, sight blocker
|
||||
|
||||
**Property**:
|
||||
One named value a token carries, e.g. "aura" or "hp". The server stores it and never interprets it in v1; FFF does later.
|
||||
One named value a token carries, e.g. "aura" or "hp". The server stores it and does not interpret it in v1, apart from the few sight keys it reads itself (see Height and Eye height); FFF does the rest later.
|
||||
_Avoid_: attribute, stat, metadata
|
||||
|
||||
**Property bucket**:
|
||||
|
||||
+25
-10
@@ -1,6 +1,6 @@
|
||||
# FFF_vtt design
|
||||
|
||||
Status: draft v0.20, 2026-11-15 (owner decisions recorded in section 14; v0.4 records Q4 (tile_size 32 px), the outbox lock invariant (4.2, 4.3), and the follow-ups in 3.4, 8, 11.1, 12, 13; v0.5 records the M2 move-rule decisions in 5.5 and updates 3.4, 4.2, 5.1, 5.4, 6.1, 7.4, 8, 10.3, 12, 13; v0.6 records #14 (characters and player data) in 3.1, 3.4, 4.1, 4.4, 6.1, 8, 9, 10.3, 13, 14; v0.7 records #6 (players and invites) in 3.1, 3.2, 3.4, 4.4, 6.1, 8, 12, 13, 14; v0.8 records #7 (map tiles) in 3.3, 3.4, 11.1, 13, 14; v0.9 records #9 (test tools) in 2, 10.4, 13, 14; v0.10 records #12 (what M3 done means) in 13, 14; v0.11 records #15 (M3 limits) in 4.3, 6.4, 10.1, 13, 14; v0.12 records #11 (M3 message list) in 3.1, 3.2, 3.4, 4.2, 4.3, 5.5, 5.6, 6, 7.5, 13, 14; v0.13 records the owner review of #11 flags in 1, 3.1, 5.5, 6.1, 8, 14; v0.14 records #17 (getting in: keys, sessions, the auth slice) in 3.2, 4.4, 6.5, 6.6, 8, 11.1, 13, 14; v0.15 records #18 (talking safely: the protocol shell and the `closing` close-reason message) in 3.2, 4.3, 6, 6.1, 6.2, 6.4, 6.5, 10.3, 13, 14; v0.16 records #19 (walls and doors: the scene/wall schema, the wall payload rules and the slice-4 rollout) in 4.4, 6.1, 8, 13, 14; v0.17 records #20 (tokens and sight: the `entity` step, the typed views and the single egress, vision and explored, and the slice-5 rollout) in 4.4, 6.1, 6.3, 8, 10.3, 13, 14; v0.18 records #23 (characters and names: the `character`/`name_reveal`/`encountered` step, the name rule, the players' names and the `roster` frame, and the four name/character fault classes) in 4.1, 4.4, 6.1, 6.3, 6.4, 6.5, 8, 10.3, 13, 14; v0.19 records the owner confirmation of the #22 property-schema registry (keep the empty registry with the permissive fallback in v1; strict mode comes with the FFF seam, post-v1) in 6.1, 14; v0.20 records the #27-#31 correctness and cost fixes (per-player reveal persistence, one encountered rewrite path, link-by-update, the borrowed egress context, one scene read per request) in 4.3, 6.1, 10.3, 14. All of Q1-Q24 are RESOLVED or DEFERRED; none OPEN). Audience: the owner and coding agents.
|
||||
Status: draft v0.21, 2026-11-15 (owner decisions recorded in section 14; v0.4 records Q4 (tile_size 32 px), the outbox lock invariant (4.2, 4.3), and the follow-ups in 3.4, 8, 11.1, 12, 13; v0.5 records the M2 move-rule decisions in 5.5 and updates 3.4, 4.2, 5.1, 5.4, 6.1, 7.4, 8, 10.3, 12, 13; v0.6 records #14 (characters and player data) in 3.1, 3.4, 4.1, 4.4, 6.1, 8, 9, 10.3, 13, 14; v0.7 records #6 (players and invites) in 3.1, 3.2, 3.4, 4.4, 6.1, 8, 12, 13, 14; v0.8 records #7 (map tiles) in 3.3, 3.4, 11.1, 13, 14; v0.9 records #9 (test tools) in 2, 10.4, 13, 14; v0.10 records #12 (what M3 done means) in 13, 14; v0.11 records #15 (M3 limits) in 4.3, 6.4, 10.1, 13, 14; v0.12 records #11 (M3 message list) in 3.1, 3.2, 3.4, 4.2, 4.3, 5.5, 5.6, 6, 7.5, 13, 14; v0.13 records the owner review of #11 flags in 1, 3.1, 5.5, 6.1, 8, 14; v0.14 records #17 (getting in: keys, sessions, the auth slice) in 3.2, 4.4, 6.5, 6.6, 8, 11.1, 13, 14; v0.15 records #18 (talking safely: the protocol shell and the `closing` close-reason message) in 3.2, 4.3, 6, 6.1, 6.2, 6.4, 6.5, 10.3, 13, 14; v0.16 records #19 (walls and doors: the scene/wall schema, the wall payload rules and the slice-4 rollout) in 4.4, 6.1, 8, 13, 14; v0.17 records #20 (tokens and sight: the `entity` step, the typed views and the single egress, vision and explored, and the slice-5 rollout) in 4.4, 6.1, 6.3, 8, 10.3, 13, 14; v0.18 records #23 (characters and names: the `character`/`name_reveal`/`encountered` step, the name rule, the players' names and the `roster` frame, and the four name/character fault classes) in 4.1, 4.4, 6.1, 6.3, 6.4, 6.5, 8, 10.3, 13, 14; v0.19 records the owner confirmation of the #22 property-schema registry (keep the empty registry with the permissive fallback in v1; strict mode comes with the FFF seam, post-v1) in 6.1, 14; v0.20 records the #27-#31 correctness and cost fixes (per-player reveal persistence, one encountered rewrite path, link-by-update, the borrowed egress context, one scene read per request) in 4.3, 6.1, 10.3, 14; v0.21 records #41 (the height model: metres, `height` and `eye_height` as GM-only registered props with a token override, eye height 93% by default, walls full height unless the GM gives a height) in 5.7, 6.1, 8, 9, 14. 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.
|
||||
@@ -358,6 +358,19 @@ Notation: token centre `c`, radius `r` (entity `radius` if set, else scene `toke
|
||||
- **Grow fails** (no valid position): the token stays (its graphic may overlap walls) and gets `squeezed` (source `walls`).
|
||||
- Wire intents: `token.resize`, `status.set`, `status.clear` (6.1) [FIXED (owner-delegated, 2026-11-14, #11)].
|
||||
|
||||
### 5.7 Heights [FIXED (owner decision), 2026-11-15, #41]
|
||||
What the vertical dimension is made of, and in what unit. Vision only: what a low wall does to sight is #44, thickness is #45, the wall kinds are #42, the wire and migration are #49.
|
||||
- **Unit: metres, decimal.** Map distances stay px and no map scale is introduced: see-over compares heights with heights, so no px -> m conversion exists anywhere [FIXED (owner decision), 2026-11-15, #41]. Research #39 3.3 needs only `h_eye` and `h_wall` for the hidden band behind a low wall (`d_floor = s * h_eye / (h_eye - h_wall)`), never a ground distance in metres.
|
||||
- **Height is a property, not a field.** `height` and `eye_height` live in the `gm` bucket of the three-bucket `props` (8), on the character or on the token; there is no dedicated column and no wire field of their own.
|
||||
- **Token height.** A character carries its base `height` (the character-sheet value). A plain token (no character) carries its own `height`, and `token.create` without one is refused `invalid` (`invalid`, not `not-found`: a missing field, 6.5). A linked token uses its character's `height` by default; it may carry its own `height` as a temporary on-map override (an enlarge spell doubling it) that never writes the character. Removing the override restores the character's value. **Effective token height** = the token's override, else the character's `height`, else the plain token's own `height`.
|
||||
- **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.
|
||||
- **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: whether the *target's* height matters for see-over (a giant's head over a fence) -> #44 "Low walls: sight and movement"; what height existing tokens and characters get at migration (`height` is required) -> #49 "Wall wire format, schema and migration".
|
||||
- Conflict note: section 1's non-goals (windows/transparent walls, one-way walls) and Q6's `wall`|`door` only are contradicted by the wall-model work. That is map #38's territory and is being settled there; this block fixes heights and units only, not kinds, thickness or what a low wall hides.
|
||||
|
||||
---
|
||||
|
||||
## 6. Protocol
|
||||
@@ -463,7 +476,7 @@ Validation for `wall.*`: `a != b`, both in bounds, `kind` in `wall|door`, `flags
|
||||
**Property payload rules [FIXED (owner-delegated, 2026-11-15, #22)]** (6.1 delegated the numbers to #11, #22 fixes them; module `server/props.nim`):
|
||||
- Buckets `public`|`owner`|`gm`; caps **64 keys per bucket**, key **1..64 code points** trimmed with no control characters (the name rule of 6.5), value **serialized JSON <= 8 KB**; a `null` value is not a value. Caps are per bucket: a full `public` bucket still leaves `owner` and `gm` writable.
|
||||
- `prop.set {target, id, bucket, key, value}` / `prop.unset {target, id, bucket, key}`; `target` is `token` or `character`; a bad target, bucket, key, value or cap is `invalid`, a missing token is `not-found`; `prop.unset` of an absent key is `ok`. `target:"character"` is `not-found` in M3 because characters do not exist before slice 8.
|
||||
- The **property-schema registry** (8, 9) is `key -> PropSchema{kind, bucket}` plus a fallback rule, shipped **empty with a permissive fallback** (`pkAny`, any bucket). DESIGN 8 says the server never interprets props in v1, so an unregistered key is accepted in any bucket; a key the rules module registers is enforced (JSON kind, bucket), and a write that disagrees is `invalid`. **[FIXED, owner decision 2026-11-15, #22]** (owner-confirmed as specified): keep the empty registry with the permissive fallback in v1; strict mode (every key must be registered) comes with the FFF seam, post-v1. Flipping the fallback to strict is a one-line change when FFF lands.
|
||||
- The **property-schema registry** (8, 9) is `key -> PropSchema{kind, bucket}` plus a fallback rule, shipped **empty with a permissive fallback** (`pkAny`, any bucket) — **[amended 2026-11-15, #41]**: no longer empty, its first two keys are `height` and `eye_height` (`number`, `gm`, 5.7), which the core sight rules read; every other key still falls back to `pkAny`. DESIGN 8 said the server never interprets props in v1 (narrowed by #41: only the registered keys the core sight rules use are interpreted), so an unregistered key is accepted in any bucket; a key the rules module registers is enforced (JSON kind, bucket), and a write that disagrees is `invalid`. **[FIXED, owner decision 2026-11-15, #22]** (owner-confirmed as specified): keep the permissive fallback in v1; strict mode (every key must be registered) comes with the FFF seam, post-v1. Flipping the fallback to strict is a one-line change when FFF lands.
|
||||
- Egress: the `public` bucket to everyone who sees the token, `owner` additionally to the controller, all three to the GM (6.1). The filter lives in the typed view: `PlayerTokenView` has no field for the `gm` bucket, so a later frame change cannot leak it.
|
||||
|
||||
**Grow push and squeeze [FIXED (owner-delegated, 2026-11-15, #22)]** (5.6's tie-break, now decided):
|
||||
@@ -663,13 +676,13 @@ 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/Door**: `scene, id` (per-scene, see above), `a:[x,y], b:[x,y], kind ('wall'|'door'), open:bool, flags`. `blocks = not (door and open)`. GM-only everywhere. Later kinds (window, one-way, secret door) are extra `kind`/`flags` values; v1 geometry treats any non-open blocker identically.
|
||||
- **Wall/Door**: `scene, id` (per-scene, see above), `a:[x,y], b:[x,y], kind ('wall'|'door'), open:bool, flags`. `blocks = not (door and open)`. GM-only everywhere. Later kinds (window, one-way, secret door) are extra `kind`/`flags` values; v1 geometry treats any non-open blocker identically. **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, hit rules and the kind set are map #38's; the wire and the migration are #49.
|
||||
- **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].
|
||||
- The server never interprets props in v1 except via a registered property schema (`{kind, bucket}`) used for validation and, later, by FFF. Property writes are GM-only in v1 (6.1, #11); the writable-by role and a default value are deferred to the FFF seam (9, post-v1), not part of this registry.
|
||||
- **Character [FIXED, owner decision 2026-11-10, #14]**: own record, separate from tokens. Fields (indicative): `id` (random, same format as token ids), `owner` (exactly one player id; the GM is a player, so GM ownership = the GM's player id; the GM reassigns), `descriptive_name`, `actual_name` (names rule below), `reveal_all`, `props` (three buckets, identity/base values). A character has any number of tokens in any scene. A new token for a character starts controlled by the character's owner; the GM may change it. Changing a character's owner never changes its tokens' controllers (GM adjusts by hand). Rejected: token controller derived from character; auto-follow on reassignment; all data on the token (duplicated stats); all data on the character.
|
||||
- **Character props vs token props [FIXED, #14]**: the character holds who the figure is (identity, base values); the token holds what is happening to that figure (damage, conditions, scene effects). Plain tokens (monsters, items) keep their own data. Both use the three buckets: `owner` for a character = character owner + GM; for a token = token controller + GM. The server stores both and never interprets them; FFF decides the split (9). A recipient's view of a token is built from its own props and its character's props, each under its own bucket rule [PROPOSED].
|
||||
- `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].
|
||||
- The server interprets only registered keys used by core sight rules: `height` and `eye_height` (5.7) are read by them and enforced as numbers in the `gm` bucket; every other key is stored and never interpreted (FFF later). Interpretation beyond that arrives only through a registered property schema (`{kind, bucket}`), which is also the validation table; before #41 this bullet said "the server never interprets props in v1". Property writes are GM-only in v1 (6.1, #11); the writable-by role and a default value are deferred to the FFF seam (9, post-v1), not part of this registry.
|
||||
- **Character [FIXED, owner decision 2026-11-10, #14]**: own record, separate from tokens. Fields (indicative): `id` (random, same format as token ids), `owner` (exactly one player id; the GM is a player, so GM ownership = the GM's player id; the GM reassigns), `descriptive_name`, `actual_name` (names rule below), `reveal_all`, `props` (three buckets, identity/base values; `height` and `eye_height` are the base values of 5.7, `gm` bucket). A character has any number of tokens in any scene. A new token for a character starts controlled by the character's owner; the GM may change it. Changing a character's owner never changes its tokens' controllers (GM adjusts by hand). Rejected: token controller derived from character; auto-follow on reassignment; all data on the token (duplicated stats); all data on the character.
|
||||
- **Character props vs token props [FIXED, #14]**: the character holds who the figure is (identity, base values); the token holds what is happening to that figure (damage, conditions, scene effects). Plain tokens (monsters, items) keep their own data. Both use the three buckets: `owner` for a character = character owner + GM; for a token = token controller + GM. The server stores both and, apart from the registered sight keys `height`/`eye_height` (5.7), never interprets them; FFF decides the rest of the split (9). The character's `height`/`eye_height` are the base values; a token's are an on-map override that leaves the character alone (5.7) [FIXED, 2026-11-15, #41]. A recipient's view of a token is built from its own props and its character's props, each under its own bucket rule [PROPOSED].
|
||||
- **Names [FIXED, #14]**: every character and every plain token has a `descriptive_name` (e.g. "a grumpy man") and an `actual_name` (e.g. "Lord Vex"). Players see the descriptive name until the GM reveals the actual name to that player; the GM can also reveal to all at once (`reveal_all`). The owner of a character always sees its actual name. A character's tokens use the character's names, so one reveal covers all of them. Applies to player characters too (introductions). A reveal cannot be undone in v1 (no un-reveal intent). Reveals are not revoked when ownership changes [PROPOSED]. Built in slice 8 (#23): a reveal is one `(player, subject)` row, and the subject is a character id **or a plain token id** — the two share one id namespace (4.4), so no column distinguishes them. `reveal_all` is a flag on the subject, not a fan-out of rows, so a player who joins later is covered. The one rule that turns a reveal, an owner or a flag into the name a recipient sees is `characters.knowsActual`/`visibleName`; no frame builder re-derives it.
|
||||
- **Encountered list [FIXED, #14]**: per player, every token that the player's controlled tokens have ever seen, shown under the name that player knows. Out of sight: greyed ("met before, whereabouts unknown"). `gm_only` tokens never enter it; a token that becomes `gm_only` after a player met it keeps its entry (greyed). Entries are never removed automatically (not on token removal, scene change or a `gm_only` flip); only the GM removes an entry for a player. Server tracks and persists it. Built in slice 8 (#23): each entry is a *snapshot* of the names the player knew when it was first sighted (plus the character link, so a rename and a later reveal can follow it), `grey` is computed at frame time, and an entry is recorded on every mutation that could show the token, before the ack. No browsable list of all characters for players. Not the player roster (Q9 lists players only).
|
||||
- **Player**: `id, name (NULL until first sign-in; unique among players), role (gm|player), colour`. Exactly one GM. A player is a real person who signs in with a player key; not a character. A player may own several characters. Max 6 players; unused keys count toward the cap. GM can rename. Remove: see 3.2 [FIXED, #6].
|
||||
@@ -687,10 +700,10 @@ Prototype entity (for mapping): `Tok{id,name,kind,pos,gmOnly}` + `tokenRadius` g
|
||||
|
||||
Principle: v1 has no rules, but every state change already flows through a validated mutation with a recipient-aware view, and entities already carry bucketed properties. FFF later adds **interpretation**, not new plumbing.
|
||||
|
||||
- **Characters and tokens with properties**: FFF characters are character records (8); monsters and items are plain tokens. Both carry `props` in the three buckets. FFF decides which keys live where (token state vs character identity and base values); the VTT enforces the bucket on egress and never interprets the values.
|
||||
- **Characters and tokens with properties**: FFF characters are character records (8); monsters and items are plain tokens. Both carry `props` in the three buckets. FFF decides which keys live where (token state vs character identity and base values); the VTT enforces the bucket on egress and interprets nothing except the registered sight keys `height`/`eye_height` (5.7, #41).
|
||||
- **Action hook** (server side): the reserved `act` intent carries `actor, action, args`. Handling = `rules.handle(world, actor, action, args) -> list of mutations | error`. Mutations are the same primitive set the pipeline already validates (set prop, move, create/remove entity, emit event). Hook output is validated like any client intent; FFF cannot bypass the egress filter.
|
||||
- **Events**: `event{kind, data}` server->client messages with per-recipient filtering (e.g. roll results visible to all, GM-only whispers). Not implemented in v1; message type name reserved.
|
||||
- **Schema registry**: `property schema` (key, `{kind, bucket}`) registered by the rules module; v1 ships an empty registry with a permissive fallback (6.1). A writable-by role and a default value are not part of it: prop writes are GM-only in v1, and which role may write which key, plus any default, belongs to the FFF seam (post-v1).
|
||||
- **Schema registry**: `property schema` (key, `{kind, bucket}`) registered by the rules module; v1 ships it with the two keys the core sight rules read, `height` and `eye_height` (`number`, `gm`, 5.7), and a permissive fallback for every other key (6.1). The server interprets only registered keys used by core sight rules, which is the one narrowing of "no interpretation in v1" (#41, 8); everything else is stored unread until FFF registers it. A writable-by role and a default value are not part of it: prop writes are GM-only in v1, and which role may write which key, plus any default, belongs to the FFF seam (post-v1).
|
||||
- **Where does FFF run?** Undecided. Q19 answered only the hidden-state question (no state beyond the buckets and `gm_only`, FIXED); engine language, runtime and location are not answered. Revisit when FFF starts (schema change accepted then). Options: (a) compile-time Nim module linked into the server (simplest, fastest, requires FFF in Nim or a Nim port); (b) out-of-process sidecar speaking a small request/response protocol over a Unix socket (language-agnostic, adds latency and a failure mode inside the global lock; must run outside the lock or be time-bounded); (c) WASM. No decision made.
|
||||
- Client side: a generic property panel driven by the schema registry; FFF-specific UI later as additional DOM panels (plain HTML overlay [FIXED] keeps this simple).
|
||||
- Non-goal now: any assumption about dice, turns, or stat names.
|
||||
@@ -921,7 +934,7 @@ Owner also decided 2026-11-15 [FIXED (owner-delegated, 2026-11-15, #20)]: tokens
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner-delegated, 2026-11-15, #22)]: token details (M3 slice 7). Schema is migration step 6 (`token details`): the three prop buckets on `entity` and `entity_status` (4.4). Intents: `token.resize`, `status.set`, `status.clear`, `prop.set`, `prop.unset`, all GM-only in v1 (6.1; owner-bucket writes by players come with FFF actions, 9, and are a permission change, not a redesign). The payload rules 6.1 left open are fixed in 6.1: the status set and its `source`, the three-bucket caps (64 keys, 1..64-char keys, 8 KB values, per bucket), the property-schema registry (empty at start with a permissive fallback, so v1 accepts any key in any bucket because 8 says the server never interprets props; a registered key is enforced) and the grow-push search. **Modules**: `server/props.nim` (buckets, caps, registry, parsing), `server/moverules.nim` (the status model replaces the M2 `blocked` bool: `stuckWalls`/`squeezedWalls` are the `walls` source, `locked` is the caller's "any entry" bit, per-token radius everywhere, `resizeToken` with the grow search, `placeToken` for GM placement/move), `server/text.nim` (the one copy of the 6.5 text rule, shared by names and prop keys), `server/tokens.nim` (statuses and props on the record and in the row), `server/worldmap.nim` (`ruleToken`/`ruleWall`/`applyOutcome`/`wallsStatuses`: the bridge between the record's entry set and the rules' two booleans), `server/views.nim` (typed per-recipient statuses and buckets). **One rule, one place**: every wall/door edit and every resize runs the pure rules on a snapshot taken *before* the write, then the write, then `applyRuleOutcome` (positions and `walls` statuses in one `NORMAL` transaction, memory after COMMIT); `token.create` computes the placement status before writing the row, so a new token is born with `stuck` if it lands on a wall. Status sources are owned by different layers on purpose: the rules never see `GM` entries, the record never derives `walls` entries. **Tests** (10.1, 10.3): `tests/tprops.nim` (caps, key/value rules, registry enforcement, set/unset, clone isolation), `tests/ttokens.nim` (radius, buckets, statuses round trip, the FK cascade), `tests/tmoverules.nim` (per-token radius, shrink/grow/squeeze, the no-crossing rule, the source independence), `tests/tviews.nim` (bucket and source filtering, one `token` frame per change), `tools/details.test.mjs` (the five intents' acks and codes, grow push and squeeze, stuck/clear, prop caps, who reads which bucket, restart equality), plus the leak scenario's prop/status groups and the `OWNER_PROP`, `GM_PROP`, `STATUS_SOURCE` faults. Mutations am-au pin the bucket filter, the per-bucket cap, the status set/clear, the shrink/grow rules and the push. See 4.4, 5.5, 5.6, 6.1, 8, 10.3.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), #22]: the property-schema registry of 6.1 is confirmed as the agent specified it — v1 ships the registry **empty with a permissive fallback** (`pkAny`), so any key is accepted in any bucket and only a registered key is enforced, which matches 8's "the server never interprets props in v1". **Strict mode comes with the FFF seam (post-v1)**, where the rules module registers every key it uses; flipping the fallback is a one-line change and no v1 payload, wire shape or test changes. The rest of the #22 token-details decisions stay owner-delegated.
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), #22]: the property-schema registry of 6.1 is confirmed as the agent specified it — v1 ships the registry **empty with a permissive fallback** (`pkAny`), so any key is accepted in any bucket and only a registered key is enforced, which matches 8's "the server never interprets props in v1". **Strict mode comes with the FFF seam (post-v1)**, where the rules module registers every key it uses; flipping the fallback is a one-line change and no v1 payload, wire shape or test changes. **[amended 2026-11-15, #41: the v1 registry is no longer empty — `height` and `eye_height` are registered (`number`, `gm`, 5.7); the rest of this entry stands]**. The rest of the #22 token-details decisions stay owner-delegated.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner-delegated, 2026-11-15, #23)]: characters and names (M3 slice 8). Schema is migration step 7 (`characters`, 4.4): `character`, `name_reveal`, `encountered`, plus `entity.character_id` and `entity.reveal_all`. The decisions 4.4 leaves open are recorded there and the wire rules in 6.1 ("Character and name payload rules"): one id namespace for tokens and characters, an owner that never dangles (`player.remove` transfers to the GM first), an encountered entry with no FK that outlives everything, a linked token that stores `''` names, and `character_id`/`cprops` on the token frame with the ownership rules of 6.1 leak notes 2-3. **Modules**: `server/characters.nim` (records, the name rule, the reveal set, the encountered snapshots, their rows), `server/views.nim` (the typed character and encountered views plus the token-frame additions), `server/tokens.nim` (`characterId`/`revealAll`, the linked-token validation and `sqlLitId`), `server/text.nim` (`normalizedPlayerName`, `validPlayerName`, `sameName`), `server/auth.nim` (`allPlayers`, `nameTaken`, `setName`, `renamePlayer`), `server/main.nim` (`recordEncounters` in every mutation path before the ack, the roster fan-out, `sendHello`/`resync` for `player.setname`). Also fixed here: `protocol.withN` deep-copies before stamping `n`, because the stored diff base was being mutated and every state frame was re-sent on every mutation. **Tests** (10.1, 10.3): `tests/tcharacters.nim` (the name rule, the reveal set, the encounter snapshot, validation, persistence incl. the GM transfer and the `in-use` count), `tests/tviews.nim` (character frames, the owner/non-owner split, `cprops`, `character_gone`, the encountered diff), `tools/characters.test.mjs` (the acceptance group of 13), the leak scenario's ten character/name/encountered groups and the `ACTUAL_NAME`, `CHAR_LIST`, `CONTROLLER_CHANGE`, `CHAR_OWNER_PROP` faults. Mutations av-b4 pin the name rule, the encountered snapshot, the linked-token validation, `in-use`, the GM transfer, the snapshot rename and the `cprops` bucket. See 3.1, 4.1, 4.4, 6.1, 6.3, 6.4, 6.5, 8, 10.3, 13.
|
||||
|
||||
@@ -944,3 +957,5 @@ Owner also decided 2026-11-15 [FIXED (owner-delegated, 2026-11-15, #25)]: the M3
|
||||
| 9 | logs | `tools/logs.test.mjs` (keys/sessions/hashes across two runs, `keylog` control) | pass |
|
||||
|
||||
Out of M3 accept, unchanged: concurrency (M5) and the 127.0.0.1 bind check (M6 deploy) [FIXED, #12]. **Measured 2026-11-15 on the final tree:** `devbox run test` exit 0 (Nim suite all pass; 103 Node harness tests, 0 fail) and `devbox run mutation` exit 0 (control passes, all 63 mutations fail >= 1 expected test, the new `d3` included; log `results/mutation.log`). See 6.1, 10.3, 10.4, 13.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #41]: the height model. Heights are metres, decimal; map distances stay px and no map scale is introduced, because see-over compares heights with heights (research #39 3.3). `height` and `eye_height` are properties, not fields: a character carries the base value, a plain token must carry its own (`token.create` without one is refused), a linked token uses the character's value and may carry a temporary on-map override that never writes the character. Effective token height = token override, else character, else the plain token's own. Eye height follows the same pattern; if nobody set one by hand anywhere it is 93% of the effective token height and follows changes live [93% FIXED (owner-delegated)]. A wall is full height (nobody sees over it) unless the GM gives it one in metres; existing walls are unchanged. Both keys live in the `gm` bucket, so players see only the outcome, their sight. They are the first two keys of the property-schema registry (`number`, `gm`), so "the server never interprets props in v1" becomes "the server interprets only registered keys used by core sight rules". Limits [FIXED (owner-delegated)]: all heights > 0; `height` <= 100 m; `eye_height` <= 100 m and may exceed `height`; a wall's height > 0 and <= 100 m. Deferred: the target's height in see-over (#44) and the height existing tokens and characters get at migration (#49); wall kinds, thickness and what a low wall hides stay with map #38. See 5.7, 6.1, 8, 9.
|
||||
|
||||
Reference in New Issue
Block a user