magicciv/.project/objectives/p3-13b-geological-events.md
Natalie 2fe49402de fix(@projects/@magic-civilization): 🐛 update objective tracking stats and legend
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-13 15:30:51 -07:00

6.3 KiB

id title priority status scope owner updated_at evidence blocked_by
p3-13b Geological events — earthquake, volcanic_eruption, landslide p3 done game1 shipwright 2026-05-13
src/simulator/crates/mc-mapgen/src/events.rs:206-283 — derive_events emits earthquake/volcanic_eruption/landslide gated by boundary_kind / (is_active_volcano || plate_kind) + mountain_proximity / mountain_proximity+moisture
src/simulator/crates/mc-mapgen/src/events.rs:24-39 — typed GeologicalEvent struct (kind-tagged like WeatherEvent in p3-13a)
src/simulator/crates/mc-mapgen/src/events.rs:183-198 — geo_roll routes rolls through SeedDomain::Geological via mc_core::seed::derive_step (replaces inline det_roll mixer)
src/simulator/crates/mc-core/src/seed.rs:60-66 — SeedDomain::Geological = 8 appended after AiRollout so existing ordinals stay frozen; 3 new tests pin ordinal + distinctness + per-tile-channel determinism (geological_ordinal_is_eight, geological_domain_is_distinct_from_other_domains, geological_derive_step_is_stable_per_tile_channel)
src/simulator/crates/mc-core/src/grid/mod.rs:238-247 — is_active_volcano: bool on TileState with #[serde(default)], default false; closes the is_active_volcano bullet without breaking save back-compat (older saves deserialise as false and fall through to the plate_kind proxy)
src/simulator/crates/mc-mapgen/src/events.rs:240-249 — eruption branch gates on (is_active_volcano || plate_kind ∈ {VOLCANIC_ARC, HOTSPOT}); flag is authoritative when set, proxy retained for back-compat
src/simulator/crates/mc-mapgen/src/events.rs:286-486 — 9 tests passing (cargo test -p mc-mapgen events::): original 6 + volcanic_eruption_fires_on_active_volcano_flag_without_plate_kind + volcanic_eruption_back_compat_plate_kind_when_flag_default_false + determinism_swap_to_seed_domain_is_stable
public/resources/events/geological_thresholds.json — trigger thresholds tuned to EVENT_FREQUENCY_SPEC.md (seismic ~0.003/turn, volcanic ~0.002/turn); canonical JSON path (no duplicate added under data/balance/)
src/simulator/crates/mc-mapgen/src/lib.rs:18-19 — re-exports derive_geological_events / GeologicalEvent / GeologicalThresholds
src/simulator/crates/mc-sim/src/event_dispatch.rs — dispatch_world_events calls derive_geological_events; geo events routed through mc-ecology::tile::apply_damage (Land + Air channels) and ChronicleEntry::WorldEvent; dispatched in mc-sim (above the mc-turn cycle boundary)
cargo test -p mc-sim event_dispatch:: → 4/4 PASS (p3_13_event_dispatch_geological_applies_land_damage, biological_plague_applies_water_damage, anomalous_fog_populates_fog_map, noop_without_grid)
cargo test -p mc-core seed:: → 10/10 PASS · cargo test -p mc-mapgen --lib → 59/59 PASS · cargo test -p mc-core --lib → 249/249 PASS · cargo test -p mc-ecology --lib → 324/324 PASS

Context

public/games/age-of-dwarves/docs/terrain/TECTONICS.md provides per-tile mountain_proximity and plate-boundary classification. This objective wires those into a mc-tectonics::derive_geological_events(turn, world) -> Vec<GeologicalEvent> step, emitting earthquake (boundary-adjacent low-prob roll), volcanic_eruption (active-volcano tiles), landslide (high-slope + saturated, joins flood from p3-13a).

Acceptance

  • mc_mapgen::events::derive_events (re-exported as derive_geological_events) returns earthquake, volcanic_eruption, landslide events keyed by tile per rules in TECTONICS.md + EVENT_FREQUENCY_SPEC.md. (src/simulator/crates/mc-mapgen/src/events.rs:142-256) Note: lives in mc-mapgen not mc-tectonics — the latter crate does not exist; tectonics is a module in mc-mapgen, so events derived from plate state belong there.
  • ✓ Each event variant emitted as kind-tagged GeologicalEvent struct (mirrors WeatherEvent shape from p3-13a — no separate enum, kind in a String field for serde wire compat). (src/simulator/crates/mc-mapgen/src/events.rs:25-39)
  • ✓ Roll seeded via SeedDomain::Geological (variant 8, appended after AiRollout so existing worldgen ordinals stay frozen). Per-tile rolls flow through mc_core::seed::derive_step(seed, SeedDomain::Geological, &[turn, col, row, channel]) (mc-core/src/seed.rs:60-66, mc-mapgen/src/events.rs:183-198). Save back-compat preserved: existing TileState ordinals untouched; only is_active_volcano: bool was appended with #[serde(default)]. Old det_roll mixer removed.
  • is_active_volcano: bool field landed on TileState (mc-core/src/grid/mod.rs:238-247) with #[serde(default) = false]. Eruption branch (events.rs:240-249) gates on (is_active_volcano || plate_kind ∈ {VOLCANIC_ARC, HOTSPOT}) — the flag is authoritative when set, the plate_kind proxy is retained as a fallback so saves predating the field keep firing eruptions. mountain_proximity still scales severity (magma-pressure proxy).
  • mc-ecology::tile::apply_damage wiring — mc-sim::event_dispatch::dispatch_world_events routes each GeologicalEvent through apply_damage(TileEcoState, DamageChannel::Land, severity) (and additionally Air for volcanic_eruption). Dispatch lives in mc-sim (not mc-turn) to avoid the mc-turn ← mc-mapgen ← mc-ecology cycle. ChronicleEntry::WorldEvent pushed per event. Covered by p3_13_event_dispatch_geological_applies_land_damage in mc-sim. (src/simulator/crates/mc-sim/src/event_dispatch.rs:104-120)
  • cargo test -p mc-mapgen events:: green — 6 tests including earthquake_only_at_plate_boundary, volcanic_eruption_only_on_volcanic_plate, landslide_requires_slope_and_saturation, determinism_same_seed_same_events. (src/simulator/crates/mc-mapgen/src/events.rs:262-372)

Source-of-truth rails

  • Rust crate: mc-tectonics owns geological event derivation.
  • JSON path: public/resources/tectonics/_config.json (probabilities, severity ranges).
  • mc-core wrapper: GeologicalEvent enum; reuses EventSeverity from p3-13a.

Out of scope

  • New plate-boundary classification — already shipped in worldgen.
  • Player intervention to prevent eruptions — magic-school work, Game 3.
  • Long-term landform regeneration — single tick effect only.

References

  • public/games/age-of-dwarves/docs/terrain/TECTONICS.md
  • public/games/age-of-dwarves/docs/terrain/WORLDGEN_RNG.md
  • Sibling: p3-13a, p3-13c, p3-13d