This commit is contained in:
2026-06-07 13:28:25 -07:00
parent 0df0b45163
commit 25b53cb062
25 changed files with 1573 additions and 125 deletions
@@ -0,0 +1,45 @@
---
date: 2026-06-07
type: session
tags: [session, hud, ui-toolkit, synty, presentation, juice, build, dots]
---
# Session 2026-06-07 — Expansive HUD visual pass (Synty sci-fi-soldier kit → UITK)
## Goal
Operator (via `/dots-dev`, ultracode): *"Do a pass on the HUD using the new assets that were imported. Use everything you can and make it look good and follow good design principles (both game and visual). This should be an expansive and large pass."*
The in-game HUD (DR-021) was code-built UITK but flat-colour + system font + text-only. The newly-imported **InterfaceSciFiSoldierHUD** + **InterfaceCore** kits (status/map/inventory icons, HUD panel/bar/pip/gradient/glow sprites, 640 input glyphs, Orbitron + Exo 2.0 fonts) are a complete on-theme HUD kit — harvest them into the existing observe-only `HudSystem`.
## Process
- **Verify+design Workflow (4 parallel agents):** (1) UITK runtime API correctness — empirically confirmed on the live editor: `Background.FromSprite`, `unityBackgroundImageTintColor` MULTIPLIES, code-set `unitySlice*` works even on border-0 sprites (but OVERRIDES an authored border), `FontAsset.CreateFontAsset(Font)`+`FontDefinition.FromSDFFont` is the reliable runtime SDF path; (2) build-safety — a serialized ScriptableObject-in-Resources is the build-safe way to pull curated `Assets/Synty/...` sprites into the player build (the Synty sprites are NOT in a Resources folder, so a name-string `Resources.Load` would fail); (3) exact asset manifest (real prefixed filenames verified on disk); (4) HUD layout/design spec.
- **Plan → "go" (fonts applied to shared MenuUi too) → serial implementation** through the one focused editor.
- **Adversarial review Workflow (3 lenses)** post-build → shippable, no blockers; applied the worthwhile fixes (below).
## Done
- **`HudTheme` ScriptableObject** (`Assets/_Project/Resources/HudTheme.asset`, 31 curated Synty Sprite/Font refs) — build-safe via serialized refs, loaded null-safe via `HudTheme.Get()` (mirrors `MenuUi.LoadPanelSettings`). Fonts applied as cached SDF `FontAsset`s built once-per-font-per-session via `ApplyDisplay/ApplyBody/ApplyBodyLight`; static cache + FontAssets reset on `[RuntimeInitializeOnLoadMethod(SubsystemRegistration)]`. **Every consumer is null-safe → falls back to the flat HUD if the asset/ref is missing.**
- **`HudVisualMath`** (pure, +6 EditMode tests) — low-health vignette intensity ramp + hurt-flash decay.
- **`HudUi` expansion** — null-safe skinned factories: `Panel` (9-sliced Synty box, tinted), `Bar` (skinned track), `Icon`, `Glyph` (input prompt or text keycap), `Text`/`Display` (Exo body / Orbitron display fonts). `MenuUi` Title/Caption/Button now apply the theme fonts → **menu/pause/settings re-fonted too** (one visual language).
- **`HudSystem` reworked** — framed, iconified, theme-driven layout: bottom-left vitals (health icon + skinned bar + Orbitron number, cooldown row that dims when ready, shield chip); top-left resource strip (Aether/Ore/Bio icons + counts); top-right threat (skull + count, **hidden at zero/calm**, warms+reddens under siege); center-top mission banner (Orbitron phase + countdown + **CYCLE N**, phase-coloured underline) + location sub-line + **hex-pip goal meter** (bar fallback for Target>12); bottom-center build palette with **per-structure icons** + per-resource cost icon/affordability + selection glow; **scheme-aware build-mode control-hint bar** (KBM/gamepad glyphs) with a **live conveyor-facing arrow** gated to conveyors; full-screen **low-health vignette + hurt-flash** + re-skinned downed overlay.
- **Resolves the [[DR-021_HUD_UITK_BuildPalette]] open items**: per-buildable icons + a build-mode hint line + the conveyor-facing indicator. → [[DR-024_HUD_Synty_Skin_Theme]].
## Validation (runtime, real Server+Client)
- Compiles clean; EditMode **214/214** (incl. 6 new `HudVisualMath`). Console clean of HUD errors (only benign server-tick-batching + an unrelated FMOD audio-device note).
- **4 Play states screenshotted + verified**: base HUD, build-mode (palette icons + selection glow + hint bar), low-health (red edge vignette + depleted bar), conveyor-facing (live arrow + conveyor-gated ROTATE/FACING + CYCLE readout). Theme + all 31 refs loaded non-null; HUD tree built (8 root clusters).
- Adversarial review: client-only observe-only (no sim mutation/structural change), null-safety + picking modes correct, font cache once-per-session, hurt-flash `prevHp` resets on despawn.
## Gotchas captured (→ CLAUDE.md + [[DR-024_HUD_Synty_Skin_Theme]])
- **Synty HUD frame/bar sprites ship authored 9-slice borders** (Box_Glass=25, Bar_Angled=80/0). Code-set `unitySlice*` OVERRIDES them and logs a `"borders … overridden by style slices"` ERROR per element → for bordered skins, assign the sprite + tint and let the **art border drive slicing** (no `unitySlice*`); only set slices for border-0 sprites.
- **Some Synty sprites import as Sprite *Multiple* mode** (e.g. `Gradient_Outwards`) → `LoadAssetAtPath<Sprite>` returns null silently. Verify import mode; convert to Single when curating a single-image sprite. Always verify each theme ref non-null after authoring (a wrong/odd path is a silent null, which the null-safe fallback hides).
- **Build-safe asset harvest** = serialized refs in a ScriptableObject-in-Resources, NEVER `Resources.Load("Synty/…")` (those live outside Resources → stripped from the build).
- `execute_code` safety-checks block `AssetDatabase.DeleteAsset` (use `safety_checks=false` or skip when the asset is new).
## Next-session intent
- Eyeball the HUD at a true 1920 game-view (the narrow ~945 editor window overlaps vitals↔palette — resolution artifact, fine at target res).
- Confirm the conveyor-facing arrow's compass mapping vs the world placement ghost (a 1-line `FacingDegrees` offset if the arrow art's default vector differs); optional polish: cooldown radial, throughput visuals (needs a replicated machine field — DR-020 open).