From 24fa9b25b81070c6fe2486fc83b1d0356a07c671 Mon Sep 17 00:00:00 2001 From: Davide Cappellini Date: Sun, 8 Nov 2026 11:14:54 +0100 Subject: [PATCH] docs: Q1 resolved, max 6 players in v1 Co-Authored-By: Claude Haiku 5.5 --- docs/DESIGN.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/DESIGN.md b/docs/DESIGN.md index 78ae824..0eff292 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -19,10 +19,10 @@ Evidence roots (relative to repo root): ## 1. Goal and non-goals ### Goal -A browser virtual tabletop for one table (1 GM + a few players), self-hosted, where the **server alone decides what each player sees**. A modified client must learn nothing it is not entitled to. +A browser virtual tabletop for one table (1 GM + up to 6 players [FIXED, Q1]), self-hosted, where the **server alone decides what each player sees**. A modified client must learn nothing it is not entitled to. ### v1 scope [PROPOSED, trimmed to what the prototypes proved plus the minimum to be usable] -- One table, 1 GM + N players (N small; target <= 6 is a PROPOSED assumption, max players unanswered, Q1), invite links, no accounts. +- One table, 1 GM + up to 6 players (max 6 [FIXED, owner decision 2026-11-08, Q1]), invite links, no accounts. - Exactly one scene in v1 (Q3, FIXED): large tiled map image, optional visual grid, walls and doors (kinds `wall`|`door` only, Q6), tokens. - GM tools: author walls/doors in the browser (Q6, FIXED), create/move/delete tokens, toggle doors, edit token properties, manage invites. - Player: move owned tokens; see only line-of-sight area, previously explored area (dimmed), and tokens inside LOS. @@ -190,7 +190,7 @@ Second limitation [INFERRED]: a fast drag sampled at ~50 ms can produce a straig - **One global lock** around intent handling and send. [MEASURED] 13748 mutations / ~36k messages in 60 s with 3 clients (~223 intents/s): no crash, no reorder, no loss, consistent final views (`results/concurrency-final{1,2,3}.log`); intent->ack avg 1.40 ms, p99 4.58 ms, worst 20.31 ms. - Decision [PROPOSED]: keep the global lock in v1. A table of <= ~10 clients is 2 orders of magnitude below the single-core limit (server total per mutation avg 0.70 ms [MEASURED]). Revisit only if a measured p99 > 50 ms appears in production logs. - Worker threads: prototype uses 8; one table needs 2-4 [INFERRED]. -- Slow client: mummy's send queue is one unbounded deque, no per-socket depth available to us [MEASURED finding]. Mitigations [PROPOSED]: max connections (8, PROPOSED assumption, Q1), tiny messages, WS ping/pong timeout, per-connection byte counter we maintain ourselves and close when `sent - acked-by-pong` exceeds a bound (needs ping with counters; feasibility to be confirmed in M5). Q13 still open: owner leans to queued channels (MQTT-like) for slow clients; research pending on mummy capabilities. +- Slow client: mummy's send queue is one unbounded deque, no per-socket depth available to us [MEASURED finding]. Mitigations [PROPOSED]: max connections (8 = 6 players + GM + headroom; PROPOSED, derived from FIXED max 6, Q1), tiny messages, WS ping/pong timeout, per-connection byte counter we maintain ourselves and close when `sent - acked-by-pong` exceeds a bound (needs ping with counters; feasibility to be confirmed in M5). Q13 still open: owner leans to queued channels (MQTT-like) for slow clients; research pending on mummy capabilities. - `WebSocket` has no `==`/hash; prototype keys connections by the raw bytes of the ref (`key(ws)`), flagged as shortcut. Real build: assign a connection id at upgrade and keep it in a table indexed by the ws via a documented wrapper; add a test that fails if mummy's layout changes (pinned commit makes this stable but the test makes it explicit) [PROPOSED]. - Handler discipline: no blocking I/O under the lock except the one SQLite COMMIT; no logging formatting of large structures under the lock; metrics are O(1) updates (section 11). - SQLite tail: server worst ~20 ms is the COMMIT (WAL autocheckpoint / OS scheduling [INFERRED]) and every other mutation queues behind it as `lock_wait` (`results/spike/investigation.md`). Accepted for v1. Moving persist out of the lock breaks ack-after-commit and order; not done. @@ -543,7 +543,7 @@ Each is small, ends with a green gate, and no milestone depends on browser UI be ## 14. Open questions for the owner -1. Q1 - Table size and device mix: how many players max, and which devices (phones, tablets, iOS)? Drives iOS testing priority and token/message budgets. **RESOLVED [FIXED (owner decision), 2026-11-08]:** devices are phones, tablets and laptops. Max players not answered: target <= 6 and connection cap 8 stay [PROPOSED] assumptions (sections 1, 4.3). +1. Q1 - Table size and device mix: how many players max, and which devices (phones, tablets, iOS)? Drives iOS testing priority and token/message budgets. **RESOLVED [FIXED (owner decision), 2026-11-08]:** devices are phones, tablets and laptops. Max players: 6 [FIXED, owner decision 2026-11-08] (section 1). Connection cap 8 (6 players + GM + headroom) stays [PROPOSED] (sections 4.3, 13). 2. Q2 - Largest map you plan to use (px), and typical wall count per scene? Drives tile size, spatial grid priority and explored chunking. **DEFERRED [FIXED (owner decision), 2026-11-08]:** owner does not know yet. 16384 px map and 5k walls stay [PROPOSED] test targets; revisit with real maps. 3. Q3 - Multiple scenes in v1 (GM switches the active scene, per-scene explored grids), or exactly one scene per table to start? **RESOLVED [FIXED (owner decision), 2026-11-08]:** exactly one scene in v1; schema may stay `scene_id`-keyed. 4. Q4 - Tile-edge leak: accept as documented, or reduce it (smaller tiles = more requests; gate tiles only when explored cells cover a minimum fraction; or server-side masked tiles at the cost of image processing in Nim)? What detail do you paint in map art that must stay secret? **OPEN (owner, 2026-11-08):** still open. Prototyping server-masked tiles vs cell-size tiles in `prototype-tile-leak/`.