TableTower/docs/DESIGN.md
RobinFiredrake 61395fa573 DESIGN.md: plan status after steps 7-9; suggested audits
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 19:15:28 -06:00

113 lines
8.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Table Tarot (repo: TableTower) — Status and Plan
**Engine:** Godot 4.7.2 (GDScript) · **Started:** 2026-11-08 · **Last updated:** 2026-11-10 (plan steps 1–9 done on `tarot`)
The short page to read at the start of every session. Everything else is read only when needed:
- `docs/ARCHITECTURE.md`: feature summary, file map, key implementation facts, data/storage, known gaps.
- `docs/HISTORY.md`: decisions on record, the private Traveller board, the old ideas list, history.
- `docs/LOGIC.md` (rule language), `docs/PLAIN.md` (plain-language layer), `README.md` (CLI flags).
## 1. What it is
A desktop (soon Android) app for building **random roll tables** as cards on a board, joined by
threads (code: pipes). A roll flows card to card; a logic layer adds choices, values, repeats,
branches and sheets.
**Product principles (from the user)**
- **General-purpose.** The Traveller board is only a capability test. No game-specific features.
- **Intuitive for non-technical people.** Flag anything programmer-y. Play mode stays simple.
- **Plain words by default**; rule text stays stored and reachable ("Edit as text").
- **Themed names are welcome** as long as they stay easy to understand.
## 2. Names (decided 2026-11-10; UI text only; code and JSON keys keep old names)
| UI word | Was (UI) | Code / JSON |
|---|---|---|
| Table Tarot (app) | TableTower | project, classes, `user://` folder unchanged |
| Spread (a saved set of cards) | Board / Collection | `TowerBoard`, `LibraryStore`, `collections/` |
| Thread | Pipe | `pipes`, `PipeLayer` |
| Deck mode | Card mode | `card_mode` |
| Book / Page (reusable results) | — | new |
| Branch (if… / otherwise) | Router | `router` |
| Repeat | Loop | `loop` |
The Collection *card kind* needs a new UI name (not "List", not "Collection"); undecided.
Card, Result, Change, Reset, Dice wording rules: `docs/HISTORY.md` §6 "Terminology".
## 3. Plan (agreed 2026-11-10, in order)
Work is on branch `tarot` (not merged yet). Done items say so; details in `git log`.
1. **Theme system: done.** `Style` colours are static-var tokens named by role; `ThemeStore`
applies sets (built-ins in `BuiltinThemes`: Tarot default, Felt), saves user sets in
`user://themes/`; View ▾ → Theme… (`ThemeDialog`, `FillEditor` for gradients). Applying
reloads the scene (`ThemeStore.carry_board` keeps the open spread). Per-card
(`RollTable.color`) and per-thread (`TableEntry.pipe_color`) colours via `ColorChoice` and
right-click Colour ▸. **Not done:** font choice (only Atkinson + Rokkitt are bundled; add
OFL fonts first), card/thread art per theme beyond the frame on/off.
2. **Rename and reskin: done.** UI text only (code names, JSON keys and the project's internal
name, so `user://`, unchanged). Logo `assets/art/fortune_teller_logo.svg` (the art minus its
background square), app icon = mascot. `CardFrame` draws the beaded border (shader recolours
to TRIM or the card colour). `Sparkles` (CPU particles) on the thread pulse and on landing
results. Thread string art: waiting on the user's drawings.
3. **Board interaction: done** except two-finger touch pan (do with mobile). No walls; Build
drag on empty = selection box (Ctrl/Shift adds); middle-drag / Space+drag pans (Play: plain
drag pans too); `MainSelection` box-selects groups and drags the whole selection; `CardGrip`
resizes cards (`RollTable.width`, `list_height`).
4. **One menu system: done.** `Actions` builds card/thread/group/background menus for
right-click, the ⋯ buttons and the top bar's ☰. Below 45% zoom `CardShield` covers cards
(name tooltip, drag, right-click, Play click rolls). Long-press on touch: with mobile.
5. **Small UI items: done.** Bold chip sources, Threads in/out in the inspector
(`InspectorThreads`), backwards ranges warn and block rolling, template Replace and Edit…,
Other formats submenu, plain Test spread hints.
6. **Deck mode: done.** Faded drawn results, inspector Deck mode section, Wait for Shuffle with
an Empty result (`deck_empty_text`), Shuffle all decks.
7. **Nested groups, List view, phone layout: done.** `TableGroup.parent` nests groups
(`TowerBoard.tables_in/groups_in/hidden_by`); `ListView` + `ListTree` + `ListOrder` (folders =
groups, drag to reorder/move, own search, thread counts with tooltips); `MobileLayout`
(`--mobile` to try) and `TouchInput` (long press = right-click, two-finger pan/pinch).
Android export templates installed (checksum verified). **Not done:** the Android SDK
(build-tools, platform-tools) isn't installed, so no APK yet: ask the user before downloading;
no Android preset in `export_presets.cfg` (the user has uncommitted edits there).
8. **Book and Pages: done.** `BookPage` in the spread file (`"book"`), `TableEntry.page` links a
result (edit the page → every copy changes; editing the result's own text unlinks). `BookPanel`
+ `PageEditor`; drop a page on a result or a card (handled on drag end, since text fields eat
drops). Undo covers the Book. **Not done:** images on pages (step 11).
9. **Roll features: done.** `RollCombine` (thread "then": keep all / add / highest / lowest /
let me choose; Roller.OP_COMBINE), `BatchRoll` (Roll several times…), pause (`pipe_pause`,
Roller.OP_PAUSE, `RollPauses` chips with set-aside and Continue), `RollCosts` (option costs,
greyed out when unaffordable), roll floor/ceiling (`roll_floor`, `roll_ceiling`: "adjust later
rolls"). Open question for the user: should a "reroll" result that comes up during its own
reroll be ignored and rolled again (common table rule)? Not implemented.
10. **Sheets**: easier building, export as Text / Markdown / HTML (no PDF).
11. **Images** in details/tables, embedded in the spread file (downscaled, size-capped); imported
BBCode may only use embedded images.
12. **Help**: document major features, hotkey cheat sheet, per-topic "Try a demo" spreads that open
unsaved and don't appear in the spread list.
**Suggested size audit (files grew past ~400 lines):** inspector.gd (789; split the thread box,
cost row and Book line into helpers), choice_dialog (698), main.gd (664), table_card (629),
edit_history (609), describe (~760). **Suggested test audit:** 35 suites repeat the same
boilerplate (_init/_frames/_check); a shared base would cut lines and tokens.
**Still open from before:** repo privacy on Forgejo (waiting on the user: Niles/sock's username +
token); hands-on playtest; size audit of `core/describe.gd` (731 lines) and the other files over
~530 lines (list in ARCHITECTURE.md §3); known gaps in ARCHITECTURE.md §7.
## 4. Working on it
- **Godot:** `~/apps/Godot_v4.7.2-stable_linux.x86_64`. After adding `class_name` files run
`godot --headless --path . --import` first.
- **Tests:** `tools/run_tests.sh [filter]`: parallel, ~20 s, one line per suite, fails on SCRIPT
ERROR too. Prints details only for failures. Use it instead of the old for-loop.
- **Smoke test:** `godot --headless --path . --quit-after 120 -- --sample` (no SCRIPT ERROR).
- **Simulator:** `godot --headless --path . -s res://tools/simulate_board.gd -- --board=<json> --start=<id> --runs=N [--check] [--quiet]`.
- **Windowed runs/screenshots: always `tools/test_window.sh -- --sample --screenshot=/path.png [flags]`**
(KWin rule keeps it in the background; never plain `godot --path .`; don't minimize). Flags are in
`ui/main_cli.gd`. Launching for the user to look at: plain `godot --path .` in the background.
- **Keep files under ~400 lines**; split by area into RefCounted helpers holding `m: Main` with
one-line delegators. Reuse shared builders (list in ARCHITECTURE.md §3).
- **Coderstanding** (structure scanner) for audits:
clone https://forgejo.smhub.duckdns.org/digit/coderstanding into the scratchpad, venv,
`pip install`, `XDG_CONFIG_HOME=<scratch>/xdgconf`, `coderstanding add tabletower <repo> --data
<scratch>/cs_data`. Commands: `outline`, `hotspots`, `dupes`, `warnings`, `find`, `uses`, `brief`.
- **Git:** origin `git@forgejo.smhub.duckdns.org:RobinFiredrake/TableTower.git`. Feature branch,
fast-forward merge to `main` when the user asks. Co-Authored-By line on commits.
- **Agents:** only for large, separate features (each rereads context). Worktree briefs start with
`git reset --hard <branch>`, own specific files, keep public APIs as delegators. Remove worktrees
after merging.
- **Keep this page short.** Update §3 as items land; put history in HISTORY.md, not here.