TableTower/docs/DESIGN.md
RobinFiredrake c009021ac3 Descriptive names rule; first fix in TableCardHeader._make_go_button
DESIGN.md §5: no one- or two-letter names (loop counters and math
coordinates excepted); old names are fixed when the code is touched.
Rename b -> go_button and rn/rh/rp -> normal_style/hover_style/
pressed_style. Also note where Coderstanding is now installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 13:18:54 -06:00

11 KiB
Raw Blame History

Table Tarot (repo: TableTower) — Status and Plan

Engine: Godot 4.7.2 (GDScript) · Started: 2026-11-08 · Last updated: 2026-11-11 (fonts, group marks, Ledger rename and four playtest fixes merged to main and pushed)

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 (§3b lists the 2026-11-10 modules), storage, known gaps.
  • docs/HISTORY.md: decisions on record, the Traveller board, ideas, history (§11: the 2026-11-10 plan).
  • docs/LOGIC.md (rule language), docs/PLAIN.md (plain-language layer), README.md (CLI flags).

1. What it is

A desktop (and, once built, Android) app for building random roll tables as cards on a spread, joined by threads. A roll flows card to card; a logic layer adds choices, values, repeats, branches and sheets. Themed as tarot: purple cloth, beaded card frames, a fortune-teller mascot (assets/art/fortune_teller.svg, logo variant fortune_teller_logo.svg, splash uses the PNG).

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 (UI text only; code, JSON keys and the project's internal name are unchanged)

UI word Code / JSON
Table Tarot (app; window title set at runtime) project config/name="TableTower", so user:// didn't move
Spread (a saved set of cards) TowerBoard, LibraryStore, collections/
Thread pipes, PipeLayer
Deck mode card_mode
Book / Page (reusable results) book, BookPage, TableEntry.page
Branch / Repeat (card kinds) router / loop
Ledger (card kind; "for the time being", user 2026-11-11) variable card, var_type: "collection"
Card, Result, Change, Reset, Dice wording rules: docs/HISTORY.md §6 "Terminology".

3. Where things stand (2026-11-11)

  • Everything from the 2026-11-10 plan is built, tested and on main (pushed): theme system, rename and reskin, spread interaction, menus, Deck mode, nested groups, List view, phone layout, the Book, roll features (combine, batches, pause, costs, limits), sheet export, pictures, Help with demo spreads, splash screen. Summary in HISTORY.md §11; module map in ARCHITECTURE.md §3b.

  • First user playtest found two bugs, both fixed: the card resize corner caught clicks far outside cards; a left-drag on empty space panned instead of selecting. Now a left-drag draws a selection box in Play and Build; panning is middle-drag or Space+drag.

  • Audits done: the seven files over 600 lines were split into helpers; tests share TestBase.

  • The user is playtesting. Expect more bug reports; fix them first.

  • Book tables (merged to main 2026-11-10): four features for printed-book procedures, found by building The Perilous Void's world generation: Scales (ordered steps that move up/down), Columns (multi-column tables, one roll per row or per column), thread "roll with … instead" and thread "roll again if it comes up". Spec: LOGIC.md §3e, §3f, §5.4; modules: ARCHITECTURE §3c. The goal behind it: handle any book's random tables and oracles (HISTORY §12).

  • Spread built with them: perilous-void-stage-1 in the user's collections, now "Perilous Void · World Scan & Survey" (152 cards): Stage I (Initial Scan) and, below it, Stage II (Data Analysis, pp. 50–51; tables pp. 64–85: surface features, resource details, 3–5 signature lifeforms with adaptations, nonhuman species basics; resource specifics, simple/microbial life and hazards as hand-rolled cards). Society Creation (p. 86) is out of scope. Generator: TableTower-private/perilous_void/build_world_gen.py + stage2.py/stage2_data.py; install with merge_layout.py so the user's card positions survive. The user hand-tested Stage I (works); Stage II is untested by hand. A different, undocumented file perilous-void-world-generation.json (137 cards, 2026-11-10) also sits in collections; left alone.

  • Stage II engine features (merged to main, pushed 2026-11-11): columns read as one phrase (column_join), "roll twice and combine" results (TableEntry.repeat), results saved into a list value add an item (RollContext.save_result), a pick with one option answers itself. Spec: LOGIC.md §2, §3e, §5.1. Suite test_book_collect.

  • 2026-11-11 (merged to main, pushed):

    • Theme fonts: 13 bundled families (OFL; Special Elite Apache 2.0) with Text/Title font pickers in the theme editor (FontCatalog). User tested by hand: works.
    • Drag handles reorder a card's results in Build (ranged cards keep ranges in place). Hand-tested.
    • Thread nodes under a card stacked above theirs are hidden. Hand-tested.
    • Deck mode: a drawn result fades only after the roll animation reveals it (fast rolls: at once).
    • Group marks (the user's pick, "option C"): a member card's top-right corner, and the group's border, take the group's colour (Colour ▸ on the group menu); uncoloured groups use the theme token GROUP (default gold, same as the highlight; watch for confusion).
    • The Collection card kind is called Ledger in the UI "for the time being". The spread switcher's tooltip says "Spreads".
    • Reroll rule settled by the thread option "Roll again if it comes up".
  • Hand testing: the user tests by hand as they go but hasn't done a full pass; a comprehensive playtest with a checklist is planned (they'll do it later; offer a checklist when asked).

Next, likely: the user's hand test of Stage II and the new column options (one phrase, roll twice and combine); the roll hitch (§4); a size audit (§4); a hand-testing checklist; untested-by-hand items: Deck mode fade timing and group marks.

4. Open items

Waiting on the user

  • Android: export templates are installed (checksum verified); the Android SDK (build-tools, platform-tools) is not. Ask before downloading. No Android preset yet.
  • Thread string art (the user will draw it), then use it like CardFrame does for cards.
  • Repo privacy on Forgejo: needs Niles/sock's username and a token from the user.

Known, not urgent

  • export_presets.cfg (and project.godot) hold the user's uncommitted edits. The Windows preset's include_filter now matches Linux (help + templates; verified by a real Windows export 2026-11-11) but is still uncommitted with their edits; ask before committing. Both presets also pack tests/ (could add tests/* to the exclude filter).
  • Over ~400 lines: inspector_card (593), board_tester (505), main_cli, builder (499), expr (520), roller, tower_board, group_card, main_rolling (426), describe (408), inspector (407). A size audit is due. (roll_table was split: RollTableIO.)
  • Small ideas from the Perilous Void spread: an empty list shows blank in a sheet (no "none" default); a value change that should apply when a later value is rolled (Shattered lowers atmosphere after Gas/Life were already decided) has no clean form.
  • Roll hitch (user report, 2026-11-11): before certain groups show their results, the whole app freezes for several frames. Not investigated yet; which groups is not pinned down. Likely suspects: a long pipe chain rolled in one frame (Stage II's lifeform loop with nested pipes), the rebuild of the result tree/thread nodes, or the why/describe text. Profile first (Godot profiler, or time Roller vs. the board redraw) before changing anything.
  • Known gaps: ARCHITECTURE.md §7.

5. Working on it

  • Godot: ~/apps/Godot_v4.7.2-stable_linux.x86_64. New class_name files need godot --headless --path . --import (the test runner does this).
  • Tests: tools/run_tests.sh [filter]: 43 suites in parallel, ~35 s. One line per suite; a failing suite prints 8 lines; a compile error shared by many suites prints once. Suites extend TestBase (tests/testbase.gd, named so the test_*.gd glob skips it): start_main(), require_sample(), _check, _eq, _frames, finish().
  • Smoke test: godot --headless --path . --quit-after 120 -- --sample (no SCRIPT ERROR; the "resources still in use at exit" line is normal).
  • 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). Useful flags: --build, --roll=ID, --view=x,y,zoom, --window=WxH, --mobile, --list, --book, --demo=KEY; all in ui/main_cli.gd. If a run is interrupted it leaves override.cfg behind: delete it before the next run.
  • Keep files under ~400 lines; split by area into RefCounted helpers with one-line delegators.
  • Descriptive names (the user is learning to code from this repo): no one- or two-letter names like b, rn, t for variables, parameters or fields; say what the thing is (go_button, normal_style, table). Loop counters i/j and math x/y are fine. New code follows this; old names are fixed when we touch or read that code (Boy Scout rule), not in one big sweep. First fix: TableCardHeader._make_go_button (2026-11-11).
  • GDScript traps hit today: don't name methods _set, _get or convert (built-ins); compare roll-node Dictionaries with is_same(), not == (it compares contents); in Python patch scripts, avoid apostrophes inside single-quoted replacement strings.
  • 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 jobs. Worktree briefs start with git reset --hard <branch>, own specific files, keep public APIs as delegators, don't touch tests. The user's computer has been crashing: an interrupted agent's work stays in .claude/worktrees/; resume it with SendMessage ("don't reset"), then cherry-pick its commit and git worktree remove -f -f.
  • Token savings: read only this page at the start; read the other docs on demand; keep tool output short (the test runner already does); avoid viewing full-size screenshots (crop/resize).
  • Coderstanding (structure scanner, tours) is installed: coderstanding on PATH (venv ~/.local/share/coderstanding/venv), app tabletower, data and tours in ~/.local/share/coderstanding/tabletower, viewer http://127.0.0.1:8517/. Tours teach the user (new to coding): plain words, explain basics. Update: pull https://forgejo.smhub.duckdns.org/digit/coderstanding and pip install it into that venv.
  • Keep this page short. Put history in HISTORY.md and file maps in ARCHITECTURE.md.