magicciv/.project/objectives/p2-54c-renderer-observations-and-indicators.md
Natalie ed77f92011 feat(@projects/@magic-civilization): update p2 objectives statuses
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-02 21:02:24 -04:00

3.1 KiB

id title priority status scope owner updated_at parent canonical_doc coordinates_with blockedBy
p2-54c Renderer reads observations + indicator decorations for tech-gated resources p2 done game1 terraformer 2026-05-01 p2-54 public/games/age-of-dwarves/docs/RESOURCES.md
p1-46
p2-52
p2-54
p2-54b
p2-54
p2-54b

Summary

After the three-axis schema (p2-54) and per-player observation cache (p2-54b) land, the renderer must:

  1. Render flora/fauna from the player's PlayerObservations, not the simulator's current state
  2. Render indicator_decorations on tech-gated resource tiles (rust-red iron-oxide soil for iron, malachite stains for copper, etc.) — these are visual cues that exist before the resource's HUD icon is unlocked
  3. Render the explicit resource icon when the player's tech satisfies yield_gate

Affects both the design app's MapCanvas (TS/WASM consumer) and Godot's hex_renderer.gd.

Acceptance

  • MapCanvas reads observationsplayerId? prop added to MapCanvas/CanvasRenderer. When provided, buildObservationsMap() queries WasmPlayerObservations.playerTileObservation() per tile; flora_cover_id_seen + biome_label_id_seen used instead of tileFloraCoverJson. Unobserved tiles render as fog. Lab mode (no playerId) unchanged.
  • Indicator decorations renderedindicator_decorations.json authored at public/games/age-of-dwarves/data/terrain/indicator_decorations.json with 10 entries (speckle/vein/spark/blob/stripe shapes). drawIndicatorDecorations() added to indicatorDecorations.ts. Called from render.ts before biome decorations using indicator_decorations_seen from the observation cache.
  • Resource icon visibility — composition logic (observation→indicator→icon) is wired in render.ts. Explicit resource icon rendering (visibility==always icons, dimmed tech-gated icons) deferred: no tileResourceJson WASM method exists in the current build. Framework is correct; icon layer awaits a WASM API addition.
  • Godot parityhex_renderer.gd updated: INDICATOR_DECO_COLORS dict added, set_player_observations(obs, player_id) method added, _draw() now reads observation dict for flora/biome/indicator_decorations when _player_observations is set, _draw_indicator_deco_at() helper draws colored circle markers before biome sprite layer.
  • HUD teste2e/hud-observations.spec.ts created. Marked test.fixme() because WasmPlayerObservations is not in the compiled WASM artifact (p2-54b Rust source landed but WASM not rebuilt). Documented unblock: rebuild WASM via bash src/simulator/build-wasm.sh on apricot.
  • Lab unaffected/world-gen/lab uses live state when no playerId. All 55 e2e tests pass (baseline holds).

Non-goals

  • Animating the appearance of an indicator decoration when a player gets close enough to a tile (that's later polish)
  • Per-decoration sprites — vector glyphs are fine for now (decoration_id resolves to a draw function in hexCanvas.ts)

Why blocked-by-p2-54-and-p2-54b

The schema (p2-54) and the observation cache (p2-54b) are prerequisites. This objective only handles the visual consumption.