feat(simulation): add Layer-2 inter-settlement road/rail graph (T-1038)

New deterministic cascade layer (CascadeLayer::RoadGraph) building the
transport topology between Layer-3 settlement placements, stored on
BodyWorldState.road_graph (session-cached, never serialized).

- MST force-connect (strict Kruskal over squared distance) + secondary
  links across a 30-60% body-scale band where the MST detours >1.5x.
- A* over the Layer-1 terrain-cost field on a coarse ~64-wide routing grid:
  ocean/lake impassable, river corridors 1/2 cost, slope >=35deg (D-210
  roughness ~0.7) 10x, else the D-210 terrain_modification_cost. Columns
  wrap (equirectangular); integer costs + index tie-break keep A*
  deterministic.
- MaintenanceAuthority per edge (new generator.rs enum) from endpoint
  political archetypes + haul length; waypoint nodes at long-edge midpoints;
  named-route identity join (designed-for, pool empty post-D-223); junction
  detection (high_connectivity_junctions, degree>=3).

Wired into the cascade (gen_queue requests CascadeLayer::RoadGraph). Adds
Copy to PoliticalArchetype. 10 road_graph unit tests + a cascade e2e test;
full suite + clippy --all-targets -D warnings green.

Deferred to T-1076 (gated on the D-242 settlement model): the RailHeadFacing
junction pass (needs a D-213 FoundingOrientation amendment + Layer-4 handling)
and the hub-selection refinement (needs baked population/specialization).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-14 20:13:26 +02:00
co-authored by Claude Opus 4.8
parent 301be77b49
commit c0d4ac89d1
7 changed files with 1249 additions and 28 deletions
+24 -1
View File
@@ -373,7 +373,7 @@ pub enum SettlementClass {
/// Dominant power structure of a settlement and its physical spatial expression.
/// Derived from TerritorialStatus + economic_role at generation time.
/// Source: D-214
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq)]
pub enum PoliticalArchetype {
/// Top-down Commission planning; rectilinear, institutional core, radial-core arrangement.
Commission,
@@ -406,6 +406,29 @@ pub enum FoundingOrientation {
Free { bearing_degrees: u16 },
}
/// Who maintains an inter-settlement road/rail edge — readable in the road's
/// condition (Ozzie: "you can tell who controls territory by the state of the
/// roads"). Derived at Layer-2 road generation from the endpoint settlements'
/// political archetypes + the edge's haul length (no separate authoring).
/// Five-value vocabulary frozen by the cascade workshop (workshop-outcomes.md
/// "OQ-R3-4"); see [`crate::atlas::road_graph::maintenance_authority`].
/// Source: D-211 (Layer-2 transport), D-212 (territorial status input).
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum MaintenanceAuthority {
/// Government-built/maintained — a Commission (or strategic Military) endpoint.
Administrative,
/// Corporation-maintained — a Corporate endpoint (e.g. road to a corp mine).
Corporate,
/// Locally maintained short links between neighbouring small settlements.
Communal,
/// Long-haul inter-regional routes between distant non-state settlements.
Trade,
/// Roads that exist but are no longer maintained (a Derelict-province
/// endpoint, or runtime abandonment). Not reachable from the current
/// authored data alone (D-212 Derelict is deferred) — wired for forward use.
Abandoned,
}
/// Territory control status for a province (drainage basin). Priority-ordered derivation.
/// Source: D-212 (amended 2026-06-05 — see `AutonomistHeld` + the dominant_faction
/// mapping note on the variant docs and in `attractor_matching::territorial_status_from_faction`).