This commit is contained in:
Forrest Church 2026-10-01 19:23:59 -04:00
parent 855c9c15e6
commit 1436ecf293
4 changed files with 623 additions and 0 deletions

254
gameplay-plan.md Normal file
View file

@ -0,0 +1,254 @@
# Gameplay Plan: Files TCG Table and Presentation
_Prepared 2026-10-01 from `gameplay.md`, against the Godot project in `files-game/`._
Companion document: **`ui-plan.md`**, which owns the shared design foundation (tokens, fonts, the
chamfered StyleBox, the panel-geometry constant). **Its Phase 0 is a prerequisite for everything
here** — read §2–3 of that document first.
## 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**. `gameplay.md` is, almost line for line, a request to build
M4 with the art direction settled.
Three concrete problems:
- **Cards are unreadable, measurably.** The hand renders at ~**153 × 215 px** on screen
(`HAND_DISTANCE = 9.0`, fov 45, at the 1600 × 900 base), and the inspector renders a 750 × 1050
card face into a **150 × 210** `TextureRect`. They are the same size, which is why neither works.
`godot-plan.md` §4 promises *"Hovering a card shows it large (right-click pins it)"* — never
built; right-click is Cancel.
- **The world is a physical tabletop, not cyberspace.** A suede-fabric playmat on a 64 × 1 × 52
dark-wood table. The cards are a chamfered neon HUD. The two do not look related.
- **Nothing is animated.** There are **five tween calls in the whole project**: `Card3D.glide()`
and `GameTable._place_camera()`. One generic 0.28 s glide serves draw, play and discard alike.
Damage and capture pop-ups are fired by **regex-matching log text** in
`scenes/game.gd:_pop_new_lines()` — so every reworded log line is a silently broken animation.
There is no engine event stream, so the table cannot know what actually happened.
**Outcome:** a table that reads as cyberspace, a hand you can actually read, firewalls that look
like hardware, and a game that acts itself out.
## 2. Decisions taken
| Question | Decision |
| --- | --- |
| World look | **Keep the 3D tabletop** — `playmat.glb`, seat/top camera, `Card3D`. Restyle the surface to dark glass with a neon grid inlay, black void + grid horizon, chamfered tiles. |
| Card legibility | Enlarge the 2D inspector **and** add a hand-focus mode. |
| Firewalls | Procedural RJ45 port with emissive LEDs. No custom model. |
| Animation | Port `s.events` per `godot-plan.md` §3 with a presenter queue. |
| Owner colours | Keep Okabe–Ito `#56b4e9` / `#e69f00`; add a stripe/dot pattern cue; cyan is chrome only. |
Colours used below come from `ui-plan.md` §2. The ones this plan needs: `bg #05080a`,
`accent #22d3ee`, `accent_dk #0e6b78`, owner `#56b4e9` / `#e69f00`, and a **22 px-at-750 px
chamfer**, i.e. ~3 % of the shorter edge.
The cards already use a gold **edge connector** bus to mean *"hardware plugs in here"* — so
firewalls-as-ethernet-ports (§B4) extends an established visual vocabulary rather than inventing one.
## 3. The work
### B1. The cyberspace table
`GameTable._build_room()` (`table/game_table.gd:101-146`) builds a `WorldEnvironment` with bg
`Color(0.035, 0.035, 0.045)`, ambient 0.85, filmic tonemap and **glow already enabled** at
intensity 0.4 / HDR threshold 1.2 — the bloom foundation exists. Plus a sun at energy 1.35 and a
64 × 1 × 52 dark-wood `BoxMesh` table top under the mat.
- Black void background with a neon-blue grid horizon; drop or sink the wood table top.
- Replace `assets/playmat.tres` with a dark-glass grid material. **The swap is contained:** that
`.tres` is a `StandardMaterial3D` bound in exactly one place —
`table/playmat.tscn`'s `surface_material_override/0` on `Plane_003`. Point a new `ShaderMaterial`
+ `playmat.gdshader` at that one line and the mat's look becomes a shader parameter rather than a
texture. The three suede maps (~3.5 MB) fall out of use.
- The old material carries `uv1_scale (2.284, 1.903, 1)` and `uv1_offset (0.908, 0, 0)`. Derive
the grid spacing from `BoardLayout.MAT_SIZE` (18.288 × 15.24) and the tile pitch instead, so the
grid **lines up with the locations** rather than with the old UVs.
- Raise glow once emission is the primary light source.
### B2. Chamfer the location tiles
`tile.gdshader` is a 29-line rounded-rect SDF with `radius = 0.2` and `instance uniform`
`fill_color` / `edge_color` / `glow` already in place.
Swapping the rounded-rect SDF for a **chamfered octagon SDF** is roughly a five-line change that
instantly matches the cards' chamfer across all 15 locations **and** all 14 printed card spots,
which share the same shader. **This is the highest ratio of visual payoff to diff size in either
plan — do it first.**
Add the **stripe/dot owner pattern** here too, as one more instance uniform. That is what lets
owner identity survive beside cyan chrome (`ui-plan.md` §2).
On the "large play spaces" note in `gameplay.md`: tiles are ~`5.53 × 2.06` units, about **4.3 cards
wide**. Keeping that footprint was accepted. Integrating it means making the tile read as a
*socket* — chamfered frame, corner ticks, microtext label, dim interior — rather than a grey slab.
### B3. Make the cards readable
Three levers, all already instrumented:
1. **The inspector.** `ui/hud.gd:189-194` is a `150 × 210` `TextureRect` fed by `Hud._art()`
(`:624-628`, cached in `_art_cache`). Grow it substantially; let the text panel scroll beside or
below it. Pure reuse — the full-resolution 750 × 1050 face is already loaded.
2. **Hand focus mode.** `GameTable._layout_hand()` (`:837-864`) lays the hand as a flat row
parented to the `Camera3D`. Add a mode — mouse to the bottom edge, or a held key — that expands
the hand into a large, legible 2D row drawn from the same textures, clickable, carrying the
salvage chip from `ui-plan.md` §A6. Reuse `Hud._art()`.
3. **Hover lift already exists** (`:837`, `y += CARD_SIZE.y * 0.42`). Keep it as the at-rest cue.
Also fix the at-rest case: `HAND_SHOWN = 0.62` behind a 150 px bottom panel reserve is why only a
sliver shows. Retune `HAND_SHOWN` and `HAND_DISTANCE` (`:21-22`) once `ui-plan.md` §0.4 lands —
not before, since the reserve is one of the numbers that moves.
### B4. Firewalls as RJ45 ports
`_make_gate()` (`table/game_table.gd:249-291`) builds a `PlaneMesh` diamond plus a `BoxMesh` wall
(`1 × 1 × 0.14`). `_sync_gates()` (`:461-484`) scales it by level (`h = 0.22 + 0.2 * level`), tints
it from `FIREWALL_COLORS`, and pins a `"Lv N"` 2D tag.
Replace with a procedural socket: a chamfered port body on the gateway, **emissive LEDs encoding
the level**, and a plug-in animation on place or upgrade. Scale reference: 1 unit = 5 cm, a card is
1.27 × 1.778 units, the gateway diamond is 0.34 × 0.34.
Two engine facts constrain the design:
- **Max level is `rules.firewallCost.size()`**, not a hardcoded 3 (`engine/engine.gd:619`; costs
default `[2, 4, 8]`). `FIREWALL_COLORS` hardcodes three entries and `_sync_gates` clamps with
`mini(...)`. Drive the LED count from the rules instead, or a rule variant silently caps the display.
- **Firewalls have no HP.** They are only placed, upgraded, or cleared for cost
(`engine/engine.gd:811-817`), and clearing is a *purchase* available to either player — there is
no free removal. So there is no damage state to show. The animation vocabulary is
**plug in / swap up / unplug**, not break.
Keep it legible in both the seat and top-down views; the LEDs are the level readout in top-down,
where the port body foreshortens away.
### B5. Engine events and the presenter
The foundation for every animation. Specified in `godot-plan.md` §3 and never ported — §10
confirms *"Not ported yet: engine events for animation (M4)"*.
- The engine appends **`s.events`**: `drew, moved, placed, combat started, rolled, rerolled,
damaged, destroyed, captured, Firewall changed, Bandwidth changed, counter changed`. Most zone
changes already funnel through helpers in `engine/state.gd` (`to_hand`, `to_discard`,
`gain_bandwidth` at `:417`, `say` at `:58`), so emission lands in a handful of places.
- Filter per player via `events_for(s, p)`, mirroring what `State.log_for` already does for the log.
- A new presenter plays them **in order**, then snaps the table to `view_for(s, you)`. That
ordering is the safety invariant from §3: *a missed or mis-drawn animation never leaves the table
showing the wrong state.* It composes cleanly with `GameTable.sync()` being an idempotent
full-resync and `Card3D.glide()` early-returning on an unchanged goal.
- This **retires `scenes/game.gd:_pop_new_lines()`** (`:137-164`), which infers animations by
substring-matching log text (`" captures "`, `" wins the roll"`, `"Tie,"`, `"destroyed"`) plus a
regex.
> **Conformance hazard — the one thing that will bite.** `tests/conformance.gd` fingerprints the
> state through `_body()` (`:230-235`), which shallow-duplicates and erases `defs` and `log`.
> Adding an `events` key changes that hash and **fails all 1,100 traces at once**. `_compare()`
> (`:211`) also runs the *decider's view* through the same `_body()`, so the leak would hit twice.
>
> **The whole fix is one line** — add `b.erase("events")` to `_body()`. That covers the state md5
> and the view md5 together and leaves the per-line log check alone. `godot-plan.md` §3 already
> rules that events "stay out of conformance, because TS doesn't have them". **Do it in the same
> commit that adds the key.**
### B6. The animation language
`gameplay.md` asks for flashy, warped speed trails on a **rush in → slow hold/drift → rush out**
curve. The current state: five tween calls total — `Card3D.glide()` (`GLIDE_TIME = 0.28`,
`TRANS_CUBIC`/`EASE_OUT`) and `GameTable._place_camera()` (0.45 s, `EASE_IN_OUT`). No particles
anywhere, no `AnimationPlayer`.
Build the curve as a reusable helper beside the presenter, driving: card movement **per event kind**
(a draw should not look like a discard), firewall plug-in, capture, damage, and the log drawer from
`ui-plan.md` §A3.
Speed trails suit the existing `card.gdshader`, which already carries `instance uniform highlight`
(rgb + strength) and a rim-glow term — flashes and trails can ride those **without duplicating
materials**, which is the constraint `godot-plan.md` §4 sets for card rendering.
> **Pacing is a real risk, not a detail.** A game asks each player ~367 decisions and opens ~43
> response windows. `godot-plan.md` §4 requires an animation-speed setting **including instant**,
> and a click that skips the current animation. `Card3D.instant` — a static kill-switch set by
> `tests/table_smoke.gd:46` — already exists and must keep working, or the UI test hangs.
## 4. Order
```
ui-plan Phase 0 (prerequisite)
│
├──▶ B2 ──▶ B1 (cheap visual direction first)
│
├──▶ B3 ──▶ ui-plan A6 (inspector + hand row carry the salvage chip)
│
└──▶ B5 ──▶ B6 ──▶ B4
└──▶ ui-plan A5 (bandwidth delta)
```
1. **`ui-plan.md` Phase 0 first, always.**
2. **B2 then B1.** The chamfered tile SDF is a five-line change that sets the visual direction
before the heavier world and material work.
3. **B5 before B6.** Events gate every real animation.
4. **B4 last of the 3D work** — most self-contained, and it benefits from B6's vocabulary.
**Hazards.**
- Doing **B6 before B5** means writing animations against log-string matching, then rewriting them.
- Adding **`s.events` without the `_body()` strip** fails all 1,100 traces simultaneously.
- Retuning **`HAND_SHOWN` before `ui-plan.md` §0.4** means tuning against a panel reserve that is
about to change.
## 5. 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
# Rules unchanged. THE gate for B5. tests/traces/ is gitignored and currently empty:
tools/make_traces.sh # needs the TS sim; SIM env points at files-tcg/sim
"$GODOT" --headless --script res://tests/conformance.gd -- --check
"$GODOT" --headless --script res://tests/table_smoke.gd -- --games 20
"$GODOT" --headless --script res://tests/smoke.gd -- --games 50
"$GODOT" --headless --script res://tests/bot_speed.gd # bot must stay off the main thread
# 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 full game and confirm: the hand is legible at
rest **and** in focus mode; a firewall plugs in and shows its level; a draw does not look like a
discard; captures and damage read without the log; and the animation-speed setting still has a
working **instant** option.
**Guardrails.**
- `camelCase` dictionary keys and action-type strings are the TypeScript wire format
(`s.firewalls`, `installHardware`, `bandwidthFromSalvage`). Renaming any fails every trace.
Do not tidy them.
- `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.
- Keep `Card3D.instant` working as a global animation kill-switch.
- `engine/` and `match/` use **no nodes or scenes** (`godot-plan.md` §3) so they run headless, on
the bot thread, and later on a PvP server. The presenter in B5 must live outside them.

16
gameplay.md Normal file
View file

@ -0,0 +1,16 @@
# Gameplay adjustments
## Core Overview
- For an initial prototype its not so bad but we need to work on polish.
- same as UI we should be keeping in a similar theme and feel as the cards imply. It should be like a cyberspace, tron, type of vibe. I'm thinking black baground, neon blue grid overlay
- Firewalls need reworked to better match the overall aesthetic as well instead of the rectangles currently. I think having these as "ethernet" ports that can be plugged in would be good. I can model this. "LED" lights/models can indicate lv1,2, and 3.
- The large play spaces for the servers/avatars/etc are quite distracting and large. I am okay with them staying as expansive as they are for now but again we need to ahve that integrated into the design.
- The card hover is good however it is impossible to read the cards in your hand or on the table. The only real way of seeing these cards is by looking at the card info overlay in teh top right. I want to be able to zoom in on the hand/cards so they display large and legible.
### Animations
- Flashy, warped, speed trails
- rush in - slow hold/drift - rush out sort of timing

332
ui-plan.md Normal file
View file

@ -0,0 +1,332 @@
# 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:<name>` 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.

21
ui-thoughts.md Normal file
View file

@ -0,0 +1,21 @@
# UI Redesign
### Core Overview
- UI should mimic the new desing of the cards as much as possible. We need a slightly different font system, with a more retro futuristic display font with a more legible sans-serif font (maybe mono maybe not)
- In keeping theme, we should use blue and dark grey/black as the primary colors of the interface mimicing what we have in the turn order card.
- The play screen interface is really busy at the moment and could use with some simplification.
- We should have a main menu screen that displays the logo, click start to begin, etc. In future updates we can use this for additional items such as deck building, account, multiplayer etc.
- I'm thinking for the "log" we could have that be a computer monitor/console like a terminal that is hidden by default and can be expanded to see the log.
- It would be good to have UI elements for salvaging cards when they are hovered/zoomed in for better access
- bandwidth could become an element on the playmat like a neon loading bar that fills up as bandwidth is accumulated
### Elements
- Neon Blue and Black
- angular feel similar to card designs
- Retro/futuristc "blade runner" font for display, maybe roboto for body fonts
- Rectangle/angular buttons, no circular buttons when possible
- Semi transparent overlay on modals/popups