guts/docs/LANES/LANE_E_UIHUD.md
jing 34f84ab162 [lane F] Round 0 scaffold: docs, contracts, lane charters, bootable stub world
GDD v1 (flow-locked hybrid movement, 5 biomes + secret, boss roster),
TECH contracts (world API, level schema v0, bus events, manifest law),
ART_BIBLE (synthetic scanner look), PIPELINE (MODELBEAST-first, fal gated),
PROCESS (PROCITY lane/round law), charters A-F + ROUND1 instructions.
Seed code: shell + boot + core (rng/bus/flags) + stub world (peristalsis
shader tube, 1 draw / 102k tris, contract-complete) + qa.sh (GREEN).
Verified in-browser; evidence docs/shots/laneF/round0_stub_tube.png.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 01:28:35 +10:00

2.7 KiB

LANE E — UI / HUD / Audio engine

Mission: the instrument you fly by. Diegetic scanner HUD, screens, and the WebAudio engine that plays D's pack (or synthesizes fallbacks). You own web/js/ui/** and web/js/audio/**.

HUD (ART_BIBLE §Screens: thin cyan line-work, small caps, data-noise ticks)

  • Core readouts: mucus-coat + hull bars, heat meter, torpedo count, speed/flow indicator, combo meter, score. All driven by bus events only (TECH §Bus) — zero imports from B's internals; if a signal is missing, request the event in NOTES, don't reach in.
  • The gut-map (the star): full alimentary-canal silhouette as the campaign progress bar — current level lit, player blip moving along it, checkpoints ticked. One SVG/canvas path, hand-drawn once, used everywhere (title, HUD corner, level-complete).
  • Telegraphs: upstream-hazard pings for C (spec: level:event lookahead), boss health when boss:start.
  • Damage = feed corruption (aberration/tearing via F's post hooks + your overlay glitches), not red vignette. Death/respawn = feed drop + re-acquire sequence. Cheap DOM/ canvas overlay preferred over three.js sprites — it's an instrument overlay, let it be 2D.
  • Screens: title (over ?fly=1-style esophagus drift), pause, level-complete medal card (score/par/samples — GDD §Scoring), game-over, minimal settings (difficulty, assists, volume, ?mute respect).

Audio engine (js/audio/engine.js)

  • WebAudio graph: bed bus (crossfade per biomeAt changes), sfx bus (pooled buffers), stinger duck. Autoplay-unlock on first input (browser law).
  • Consumes D's manifest audio (ogg with m4a fallback via canPlayType). Procedural fallback law: no pack ⇒ synthesized WebAudio beeps/noise bursts so the game is never silent-broken (assets.get null path).
  • The heartbeat: a low pulse bed whose tempo maps to danger (combo/boss/coat-low — define the danger scalar from bus events, document the mapping). This is the audio identity of the game; treat it as a headline feature.
  • Sync hook: world.flowPulse phase available for pulse-aligned squelches (nice-to-have, round 2+).

You owe / consume

Owe: createHUD/createScreens/createAudio factories (TECH convention), the event-needs list in NOTES (B and C build to it), volume/mute persistence (localStorage). Consume: bus events, D's audio manifest, ART_BIBLE, F's post-processing hooks for damage fx.

Laws

60 fps law applies to the HUD too — no per-frame DOM layout thrash (mutate via transforms/ canvas; measure with ?dbg=1). Everything disposes (screens swap clean). Screenshots of every screen + HUD states in docs/shots/laneE/; audio evidence = the engine playing D's spectrogram-verified pack + a written fallback-mode check.