# UI Plan: Files TCG Interface Redesign _Prepared 2026-10-01 from `ui-thoughts.md`, against the Godot project in `files-game/`._ Companion document: **`gameplay-plan.md`** (the table look, firewalls, card zoom and animation). This plan owns the **shared design foundation** that both depend on, so start here. ## 1. Why `godot-plan.md` §10 records M1 (engine), M2 (table slice) and M3 (all Set 1 cards + greedy bot) as done and conformance-clean — 1,100 traces, 1.68 M steps matching the TypeScript reference exactly. What is not done is **M4 Presentation** and **M5's start screen**. `ui-thoughts.md` is, almost line for line, a request to build M5's screens and M4's look, with the art direction now settled. The interface was built to prove the rules work, not to be looked at: - **Two duplicated colour palettes with the wrong accent.** `Hud.COLORS` (`ui/hud.gd:18-23`) and `GameTable`'s set (`table/game_table.gd:12-18`) overlap, and the accent is **teal `#2de2c4`** inherited from the browser app. The printed cards are **cyan `#22d3ee`**. - **No fonts.** Every string is `SystemFont` DejaVu, built in three separate places. - **Rounded corners.** `StyleBoxFlat` at `radius 5`; the cards are chamfered octagons. - **No main menu.** `project.godot` boots straight to `scenes/game.tscn`, which deals a live board and then opens the "New game" modal on top of it. - **A busy right column.** Inspector, source menu, and a Log/Combat/Moves `TabContainer` stacked in 340 px, with the log buried behind whichever tab was last focused. **Outcome:** an interface that reads as the same object as the cards — black, chamfered, neon cyan, terminal-flavoured — with the log out of the way and Bandwidth legible at a glance. ## 2. The design system already exists The print templates in `decks/files-deck-1/*.css` are the authoritative source. They are better specified than anything we would invent, so this plan reuses them rather than restyling by eye. | Token | Value | Role | | --- | --- | --- | | `bg` | `#05080a` | screen black | | `screen` | `#e6fbff` | primary text | | `secondary` | `#a9d9e0` | secondary text | | `muted` | `#6f8a90` | labels, microtext | | `accent` | `#22d3ee` | **system chrome** — frames, buttons, grid, terminal | | `accent_dk` | `#0e6b78` | dim borders, connectors | Per-type accents, for card-kind chips and badges: | Server | Hardware | Execution | Program | System | | --- | --- | --- | --- | --- | | `#39d353` | `#ffd24a` | `#ffb02e` | `#8b949e` | `#22d3ee` | Anomaly classes (the same V/B/G/P the card pool is organised by): | Virus | Bug | Glitch | Patch | | --- | --- | --- | --- | | `#3fb950` | `#ff5c5c` | `#d264ff` | `#4aa3ff` | Owner colours stay **Okabe–Ito** `#56b4e9` (South/you) and `#e69f00` (North/bot) — chosen so colour-blind players can tell sides apart. Because chrome cyan now sits beside "your" blue, owner identity gains a **second, non-colour cue**: a stripe fill for South and a dot fill for North, drawn in `tile.gdshader` (see `gameplay-plan.md` §B2). The browser app used exactly this pattern pair for the same reason. Shared geometry and effects, from the `.neon` rule every card template shares: - **Chamfer** 22 px on a 750 px card → **~3 % of the shorter edge**. Scale per widget. - **Border** 2–3 px solid accent. - **Glow** `0 0 16px accent, 0 0 6px accent, inset 0 0 18px rgba(0,0,0,0.55)`. - **Scanlines** `repeating-linear-gradient(0deg, rgba(0,0,0,0.16) 0 2px, transparent 2px 4px)`. - **Corner ticks** 30 × 3 px accent bars at 45° on the top chamfers. - **Emphasis chips** filled accent, dark `#05080a` text, glow — never outlined-on-dark. - **Terminal idiom** `//` section prefixes and a `round@files:` prompt line. - **Motifs** the CPU-chip badge with pin notches (cost), the gold *edge connector* bus meaning "hardware plugs in here", and rotated edge microtext. ### Decisions taken | Question | Decision | | --- | --- | | Fonts | **Orbitron** (display: logo, menu, headings only) + **JetBrains Mono** (all body/HUD text) | | Main menu | New `main_scene`, over the same black/grid world as the table | | Right panel | Log → terminal drawer; Combat → transient centre overlay; Moves stays docked | | Bandwidth bar | Fixed 0–20 Gb, ticks at 2/4/8, glow past 20, ghost segment for reachable Gb | | Owner colours | Keep Okabe–Ito; add stripe/dot pattern cue; reserve cyan for chrome | ## 3. Phase 0 — Shared foundation **Both plans style the same widgets with the same tokens. Build this once, first.** It is one new file plus two mechanical edits, and everything in both documents depends on it. ### 0.1 `ui/style.gd` — a new `class_name Style` static class The project has **zero autoloads** and 33 `class_name` statics, so a static class is the house-consistent seam. It holds: - every token above as `const Color`; - `Style.display_font()` / `Style.body_font()` returning the vendored `FontFile`s; - `Style.chamfer_box(accent, fill, width, glow)` → the chamfered StyleBox (0.3); - `Style.theme()` → the one `Theme`, replacing `Hud._make_theme()`; - `Style.type_accent(kind)` and `Style.class_accent(type)` for card-kind and V/B/G/P colours. This retires **both** palettes: `Hud.COLORS` + `Hud.OWNER_HEX` (`ui/hud.gd:18-23`) and `GameTable.OWNER_COLORS` / `MARK_COLORS` / `FIREWALL_COLORS` (`table/game_table.gd:12-18`). > `GameTable`'s own `CanvasLayer` Controls — tags at `:677`, pop-ups at `:730` — do **not** inherit > the Hud theme and style themselves inline. A static class is reachable from both. That is the point. ### 0.2 Fonts Vendor Orbitron and JetBrains Mono (both OFL) into `assets/fonts/`. **No font file exists in the repo today**; all text is `SystemFont` DejaVu in three places — `ui/hud.gd:86-89`, `GameTable._font` and `GameTable._tag_font` (`table/game_table.gd:75-78`). Route all three through `Style`. Orbitron is **display only** — logo, menu, headings. It is a wide geometric face and will not hold up in dense readouts. JetBrains Mono carries every HUD string; its metrics are the closest shippable match to the cards' Consolas, which `godot-plan.md` M4 notes cannot ship. ### 0.3 The chamfered StyleBox `Hud._box()` (`ui/hud.gd:105-115`) is a `StyleBoxFlat` factory using `set_corner_radius_all(5)` that feeds *every* panel and every button state. `StyleBoxFlat` only does **rounded** corners — there is no chamfer property — so the card look cannot be reached by configuring it. This is the one genuinely novel piece of UI engineering in either plan. **Use a custom `StyleBox` subclass**: `ui/chamfer_box.gd`, `class_name ChamferBox extends StyleBox`, overriding `_draw(to_canvas_item: RID, rect: Rect2)` and emitting the octagon through `RenderingServer.canvas_item_add_polygon()` for the fill plus `canvas_item_add_polyline()` for the accent border. Why: - A `StyleBox` is a `Resource`, so it drops into `Theme.set_stylebox()` and inherits to every child — no per-node work, and `_box()`'s call sites keep their shape. - Resolution-independent, and the chamfer is a property, so one class serves panels, buttons, chips and the drawer at different scales. - The **glow** is faked in the same `_draw`: emit two or three outward-expanded copies of the octagon at decreasing alpha before the fill. Per-widget and controllable, unlike the viewport Environment glow, which would bloom the entire HUD indiscriminately. - **Corner ticks** are a few extra `canvas_item_add_line()` calls in the same pass. Rejected: `StyleBoxTexture` 9-patch needs an authored texture per accent colour (or `modulate` gymnastics) and its corners do not rescale cleanly; a per-`Control` `ShaderMaterial` bypasses `Theme` entirely and would need assigning at ~20 sites by hand. A `StyleBox` *cannot* carry a shader, so the **scanline overlay** is separate: a `CanvasItem` `ShaderMaterial` on the terminal drawer and modal panels, layered over the chamfered box. The two compose — frame from the StyleBox, texture from the shader. ### 0.4 One panel-geometry source of truth The panel reserves are written in four places, and they **already disagree**: | Site | Left | Right | | --- | --- | --- | | `Hud.LEFT_W` / `RIGHT_W` (`ui/hud.gd:16-17`) — what is actually drawn | 300 | **340** | | `GameTable.PANEL_LEFT` / `PANEL_RIGHT` (`table/game_table.gd:25-28`) | 300 | **345** | | `_layout_hand()` (`table/game_table.gd:846-847`) — bare literals, ignores the consts | 300 | **340** | | `screen_point_for()` (`:872`) and `_fit_camera()` (`:344`) — read `PANEL_*` | 300 | **345** | The camera fit and the click-reachability test reserve 345 px while the HUD draws 340 and the hand lays out against 340: a live 5 px drift, harmless today only because nothing sits in the gap. Collapse all four onto one constant on `Style`, read by both `Hud` and `GameTable`, and delete the literals at `:846-847`. `tests/table_smoke.gd` does **not** hardcode these — it calls `GameTable.screen_point_for()`, so it inherits whichever number the table uses. That is why a mismatch here surfaces as *"a legal move is not clickable"* rather than as a layout bug. **Every item in both plans moves these numbers** (bigger inspector, log drawer, bandwidth bar, hand focus). Centralise before touching layout. ## 4. The work ### A1. Retheme the HUD Swap `Hud._make_theme()` for `Style.theme()` and `_box()` for chamfered boxes; accent moves **teal `#2de2c4` → cyan `#22d3ee`**. Then two cleanup passes that are easy to miss and are exactly what will still look wrong if skipped: - Remove the ~15 `add_theme_*_override` calls that only exist to patch the old theme — `ui/hud.gd:121, 124, 128, 133, 157, 167, 183, 187, 200-201, 208, 452, 460, 656, 681, 707, 736`. - Replace the **inline hex strings in BBCode** — `ui/hud.gd:202, 351, 361, 385, 393, 527, 529, 533, 545, 560, 574, 579, 589, 598` — with `Style`-sourced values. These are string literals inside `[color=#...]` tags and **silently ignore the theme**. ### A2. Main menu No menu exists. `project.godot` sets `run/main_scene="res://scenes/game.tscn"`, and `scenes/game.gd:_ready()` deals a live board and *then* opens the "New game" modal over it. There is also no scene manager anywhere in the project — "New game" re-inits in place. Add `scenes/menu.tscn` + `menu.gd` as the new `main_scene`: logo in Orbitron, `START`, `SETTINGS`, `QUIT`, over the black/grid background from `gameplay-plan.md` §B1 so the menu and the table read as one world. START leads to the existing `Hud.show_start()` content (seed / side / bot style) as a proper screen rather than a modal over a live game. Leave obvious slots for Deck Builder (M6), Account and Multiplayer (M8). This needs the project's **first scene transition** — add a small static `SceneRouter`, consistent with 0.1, rather than scattering `change_scene_to_file` calls. ### A3. The terminal log drawer `_log` is a `RichTextLabel` at tab 0 of `_tabs` (`ui/hud.gd:215-220`). Rebuild it as a bottom drawer styled as a CRT console: scanline overlay, `round@files:` prompt line, `//` section prefixes, monospace, **hidden by default**, toggled by **`` ` ``** and a tab handle, sliding on the rush-in / hold / rush-out curve from `gameplay-plan.md` §B6. Combat and Moves must be handled in the same pass, because all three share that `TabContainer`: - **Combat** becomes a transient centre-screen readout during combat staging. Today `scenes/game.gd:127-130` force-switches to the Combat tab on *every* combat — which is precisely what would yank the drawer open all game. - **Moves** stays docked in the right column. You click moves from it, so it cannot be hidden. ### A4. Simplify the play screen With the log in the drawer and the inspector grown (`gameplay-plan.md` §B3), the right column becomes **inspector → source menu → Moves**. The two left player panels (`ui/hud.gd:343-362`) currently carry the Bandwidth readout, a `■■■□□□` location track, hand/deck/discard/Servers counts, and a row per Anomaly. The Bandwidth half moves to the playmat bar (A5), so compress what remains into one chamfered status strip per player. Keep the phase strip (`_steps`) and the two action buttons — those are the controls, not decoration. ### A5. Bandwidth bar on the playmat A neon bar on the mat, mirrored small in the HUD. Bandwidth is a plain uncapped int (`s.players[p].bandwidth`) and the rules give it **no maximum**: it carries over between commands and rounds. So the scale is invented — **fixed 0–20 Gb, tick marks at the Firewall costs 2 / 4 / 8, glowing past 20 instead of clipping.** For grounding: card costs run 3–9 Gb and players typically sit under 15. Behind the fill, a dimmer **ghost segment** shows `Query.reachable_bandwidth(s, p, except)` (`engine/query.gd:370`) — current Gb plus the salvage value of your hand. That is the number that answers "can I afford this?", and it is the same one the engine already uses for response windows. ``` BANDWIDTH ████████░░░░░░▒▒▒▒▒▒▒▒░░░░░░░░ 0 2 4 8 20 ████ 7 Gb now ▒▒▒▒ 15 Gb reachable (+8 salvage) ``` Animating the delta needs the `Bandwidth changed` event from `gameplay-plan.md` §B5. Until that lands the bar can only snap on `LocalMatch.changed`, which carries no arguments. ### A6. Salvage on the hovered card Salvage has no affordance today. It reaches the UI only as a generic move in the Moves tab, in the picked-source menu, and in the "Not enough Gb" choice modal (`ui/hud.gd:691-694`). It is also **deliberately excluded from the glow marks** (`scenes/game.gd:199-201`) because it is *always* legal — marking it would make every card in hand glow permanently. Add a `SALVAGE +N Gb` chip to the enlarged inspector and the hand-focus row, enabled by matching the hovered `hand:` key against the salvage moves already in the move list. Keeping it hover-scoped preserves the reason it was excluded from the marks: discoverable without lighting up the whole hand. Rules note: salvage pays the card's **printed** Bandwidth and is legal whenever you must pay a cost. The chip should read as a payment, not a discard. ## 5. Order ``` 0.1 tokens ─▶ 0.2 fonts ─▶ 0.3 chamfer box ─▶ 0.4 panel geometry │ ┌──────────────────────┴───────────┐ ▼ ▼ A1 ─▶ A3 ─▶ A4 ─▶ A2 gameplay-plan B2/B3 │ │ └──▶ A5 ◀── needs B5 ──────┘ A6 ◀── needs B3 ``` 1. **Phase 0 first, always.** 2. **A1, A3, A4 as one pass.** They rewrite the same `_build_right` / `_build_left` regions of `ui/hud.gd`; doing them separately means restyling the right column twice. 3. **A2 after A1**, so the menu inherits the finished theme instead of being restyled later. 4. **A6 after `gameplay-plan.md` §B3** — the chip hangs off the enlarged inspector and hand row. 5. **A5 after §B5** for the animated delta; the static bar can land earlier. **Hazards.** Doing A4 or A5 before 0.4 silently breaks `tests/table_smoke.gd`, the camera fit and the hand layout, in a way that presents as a picking bug rather than a layout one. ## 6. Verification Custom harness — no GUT, no gdUnit4. Each test is a standalone `extends SceneTree` script run via `--script`, passing on exit code plus `Util.errors` being empty. Godot is **not on `PATH`** here. It is 4.7.2 stable at `/Applications/Godot.app/Contents/MacOS/Godot`, matching the project's 4.7 target. ```sh export GODOT=/Applications/Godot.app/Contents/MacOS/Godot cd /Users/forrestchurch/Trog-Chamber/files-game # Run this FIRST — see the note below. "$GODOT" --headless --import # Every legal move still clickable, clear of the redesigned panels. Both aspects. "$GODOT" --headless --script res://tests/table_smoke.gd -- --games 20 "$GODOT" --headless --script res://tests/table_smoke.gd -- --games 20 --threaded # Look harness — needs a display, so no --headless. "$GODOT" --script res://tests/screenshot.gd -- --out /tmp/shot.png "$GODOT" --script res://tests/screenshot.gd -- --top --out /tmp/shot-top.png ``` > **Import before testing.** `.godot/` is gitignored and this checkout's `.godot/imported/` holds > 13 entries with **no entry for `card.glb` or `playmat.glb`**. Unimported, `$Model` resolves to > `null` and `Card3D._ready()` (`table/card_3d.gd:70`) throws on every card spawned; > `tests/table_smoke.gd` then reports a meaningless *"35 unreachable move kinds"*, because picking > needs collision bodies that `_ready()` never added. That number is an artifact, not a > reachability bug — do not go hunting it. The pass covers 274 card PNGs plus two `.glb`s. > > `tests/smoke.gd` is green as of writing: 20/20 games clean in 37 s. Compare screenshots against `20261001_171420.png` (the current state) and the card faces in `files-game/assets/cards/` (the target). Then play a game and confirm: the terminal opens and closes on `` ` ``, the bandwidth bar tracks captures / salvage / spending, the salvage chip appears only when legal, and every modal is chamfered and readable. **Guardrails.** - `tests/table_smoke.gd` reaches into `scenes/game.gd` privates (`_play`, `_select`, `_paused`, `moves`) and `GameTable.screen_point_for`. Restructuring `game.gd` breaks the only automated UI test — keep those names. - `scenes/game.gd` must not call `Odds` while the bot thinks; its static caches are unlocked. New readouts (odds on the bandwidth bar, the combat overlay) must respect this. - `camelCase` dictionary keys are the TypeScript wire format (`bandwidthFromSalvage`). Renaming any fails every conformance trace. Do not tidy them.