M4: tokens, labels, statuses and lists #71

Closed
opened 2026-11-20 22:31:44 +01:00 by SirStone · 1 comment
Owner

Part of #63

Goal

Pooled token rendering, BitmapText labels, statuses, player character list and encountered list, GM sees all.

Acceptance criteria

  • Token enter/leave/update correctness
  • Labels built once per name via BitmapFont
  • Stuck/squeezed badges
  • Own characters list
  • Encountered greyed entries
  • GM sees gm_only tokens
  • Instrumented count shows only changed entities updated per frame
  • Standing gate: full devbox run test green on a clean checkout, no test weakened or skipped, and the behaviour above proven at the seam(s) listed under "Proven at".

User stories covered

  • 28 — As a player, I want to see my tokens and the tokens inside my line of sight with their known names, so that I understand the situation.
  • 29 — As a player, I want a token that leaves my sight to disappear, so that I am never shown a stale position.
  • 30 — As a player, I want a stuck or squeezed badge on a token, so that I understand why mine will not move.
  • 31 — As a player, I want a list of my characters with my own values, so that I can identify my figures.
  • 32 — As a player, I want an encountered list with greyed entries for figures I have met but cannot see, so that I remember who is around.
  • 33 — As a player, I want token names rendered with a bitmap font, so that labels stay crisp and cheap at any zoom.
  • 34 — As a GM, I want to see every token including hidden ones with their GM-only fields, so that I can run the table.

Proven at

token renderer, lists panel, reducer token slice

Notes

  • Size: M (about one agent session, ~100K tokens). Lane: E (entities).
Part of #63 ## Goal Pooled token rendering, `BitmapText` labels, statuses, player character list and encountered list, GM sees all. ## Acceptance criteria - [ ] Token enter/leave/update correctness - [ ] Labels built once per name via `BitmapFont` - [ ] Stuck/squeezed badges - [ ] Own characters list - [ ] Encountered greyed entries - [ ] GM sees `gm_only` tokens - [ ] Instrumented count shows only changed entities updated per frame - [ ] Standing gate: full `devbox run test` green on a clean checkout, no test weakened or skipped, and the behaviour above proven at the seam(s) listed under "Proven at". ## User stories covered - 28 — As a player, I want to see my tokens and the tokens inside my line of sight with their known names, so that I understand the situation. - 29 — As a player, I want a token that leaves my sight to disappear, so that I am never shown a stale position. - 30 — As a player, I want a stuck or squeezed badge on a token, so that I understand why mine will not move. - 31 — As a player, I want a list of my characters with my own values, so that I can identify my figures. - 32 — As a player, I want an encountered list with greyed entries for figures I have met but cannot see, so that I remember who is around. - 33 — As a player, I want token names rendered with a bitmap font, so that labels stay crisp and cheap at any zoom. - 34 — As a GM, I want to see every token including hidden ones with their GM-only fields, so that I can run the table. ## Proven at token renderer, lists panel, reducer token slice ## Notes - Size: M (about one agent session, ~100K tokens). Lane: E (entities).
SirStone added the ready-for-agentenhancement labels 2026-11-20 22:31:44 +01:00
SirStone added a new dependency 2026-11-20 22:31:46 +01:00
SirStone added a new dependency 2026-11-20 22:31:46 +01:00
Author
Owner

Implemented and pushed as 429f023 on main (ref #71).

What landed

  • client/src/slices/tokens.ts: token upsert / token_gone / hello reset; status names only (source never stored); GM-only fields kept for the GM view.
  • client/src/slices/characters.ts + client/src/slices/encountered.ts: own characters (ownCharactersOf, player = all received, GM filtered by owner) and the encountered list (full replace, set/del diff, grey); the GM's per-player copies are ignored.
  • client/src/render/tokenBoard.ts (pure) + client/src/render/modules/tokens.ts: pooled nodes on the tokens layer in world coordinates (composes with #69's camera), one shared unit-circle GraphicsContext per kind, BitmapText labels from one pre-installed BitmapFont assigned only on a name change, stuck/squeezed badges, and a mount-time seed so an async app.init cannot miss the resync.
  • client/src/panels/lists.ts + client/src/render/modules/lists.ts: #lists under the existing #panels host (My characters, Encountered), textContent only, greyed rows carry data-grey + .grey + an "out of sight" label. Mounted by a render module, so no shared bootstrap edit.
  • Canvas instrumentation for the "only changed entities" criterion: data-tokens, data-token-entered|updated|left, data-token-labels, data-token-ids, data-token-statuses.

Proof (all green on the rebased tree)

  • devbox run test — 157/157.
  • devbox run client-test — 92/92 (test/tokens.test.ts, test/lists.test.ts, test/token-board.test.ts).
  • devbox run e2e — 10/10, incl. client/e2e/tokens.test.mjs against the real server: player renders own + in-sight tokens and never the gm_only one, stuck badge, both lists, token_gone + grey flip, one changed token = one updated entity with labels unchanged, GM renders all three.

Shared file edit: client/src/style.css (lists block appended; rebased over #74 and kept both). No reducer/stage/main/protocol changes.

Implemented and pushed as 429f023 on `main` (ref #71). **What landed** - `client/src/slices/tokens.ts`: `token` upsert / `token_gone` / `hello` reset; status names only (`source` never stored); GM-only fields kept for the GM view. - `client/src/slices/characters.ts` + `client/src/slices/encountered.ts`: own characters (`ownCharactersOf`, player = all received, GM filtered by owner) and the encountered list (full replace, set/del diff, `grey`); the GM's per-player copies are ignored. - `client/src/render/tokenBoard.ts` (pure) + `client/src/render/modules/tokens.ts`: pooled nodes on the `tokens` layer in world coordinates (composes with #69's camera), one shared unit-circle `GraphicsContext` per kind, `BitmapText` labels from one pre-installed `BitmapFont` assigned only on a name change, `stuck`/`squeezed` badges, and a mount-time seed so an async `app.init` cannot miss the resync. - `client/src/panels/lists.ts` + `client/src/render/modules/lists.ts`: `#lists` under the existing `#panels` host (`My characters`, `Encountered`), `textContent` only, greyed rows carry `data-grey` + `.grey` + an "out of sight" label. Mounted by a render module, so no shared bootstrap edit. - Canvas instrumentation for the "only changed entities" criterion: `data-tokens`, `data-token-entered|updated|left`, `data-token-labels`, `data-token-ids`, `data-token-statuses`. **Proof (all green on the rebased tree)** - `devbox run test` — 157/157. - `devbox run client-test` — 92/92 (`test/tokens.test.ts`, `test/lists.test.ts`, `test/token-board.test.ts`). - `devbox run e2e` — 10/10, incl. `client/e2e/tokens.test.mjs` against the real server: player renders own + in-sight tokens and never the `gm_only` one, stuck badge, both lists, `token_gone` + grey flip, one changed token = one updated entity with labels unchanged, GM renders all three. Shared file edit: `client/src/style.css` (lists block appended; rebased over #74 and kept both). No reducer/stage/main/protocol changes.
Sign in to join this conversation.