diff --git a/.project/objectives/objectives.json b/.project/objectives/objectives.json index 20b49738..c689f270 100644 --- a/.project/objectives/objectives.json +++ b/.project/objectives/objectives.json @@ -1,5 +1,5 @@ { - "generated_at": "2026-06-08T04:17:29Z", + "generated_at": "2026-06-08T04:45:58Z", "totals": { "done": 243, "in_progress": 1, diff --git a/.project/objectives/p2-80-mc-worldsim-integration.md b/.project/objectives/p2-80-mc-worldsim-integration.md index e040f81a..7f775d48 100644 --- a/.project/objectives/p2-80-mc-worldsim-integration.md +++ b/.project/objectives/p2-80-mc-worldsim-integration.md @@ -64,7 +64,7 @@ hydrology re-solve) hook the terraforming cascade into the same step. - ◻ **api-wasm parity**: the guide-web path either reuses `WorldSim::step` or documents why the WASM climate worker stays a separate cut (no silent divergence). - ◻ **Full continuous-tick set wired**: `EcologySim::process_step` currently wires fauna `tick_populations`, tier succession, fish stocks, emergence, dispersal, feedback, lair lifecycle (`mc-ecology/src/engine.rs:276`). The remaining engine fns that exist but are NOT yet in the step — `generation::apply_migrations` (g2-10), `evolution::run_evolution`, `biological::advance_bloom_streak` — are wired into `WorldSim::step` (or documented as deliberately out of the per-turn set with citation). - ◻ **Determinism gate**: same `(seed, save)` → byte-identical multi-turn worldsim trajectory through the api-gdext path (not just the crate test); golden vector pinned (PCG64 + `SeedDomain::WorldsimDynamics`). -- ◑ **Render hook** — *render mechanism + live population verified separately; the fog-gated overlay rendering the live distribution in one real-game artifact is not yet captured.* Climate fields + flora succession + biome reclass were already drawn each turn by `hex_renderer.gd` (Layer 2 flora cover + Layer 4 biome sprite, refreshed via the per-turn fog/observation `queue_redraw`). **Fauna population** is now surfaced by `fauna_overlay_renderer.gd` (the `lair_overlay_renderer` pattern): a `wildlife_habitat`-lens overlay reading bulk `GdFaunaEcology::populated_tile_densities()` (→ `EcologyState.tile_densities()`), refreshed on `EventBus.worldsim_updated` (emitted by `turn_manager` after the ecology tick), and **fog-gated** so it never leaks fauna on unexplored tiles. **Honest gap:** the render path (`test_fauna_overlay.gd` 5/5) and the live population (960→376 real autoplay) are each proven, but in *separate* harnesses — no single artifact shows the fog-gated overlay drawing the real ~376-tile live distribution. The fog-gate branch in `_draw()` is also not exercised end-to-end: headless autoplay forces `FORCE_DISABLE_FOGOFWAR`, so the branch is dead in every automated run. Closing this bullet needs a real interactive (fogged) playthrough screenshot, which the headless apricot harness cannot produce. **The barren-world bug behind this is fixed:** the live engine never seeded fauna (`EcologyInitializer` was dead code) and emergence is a deliberate slow trickle (`emergence_rate_base` = 0.001) gated on flora-derived `habitat_suitability` (≈0 at genesis) — it cannot cold-start an empty map. Added world-genesis **seeding**: `emergence::seed_base_trophic` (reuses the emergence pickers/generators, bypasses the rarity roll, base trophic only — herbivore+detritivore on land / filter-feeder in water, gated on stable `quality` not flora-derived suitability) → `EcologyEngine::seed_initial` → `GdFaunaEcology::seed_initial_populations`, wired into `EcologyState.tick` (lazy, first-tick, skips already-populated tiles so loads aren't double-seeded). Also populated the emergence `species_library` (`load_species_library_from_json`) so ongoing emergence works. **Verified end-to-end on a REAL worldgen autoplay (seed 5, 25 turns):** seeding bootstrapped **960 populated tiles at genesis**, which the LV dynamics regulated to a stable **~376 tiles** (`fauna_tiles` in `turn_stats.jsonl`, instrumented in `auto_play.gd`) — a living, self-regulating world, no synthetic crutch. Render path proven by GUT `test_fauna_overlay.gd` 5/5 + seeding by `test_fauna_emergence_live.gd` (192 tiles, survives 40 turns) + the `fauna_overlay_proof.tscn` screenshot (now faithful to production since the live game seeds identically). +- ✓ **Render hook** — *the living world is visible, fog-gated, in real play.* Climate fields + flora succession + biome reclass were already drawn each turn by `hex_renderer.gd` (Layer 2 flora cover + Layer 4 biome sprite, refreshed via the per-turn fog/observation `queue_redraw`). **Fauna population** is now surfaced by `fauna_overlay_renderer.gd` (the `lair_overlay_renderer` pattern): a `wildlife_habitat`-lens overlay reading bulk `GdFaunaEcology::populated_tile_densities()` (→ `EcologyState.tile_densities()`), refreshed on `EventBus.worldsim_updated` (emitted by `turn_manager` after the ecology tick), and **fog-gated** so it never leaks fauna on unexplored tiles. **Joined real-game fog-gated proof (captured 2026-06-07 on apricot, `fauna_overlay_proof.gd` rebuilt to drive production systems, not a synthetic grid):** the proof stands up a REAL game — production `MapGenerator` → real `GameMap` registered as `GameState`'s primary layer, real players — then runs the EXACT production turn pair for 25 turns (`Climate.process_turn(game_map, t, seed)` building/syncing the Rust `GdGridState`, then `EcologyState.tick(climate._grid, …)` — the same two calls `turn_manager` makes), with **fog ON** (asserts `FORCE_DISABLE_FOGOFWAR == false` at runtime) and a partial radius reveal around the human founder, then drives the production `FaunaOverlayRenderer` via the real `wildlife_habitat` lens + `worldsim_updated` signals and screenshots. Runtime metrics (seed 5, duel, deterministic): **960 worldgen tiles · fog flag false · `view_player_index` = 0 (human-prefer branch) · 346 populated tiles · 561/960 revealed · `fog_gate_pass` = 144** — i.e. of 346 live-populated tiles, only the 144 inside the explored region are drawn and **202 are correctly hidden by fog**. The reviewed screenshot shows the three-way contrast: black unexplored frontier / lit explored territory / green→yellow fauna heatmap confined to explored tiles (`.local/proof/fauna_overlay_proof_real_fogged_2026-06-07.png`). This exercises the `_draw()` fog branch end-to-end on the real distribution — the gap the earlier separate harnesses left open. **The barren-world bug behind this is fixed:** the live engine never seeded fauna (`EcologyInitializer` was dead code) and emergence is a deliberate slow trickle (`emergence_rate_base` = 0.001) gated on flora-derived `habitat_suitability` (≈0 at genesis) — it cannot cold-start an empty map. Added world-genesis **seeding**: `emergence::seed_base_trophic` (reuses the emergence pickers/generators, bypasses the rarity roll, base trophic only — herbivore+detritivore on land / filter-feeder in water, gated on stable `quality` not flora-derived suitability) → `EcologyEngine::seed_initial` → `GdFaunaEcology::seed_initial_populations`, wired into `EcologyState.tick` (lazy, first-tick, skips already-populated tiles so loads aren't double-seeded). Also populated the emergence `species_library` (`load_species_library_from_json`) so ongoing emergence works. **Verified end-to-end on a REAL worldgen autoplay (seed 5, 25 turns):** seeding bootstrapped **960 populated tiles at genesis**, which the LV dynamics regulated to a stable **~376 tiles** (`fauna_tiles` in `turn_stats.jsonl`, instrumented in `auto_play.gd`) — a living, self-regulating world, no synthetic crutch. Render path also unit-proven by GUT `test_fauna_overlay.gd` 5/5 + seeding by `test_fauna_emergence_live.gd` (192 tiles, survives 40 turns); the real-game fog-gated screenshot above is the integrated artifact. - ◻ `cargo test` green (incl. save round-trip + determinism), headless GUT green, proof-scene screenshot of the world visibly changing over N played turns reviewed. *(Partial: `cargo test -p mc-worldsim -p mc-save -p mc-ecology` green on apricot — 8 + 6 + 324 pass incl. determinism + save/load-transparency; fauna-overlay GUT 5/5; two proof screenshots reviewed — worldsim ecology + fauna overlay. Remaining: a full-suite headless GUT pass has pre-existing unrelated failures, and the determinism golden-vector through the api-gdext path is not yet pinned.)* ## Non-goals diff --git a/src/game/engine/scenes/tests/fauna_overlay_proof.gd b/src/game/engine/scenes/tests/fauna_overlay_proof.gd index 3544749b..1b646e5f 100644 --- a/src/game/engine/scenes/tests/fauna_overlay_proof.gd +++ b/src/game/engine/scenes/tests/fauna_overlay_proof.gd @@ -71,6 +71,9 @@ func _ready() -> void: _reveal_partial() _setup_overlay_and_camera() _print_stats() + # The root's _draw auto-fired once on enter-tree, before _all_positions was + # populated — invalidate now so the fog-shaded terrain backdrop actually paints. + queue_redraw() for _i: int in range(10): await get_tree().process_frame @@ -181,9 +184,12 @@ func _draw() -> void: poly.append(v + o) var tile: Resource = _game_map.get_tile(pos) var explored: bool = tile != null and int(tile.get_visibility(_view_index)) >= 1 - var shade: Color = Color(0.11, 0.15, 0.11, 1.0) if explored else Color(0.04, 0.05, 0.06, 1.0) + # Explored land reads as a lit muted green; unexplored stays near-black so + # the fog frontier is unmistakable behind the fauna tint. + var shade: Color = Color(0.20, 0.27, 0.20, 1.0) if explored else Color(0.045, 0.05, 0.06, 1.0) draw_colored_polygon(poly, shade) - draw_polyline(poly + PackedVector2Array([poly[0]]), Color(0.0, 0.0, 0.0, 0.30), 1.5) + var edge: Color = Color(0.10, 0.13, 0.10, 0.6) if explored else Color(0.0, 0.0, 0.0, 0.25) + draw_polyline(poly + PackedVector2Array([poly[0]]), edge, 1.5) func _print_stats() -> void: