From ee5439285cb02fcf3453e4c8b82afd92e696a243 Mon Sep 17 00:00:00 2001 From: Christopher Wiebe Date: Sat, 2 May 2026 19:35:03 -0700 Subject: [PATCH] M6.1: Character creation wizard foundation (.tscn + Resource-based draft) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pivots from M5's code-built UI to the editor-authorable .tscn pattern recommended in GODOT_PORTING_GUIDE.md, after a session of fighting Godot idioms with code-only layout. Default theme only; the parchment Theme lands last per the guide's §12 build order so layout bugs surface as layout bugs, not theming bugs. GODOT_PORTING_GUIDE.md: Authored by Claude Design as the canonical port reference. Maps the React prototype's structure onto Godot 4.6 with concrete code sketches and a build-order recommendation. Drove the M6 architecture. Fonts/: Cormorant Garamond (Medium + MediumItalic) and Crimson Pro (Regular + Italic + SemiBold) under OFL — the React prototype's serif-display and serif-body families. Not yet wired through CodexTheme.Build() because theming is deferred; CodexTheme.LoadFontFromFonts already picks them up automatically when the Theme pass lands. Scenes/Wizard.tscn + Wizard.cs: Wizard shell per guide §4: codex-header (title + folio counter) + Stepper + Page (StepHost + Aside) + NavBar (Back / validation / Next). All node lookups via unique-name (%) syntax; layout authored as a scene file you can open in the editor. Step lifecycle drives the Aside via signal binding. Stepper logic mirrors app.jsx — locked iff some EARLIER step is unsatisfied; "type not yet implemented" doesn't lock. Scenes/Aside.tscn + Aside.cs: Right-rail summary per guide §10. Single Refresh() rebuild on CharacterDraft.Changed; cheap enough not to bother with partial updates. Width 320 (was 380 before the layout overflow fix). Scenes/Steps/IStep.cs + StepClade.cs: Per-step Bind(draft) + Validate() contract. StepClade renders the 3-column clade card grid; click commits via CharacterDraft.Patch which triggers the Resource.Changed signal that Aside and Wizard both subscribe to. UI/CharacterDraft.cs: Resource (not Node) per guide §2.1. Mirrors app.jsx's `state` shape exactly. Patch(dictionary) emits the inherited Resource.Changed signal — listeners use `draft.Changed += handler` regardless of which field changed. CodexContent provides lazy-loaded immutable content tables (Clades, Species, Classes, Subclasses, Backgrounds). Main.{cs,tscn}: Node → Control When Main was a Node, Control children couldn't anchor to a real parent rect — they sat at (0,0) at intrinsic min size. With wide step content (3-column 200-px-card grid), the Wizard's min size pushed the navbar beyond the viewport's right edge, hiding the Next button on smaller windowed viewports. Making Main a full-rect- anchored Control gives child scenes a proper rect to lay out in. UI/Widgets/CodexStepper.cs: Anchored the inner vbox to fill the button rect. Without this, the vbox sat at the button's top-left at intrinsic size and labels rendered in the corner — visible as the active-step label being off-center from the highlight bar. Verified at 1152x720 windowed and (separately) at fullscreen: - 3-column card grid fits inside Wrap margins + Aside without horizontal overflow - Stepper labels centered under their highlight bars - Next button visible after clade selection; future steps switch to "coming soon" placeholder when clicked - Aside summary fills in CLADE block on selection Closes M6.1. Next per guide §12 build order: M6.2 — StepStats with drag-drop (highest-risk piece, de-risk before easy steps). Co-Authored-By: Claude Opus 4.7 --- GODOT_PORTING_GUIDE.md | 726 ++++++++++++++++++ .../Fonts/CormorantGaramond-Medium.ttf | Bin 0 -> 666868 bytes .../Fonts/CormorantGaramond-MediumItalic.ttf | Bin 0 -> 407796 bytes .../Fonts/CormorantGaramond-OFL.txt | 93 +++ Theriapolis.Godot/Fonts/CrimsonPro-Italic.ttf | Bin 0 -> 108828 bytes Theriapolis.Godot/Fonts/CrimsonPro-OFL.txt | 93 +++ .../Fonts/CrimsonPro-Regular.ttf | Bin 0 -> 106696 bytes .../Fonts/CrimsonPro-SemiBold.ttf | Bin 0 -> 107416 bytes Theriapolis.Godot/Main.cs | 21 +- Theriapolis.Godot/Main.tscn | 5 +- Theriapolis.Godot/Scenes/Aside.cs | 58 ++ Theriapolis.Godot/Scenes/Aside.tscn | 9 + Theriapolis.Godot/Scenes/Steps/IStep.cs | 17 + Theriapolis.Godot/Scenes/Steps/StepClade.cs | 153 ++++ Theriapolis.Godot/Scenes/Wizard.cs | 166 ++++ Theriapolis.Godot/Scenes/Wizard.tscn | 87 +++ Theriapolis.Godot/UI/CharacterDraft.cs | 106 +++ Theriapolis.Godot/UI/Widgets/CodexStepper.cs | 14 +- 18 files changed, 1543 insertions(+), 5 deletions(-) create mode 100644 GODOT_PORTING_GUIDE.md create mode 100644 Theriapolis.Godot/Fonts/CormorantGaramond-Medium.ttf create mode 100644 Theriapolis.Godot/Fonts/CormorantGaramond-MediumItalic.ttf create mode 100644 Theriapolis.Godot/Fonts/CormorantGaramond-OFL.txt create mode 100644 Theriapolis.Godot/Fonts/CrimsonPro-Italic.ttf create mode 100644 Theriapolis.Godot/Fonts/CrimsonPro-OFL.txt create mode 100644 Theriapolis.Godot/Fonts/CrimsonPro-Regular.ttf create mode 100644 Theriapolis.Godot/Fonts/CrimsonPro-SemiBold.ttf create mode 100644 Theriapolis.Godot/Scenes/Aside.cs create mode 100644 Theriapolis.Godot/Scenes/Aside.tscn create mode 100644 Theriapolis.Godot/Scenes/Steps/IStep.cs create mode 100644 Theriapolis.Godot/Scenes/Steps/StepClade.cs create mode 100644 Theriapolis.Godot/Scenes/Wizard.cs create mode 100644 Theriapolis.Godot/Scenes/Wizard.tscn create mode 100644 Theriapolis.Godot/UI/CharacterDraft.cs diff --git a/GODOT_PORTING_GUIDE.md b/GODOT_PORTING_GUIDE.md new file mode 100644 index 0000000..1ac5858 --- /dev/null +++ b/GODOT_PORTING_GUIDE.md @@ -0,0 +1,726 @@ +# Theriapolis → Godot 4.6 Porting Guide + +A companion to `README.md`. This document maps the React/HTML prototype onto a Godot 4.6 project, file by file, with code sketches for the parts that are not obvious. It assumes you've read the existing README and have a working Godot 4.6 install. + +> **Scope.** This guide covers the character-creation wizard only — the same surface the prototype covers. It does not address how the resulting character is consumed by the rest of the game; that handoff is described under "The handoff contract" at the end. + +--- + +## 0. The honest summary + +The port is **a UI rebuild, not a translation.** What carries over verbatim: + +- The four content JSON files in `data/`. +- The `state` shape used as the character record. +- All math (`abilityMod`, modifier summing, validation predicates). +- Step-gating rules and the wizard flow. +- Drag/drop *semantics* (pool→slot, slot→slot, slot→pool). + +What gets rebuilt in Godot's idiom: + +- All views (HTML/CSS → Control scenes + Theme). +- The hover-popover system (`TraitName`) → a custom `PopupPanel` Control. +- HTML5 drag-and-drop → Godot's `_get_drag_data` / `_can_drop_data` / `_drop_data`. +- The Tweaks panel — almost certainly delete it; bake one theme. + +Plan on roughly: 1–2 days for scaffolding, ~1 day per step scene, 1–2 days for the popover and drag system, 2–3 days for theming the parchment look. Plus polish. + +--- + +## 1. Suggested Godot project layout + +``` +res:// +├── project.godot +├── data/ # Copy unchanged from prototype/data/ +│ ├── clades.json +│ ├── species.json +│ ├── classes.json +│ └── backgrounds.json +├── fonts/ # Bundle these — do NOT rely on Google Fonts at runtime +│ ├── CormorantGaramond-Medium.ttf +│ ├── CormorantGaramond-MediumItalic.ttf +│ ├── CrimsonPro-Regular.ttf +│ ├── CrimsonPro-Italic.ttf +│ ├── CrimsonPro-SemiBold.ttf +│ └── JetBrainsMono-Regular.ttf +├── theme/ +│ ├── parchment.tres # Main Theme resource +│ ├── parchment_styles.gd # Programmatic StyleBox factory (optional) +│ └── paper_grain.png # Baked grain background +├── autoload/ +│ ├── content.gd # Loads the four JSON files; replaces data.jsx +│ ├── character.gd # Resource defining the character record +│ └── rules.gd # ABILITIES, SKILL_*, abilityMod(), validate() +├── scenes/ +│ ├── wizard.tscn # Root; replaces app.jsx +│ ├── wizard.gd +│ ├── stepper.tscn # 7-tab header; replaces .stepper +│ ├── aside.tscn # Right-rail summary; replaces