Skip to content

feat(world,engine): 1-deme-per-hex 169-hex urban/rural simulation & 2.5D illustrated shader world - #2

Merged
arrase merged 5 commits into
mainfrom
feat/single-deme-illustrated-world
Nov 9, 2026
Merged

arrase merged 5 commits into
mainfrom
feat/single-deme-illustrated-world

Conversation

@arrase

@arrase arrase commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR implements the Single-Deme-Per-Hex Urban/Rural Simulation & 2.5D High-DPI Illustrated/Shader World Overhaul:

1. Spatial Exclusivity (1-Deme-Per-Hex) & 169-Hex World Scale (map_radius = 7)

  • Enforces cell.deme_ids.size() <= 1 across all turn phases, flood/mountain relocations, warband invasions, colonist budding, and snapshot imports (WorldState.from_dict).
  • Expands all 3 scenario presets (The Rift Valley, Darwin's Archipelago, The Finite Island) to map_radius = 7 (169 hexes) and fixes HexMath.get_neighbor_ids caching ((q + 16) * 32 + (r + 16)).
  • Locks horizontal camera rotation (yaw_deg = 0.0) so 2.5D isometric architecture, mountains, and perimeter walls remain permanently aligned with the hex grid.

2. 4-Tier Urban Hierarchy (I..IV), Urban Salubrity (salubrity) & Rural Hinterlands (crops / pasture)

  • 4-Tier Settlement Hierarchy: I · Campamento / Camp, II · Aldea / Village, III · Villa / Town, and IV · Metrópolis / Metropolis.
  • Rural Hinterlands (crops & pasture): Tier II (1), Tier III (2), and Tier IV (4) cities cultivate adjacent uninhabited terrestrial hexes (owner_deme_id) connected by rural farm tracks with animated covered_wagon traffic. Raiders and besiegers can pillage rural hexes into scorched ruins (has_ruins = true) to starve fortified cities without triggering extra Ollama LLM calls.
  • Urban Salubrity & Epidemics: High urban crowding and multi-hex union density degrade deme.salubrity ([0.05, 1.0]), dampening positive demographic growth and triggering "epidemic" outbreaks (salubrity < 0.35, population >= 130).

3. Dual Synoecism & Occupied-Hex Interactions

  • Territorial Invasion: Defeated defenders retreat to an empty passable neighbor hex or are absorbed in place.
  • Asymmetric Category Absorption (tier_a != tier_b): Lower-tier allied settlements merge into higher-tier cities (merged_count += 1), converting their vacated hex into a cultivated rural hinterland (crops or pasture) owned by the host city.
  • Continuous Multi-Hex Walled Unions (tier_a == tier_b >= 2): Same-tier allied cities unite under a shared walled_union_id, remaining on their respective hexes while pooling combat defense, culling their shared internal wall edge, and linking their plazas with a central cobblestone union boulevard.

4. 2.5D High-DPI Illustrated & Shader World (v3_illustrated_hdpi)

  • GPU Shaders: ocean_waves.gdshader, hex_terrain.gdshader, and prop_sway_glow.gdshader.
  • High-DPI Illustrated Sprites (TEXTURE_FILTER_LINEAR_WITH_MIPMAPS): 256x224 biome hex tiles, 128x128–160x160 isometric buildings (hut_thatch, house_clay, house_stone, granary, windmill, watchtower, temple_totem, citadel_keep, cathedral, crop_field, pasture_pen, palisade_wall, stone_wall, covered_wagon, ruins_stone) with #23150c ink outlines and mipmaps.
  • Ollama System 1 Context & Prefetch Alignment: Enriched geopolitical context and cache signatures (compute_deme_evaluation_signature) with 1-deme-per-hex neighbor states, salubrity, owned_rural_count, and walled_union_id, and aligned prefetch_for_state with post-EvoEnvPhase state for 100% next-turn cache hit rate.
  • Documentation & Screenshots: Updated README.md, AGENTS.md, src/**/README.md, and gh-pages/ with 8 fresh 1920x1080 screenshots.

Verification

  • godot --headless --path . --script res://tests/test_runner.gd -> PASSED: 623 | FAILED: 0

…t action agency

Social behaviors (expansion, warfare, raiding, alliances, trade, tribute coercion, betrayal, and unification) previously failed to emerge organically because settlements scored 7 abstract archetypes that were diluted across a 75/25 heuristic blend and gated behind rigid probability and trait thresholds.

Redesign the cognitive and biophysical engines around direct, target-bound settlement agency:
- Build a per-settlement feasible action menu (`EvoActionMenu`, 16 action types) where each option's `/v1/systemone` criterion is its exact quantified expected payoff (`EvoOutcomeForecast`) computed by shared biophysical formulas (`EvoPayoffs`).
- Provide natural-language situation briefings (`EvoSituationReport`) combining strategy doctrine, caloric balance, causal feedback from the prior turn's chosen action, sliding episodic memory, and bilateral neighbor trust, feuds, truces, and open proposals (`EvoRelations`).
- Sample concrete actions (`deme.chosen_action`) via temperature-sharpened policy sampling (`EvoActionPolicy`, `T = 0.65`) with zero heuristic weight blending and no coarsened signature caching, and expand the default Ollama context window to 16384.
- Split turn resolution into modular phases (`EvoEconomyPhase`, `EvoDiplomacyPhase`, `EvoConflictPhase`, `EvoSettlementPhase`) driven directly by each settlement's chosen action and target.
- Replace the Lab Decisions tab with editable strategy doctrines (`StrategyDef.doctrine`) and add a live multi-matchup Ollama emergence harness (`tests/sim_emergence.gd`).
…y for emergent agency

Live `/v1/systemone` evaluations showed that settlements under-selected raids, conquests, tribute coercion, and betrayals while over-selecting immediate alliances and premature city unifications because:
- Non-forage forecasts stated only incremental food deltas rather than total expected harvest (`base_income + bonus/loot`), biasing the decision model toward `forage`.
- Unallied same-lineage neighbors automatically contributed defensive power and defenders mobilized a disproportionate share of population against raids, depressing attacker win probabilities and filtering `demand_tribute` out of the menu.
- Newly budded camps (`pop >= 45`) could immediately propose `unite` and get reabsorbed into their parent settlement, and foreign settlements could propose alliances at zero trust on first contact.
- `EvoConflictPhase` aborted `betray` actions when the allied target belonged to the same founding lineage.

Key changes:
- Include expected base harvest alongside action-specific payoffs across all `EvoOutcomeForecast` descriptions so the LLM compares total food and territorial stakes on an equal footing.
- Restrict automatic allied defense reinforcement in `EvoPayoffs.defense_power` to active pacts and walled unions, add a martial attack bonus for `cul-warrior-expansion`, and calibrate raid/conquest troop mobilization and surprise betrayal loot caps.
- Require `SETTLE_MIN_POP = 80` for colonist budding, require established allied towns (`pact_turns >= 3`, `tier >= 2`) for `unite`, require minimal trust (`trust >= 0.12`) before proposing foreign pacts, and allow opportunistic `betray` against wealthy allies when hungry or martial.
- Allow `betray` to execute against same-lineage allies in `EvoConflictPhase.resolve` and update canonical forecast assertions in `test_engine_biophys.gd`.
@arrase
arrase merged commit a0b298e into main Nov 9, 2026
5 checks passed
@arrase
arrase deleted the feat/single-deme-illustrated-world branch November 9, 2026 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant