TableTower/docs/HISTORY.md
RobinFiredrake fe883cbeda DESIGN.md: book tables merged; next steps
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 21:36:12 -06:00

200 lines
14 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.

# TableTower — Decisions, Ideas and History
Read on demand. Status and plan: `docs/DESIGN.md`.
## 6. Decisions on record
- The three-pane UI from the first design was replaced by the pipe board (a user request: simpler at the table).
- Variables are kept between rolls until changed or reset, so a character sheet survives other rolls.
- A variable card's starting value is applied, if the variable isn't set, when a top-level roll starts.
- Expression dice clamp beyond the end ranges. Plain dice tables report gaps instead.
- Pipe conditions and counts are a snapshot taken when the result is chosen. Two true Only-if pipes both run; routers give exactly one.
- `a if c else b` is refused (Godot's Expression returns the wrong branch); use `if(c, a, b)`.
- Collapse/expand isn't undoable. Collection members aren't undoable.
- Rules are stored as text, and the plain layer sits on top of it, so old boards open unchanged.
- Traveller-derived content stays out of the repo (§8).
- **Roll modifiers (2026-11-09).** A separate `dice_mod` field, not just an expression in `dice`,
so the card knows its dice: it can show chances, the natural range and plain words. Totals past
the ends always use the end result; there's no separate "nothing happens" setting, because an end
result that says so does the same job. The Check card's modifier picker became the shared
ModifierEditor, which also adds a value as it is (`@luck`) and doesn't only use `dm()`.
- **Panel resizing** uses a small drag handle (`PanelSplitter`) rather than Godot's
`SplitContainer`. The tray used to size itself to its content and the inspector collapses to a
strip, and a handle that sets the panel's size fits both without changing the layout.
- **UI pass (2026-11-09).** View preferences (rules view, collapse all, stripes, minimap) live in
View ▾ rather than on the bar; Plain/Text is one click further away, which the user accepted.
The card ⋯ menu shares `Style.overflow_button` with the group card's ⋯. Stripes use the
"parchment" tint picked from a mockup (felt tint and hairline were the other options). The
sample's Search the Ruins uses `[[refs]]` rather than pipes, because Loot and the trinkets are
far across the board. Card mode already existed (Party Roles) and needed no new work.
- **Terminology (2026-11-09).** UI text uses these words; code and JSON keys keep their old names.
- **Card:** anything on the felt. "Roll table" means only the `roll` kind.
- **Result**, never "entry" or "row" (code: `TableEntry`, `entries`).
- **Change** in plain text, "effect" only in Text mode (code and JSON: `effects`).
- **Pipe.** Pipes are *deleted*, like cards and results. "Remove" is for taking an item out
of something.
- **Reset** = back to the starting value, or erased if the value has no card. "Clear" only
when a value really is erased.
- **Dice** always read `2d6` / `d6`. `2D` is accepted as input only.
- **Choice types:** "Which option / How many / Open ended", from `Describe.choice_label`.
- **JSON keys aren't renamed.** A rename needs a format bump plus migration.
- **Fan-out on ranged tables (2026-11-09).** Dropping a pipe from a range used to replace that
range's pipe, a rule left over from the first build. It was a user-reported bug (a "Rocky" range
could not feed Resources, Atmosphere and Water), so ranges now add pipes like weighted results.
`MainEditing.finish_link` uses `TableEntry.add_pipe`. The drop itself has no automated test.
## 8. The Traveller test board (private)
- **Location.** Private content derived from the user's Mongoose Traveller 2e rulebook lives in
`~/Repos/Godot/TableTower-private/` (outside git; see its README). That covers the rules digest
(`traveller/chargen.json`), the board generator (`traveller/board/build_board.py`,
`python3 -I`) and the generated board.
- **The board itself.** It's installed as collection `traveller-chargen`: 662 cards, 23 groups,
routers, dynamic options and `show_if`. It runs clean in the simulator (start card `new_traveller`).
- **Still worked around:**
- global "argument" variables (`@x_offer`, `@x_lvl`) feeding shared skill cards
- natural-roll pre-rolls (`rs`, `ra`, `rc`)
- `.replace()` chains for names
- counters instead of `len()`
- about 70 reset statements
- a guard before empty dynamic picks
- **Not automated:** group steps (Connections, skill packages, shared ships), contact
naming, gear choice, medical bills, anagathics, the Psion career, Noble titles, and the
total skill cap.
- **Open question for the user:** "Raise a skill you already have" counts level-0 skills as held (the rules reading); the user's earlier example was level 1+.
## 9. Improvement ideas, roughly by value
1. **Hands-on playtest** with a checklist, then fix what feels wrong. Highest value now that Build mode has changed a lot.
2. **Several pipes to the same card** (pipe ids). It unlocks Tier 3 "only if" plus Tier 1 "otherwise" into one card.
3. **Port the Traveller board to the new features:**
- card inputs instead of the `@x_*` argument variables
- Check cards
- `nat`
- collections
This also tests them end to end.
4. **Small engine additions:**
- `len(list)`
- `sum` / `max` over a prefix (enables "best of these skills" and skill caps)
- a fallback path when a dynamic pick has no options, instead of stopping the roll
- telling unset from 0
- lists that keep duplicates
- effects that run after pipes
- nicer display names ("Jack-of-all-Trades")
5. **Onboarding:** a guided tutorial board, a cheat-sheet panel, and templates surfaced as "starter blocks".
6. **Sheet output:** save a finished sheet as text or Markdown; keep finished characters as a list.
7. **Comfort:** a UI scale setting, colour-blind-friendly lit pipes, optional seeded rolls.
8. **Groups:** nested groups, only true members inside frames, clickable pipes into collapsed
groups, and groups in the Canvas and GraphML exports.
9. **Linked templates:** a plan exists. Copies record template uid, revision and role, and
offer "Update available" with a per-field merge.
10. **Faster expanded-board loads.**
11. **Builds:** install the export templates (needs the user's OK), add Windows and Mac presets.
12. **From the original design:** a big-button quick-roll view, cross-collection references
(`[[Collection/Table]]`), touch support.
13. **Naming suggestions not yet applied** (from the 2026-11-09 audit):
- Rename the Collection card kind (e.g. "List"), so "collection" means only the saved set.
- Label the check margin "Margin" instead of "Effect".
- Keep raw `@name` / `{@x}` / "BBCode" out of Play mode.
- "Endless loop" → "Never finishes".
- Drop the `_` on helpers used across files.
- `EffectsBuilder`/`ConditionBuilder` → `*Editor`, `LibraryStore` → `CollectionStore`.
- Keep JSON keys as they are; document the key ↔ UI mapping in LOGIC.md.
14. **Housekeeping:** delete merged branches (also `split-table-card`, see Open items). Keep LOGIC.md and PLAIN.md in step with features.
## 10. History
**2026-11-08 (one long session): board and core features**
1. Initial Godot project and the original design doc. An HTML mockup became the pipe board, built in Godot.
2. First feature wave (parallel agents): weights, dice expressions, card mode, text references and BBCode,
collections and local state, import/export, a Linux preset, the play-side UI, and the app shell (settings,
collection switcher, import/export menu).
3. Fast roll (Shift-click).
**Logic cards**
4. Logic cards: choice, loop, variable and sheet cards, effects, expressions, the 10,000-action limit and a coroutine roller.
5. The Traveller board was generated and simulated from the rulebook digest.
**Building tools**
6. Group cards and templates. Choice pop-up minimize and option previews.
7. Conditional pipes and routers, search, minimap, packing, lazy cards (the board opens in 0.38 s, was 5 s), and Test board.
8. Undo/redo, and dynamic options with `show_if` and `@[expr]`. The Traveller board was regenerated with them (792 → 662 cards).
**Plain Build**
9. The usability mockup, then Plain Build: plain words, the inspector with builders, Check
cards, card inputs, collections, Why this?, the Plain/Text switch, and starting values applied.
**2026-11-09: token diet**
10. Split the oversized files (main.gd 3679 → 617 lines plus 11 helpers; table_card, roller,
table_settings_dialog and result_tray likewise) with no behaviour change, then a duplicate-code
pass guided by the Coderstanding scanner (shared Style/InspectorKit/JsonIO/Main helpers, dead
flags and fields removed). A terminology pass followed:
- One `Describe.kind_label` / `choice_label` for every kind and choice name.
- Choice types are "Which option / How many / Open ended".
- Dice read "2d6", never "2D".
- The built-in skill check is now a real Check card (`builtin:skill-check`).
- "result" and "change" replace "entry", "row" and "effect" in UI text.
- Pipes are deleted, not removed; `reset` reads "Reset".
**2026-11-09: roll modifiers and resizable panels** (merged to `main` as 3391388)
11. Roll modifiers: `dice_mod` on ranged roll tables, results past the dice, the end results
taking totals past the ends, live chances, plain wording and Why lines. The range and chance
code moved from roll_table.gd into `RollRange`. The shared ModifierEditor serves roll and check
cards. The demo's Room check uses 2d6 + Luck and has a vault only luck reaches.
12. Resizable tray (top edge) and inspector (left edge). The Earlier tab scrolls, and the tray no
longer grows with long Earlier rolls, sheets or chains.
**2026-11-09: UI pass** (merged to `main` as 8f16d33)
13. From an HTML mockup: striped result rows; View ▾ (Plain/Text, Collapse all, Striped rows,
Minimap) and the zoom control replace the Plain|Text switch, Collapse all, −/Fit/+ and Map;
Arrange ▾ folded into Board ▾; Search is an icon. Help ▾ and F1 open a Help window with
17 topics. Build cards get a ⋯ menu instead of the gear and footer Delete, and row × buttons
show on hover. The sample gained Luck, Make Camp (a pick card) and Search the Ruins (1d6 + Luck,
with a cave-in and a vault only a modifier reaches). New suite: test_top_bar.
**2026-11-09: fan-out fix**
14. A range on a ranged table can pipe into several cards; a new pipe no longer replaces the old one.
## 11. The 2026-11-10 plan: Table Tarot (all merged to `main`)
**Agreed with the user:** theme first; names Spread / Thread / Deck mode / Book and Pages /
Branch / Repeat; walls removed; middle-drag or Space+drag pans; a visible ☰ menu as well as
right-click; set a paused roll aside with a Continue chip; Text/Markdown/HTML instead of PDF;
cards resize in both directions with scrolling results; only "Router" → "Branch", "Loop" →
"Repeat" and odd export formats under "Other formats" from the programmer-y list; Android
export template download approved.
15. **Token diet 2.** DESIGN.md slimmed (architecture and history split out); `tools/run_tests.sh`.
16. **Theme system.** Style tokens by role as static vars; `ThemeStore` + `BuiltinThemes` (Tarot,
Felt) + `ThemeDialog`/`FillEditor`; per-card and per-thread colours.
17. **Reskin.** UI rename; logo, icon, splash; `CardFrame` beaded borders (recolouring shader);
`Sparkles` on the thread pulse and landing results.
18. **Spread interaction.** No walls; selection box; `MainSelection` (groups in the selection);
`CardGrip` resizing; `CardShield` below 45% zoom.
19. **Menus.** `Actions` feeds right-click, ⋯ buttons and ☰.
20. **Small items.** Bold chip sources, `InspectorThreads`, backwards ranges block rolling,
template Replace/Edit…, Other formats submenu.
21. **Deck mode.** Faded drawn results, inspector section, Wait for Shuffle + Empty result, Shuffle all.
22. **Nested groups** (`TableGroup.parent`), **List view** (`ListView`/`ListTree`/`ListOrder`),
**phone layout** (`MobileLayout`, `TouchInput`).
23. **The Book** (`BookPage`, `BookPanel`, `PageEditor`; linked results; undo covers it).
24. **Roll features.** `RollCombine`, `BatchRoll`, pause (`RollPauses`), `RollCosts`,
`roll_floor`/`roll_ceiling`.
25. **Sheets and pictures.** `SheetExport`; `BoardImages` (WebP in the spread file).
**Fix:** JSON export/import (`JsonIO.canonical`) used to drop every unknown key; it now keeps
all of the above (round-trip test).
26. **Help.** New topics, shortcut sheet, `DemoSpreads` + `DemoMode`.
27. **Playtest fixes.** Resize corner caught clicks outside the card (unbounded `_has_point`);
left-drag now selects in Play too.
28. **Audits.** Seven 600+-line files split by parallel agents; tests share `TestBase`. Two
computer crashes mid-run; agents were resumed from their worktrees.
## 12. Book tables (2026-11-10, merged to `main`)
The user's aim, stated while doing this: Table Tarot should handle any random roll table or oracle
procedure it reasonably can, from any tabletop RPG book. Building The Perilous Void's world
generation found four gaps; all four were built:
29. **Scales** (`var_type: "scale"`, `steps`): values stored as step names, read as step numbers in
rules; += / -= move steps; toward(); conditions like "Atmosphere is at least Thin".
30. **Columns** (multi-column tables): `columns`, `column_rolls` (row / each), `cells`; per-column
save and "only if"; per-column highlights on the card.
31. **Thread dice** ("Roll it with 3d10+70 instead") and **thread rerolls** ("Roll again if it
comes up: 96–00"). Answers the open reroll question for threads back into a card.
32. Engine by the main session; UI by three parallel worktree agents (threads, columns, scales).