HHLocal populates the world with AI villagers who work, trade, remember and die. The design keeps them cheap when nobody is watching, and keeps their voices stable when someone is.
Two-Tier Simulation LOD
- Active bubble. Near a human, villagers are ordinary actors: tile-step pathfinding, physics, real stations and combat.
- Settlement macro-ticks. Outside the bubble, or while every human is offline, settlements advance through 30-60 second macro-ticks. A macro-tick advances station deadlines, hunger and stamina, crop growth, claim drain and barter inventory ledgers without running tile-step pathfinding. When a human approaches, the settlement materializes seamlessly onto exact coordinates.
This is why a village can keep producing while the server is quiet without simulating every footprint.
Five specialist roles
The founder starts as a GENERALIST. As the settlement grows, the specialisation engine scores living actors against local demand and fills the five specialist roles.
| Role | Focus |
|---|---|
| TANNER_TAILOR | Hides, leather, clothing and the long tanning chain |
| HUSBANDRY | Animals, fodder and the settlement's living stock |
| MINER_SMITH | Ore, smelting and metal tools |
| FARMER_BAKER | Crops, milling and food security |
| SCOUT | Exploration, routes and early warning |
Role demand follows observed scarcity, not a fixed script. If a critical specialist dies, the engine re-specialises the best available generalist, then a surplus actor, into the vacant role and records the change as a reflection-cycle decision.
Model-pinned personas
Each active living actor pins one persona row in the single WorldStore database. The row carries:
- origin_provider and origin_alias, so the voice stays on one model slot;
- bio, mood and goal_biases;
- daily_journal and the last reflection bookkeeping.
Routing goes through dedicated one-to-one model aliases on the CT 240 LiteLLM gateway. There is no silent cross-model fallback: if the pinned provider returns 429 or is unavailable, the reflection is explicitly deferred rather than answered in a different voice. A human who has just spoken keeps the floor; a HUMAN_SPOKE timeout of more than 20 seconds may fall back to the local fleet-fast alias seeded with the persisted bio and journal.
Daily reflection
DAILY_REFLECTION is gated on the Haven sky clock, not on the 4-minute routine loop. The cadence respects a floor of at least one to two real hours and staggers one villager at a time, so a crowd does not wake up together.
Reflection output is text only: OD_SPEECH overhead bubbles plus Area Chat. There is no text-to-speech. The reply is validated and bounded into a journal entry, a mood and four goal biases, then persisted with the last reflected sky day and real timestamp.
Written Accounts and barter
Villagers leave physical traces. A Written Account is parchment or a carved runestone with a headline and body that other actors can find and read. Barter stands hold offers that persist across restarts and appear in the economy pane of the GM inspector, so an offline villager can still trade.
Permadeath and lineage
Death is permanent for the persona. The row freezes as DEAD with the death instant, cause of death and burial tier, and the journal plus private memory become read-only. Physical Written Accounts and runestones survive even a young death.
| Burial tier | Base inheritance |
|---|---|
| UNBURIED | 15% |
| SKULL_ONLY | 25% |
| BODY_ONLY | 35% |
| STATE_FUNERAL | 45% |
Inheritance is computed on simulated life length. Below eight simulated hours the fraction is exactly zero, so a deliberately short-lived character cannot farm inheritance. Above the gate the burial tier base applies, and each completed Ancestral Shrine prayer adds 6 percentage points, clamped at 45%. Only LP the ancestor actually spent is multiplied into the inherited pool.
A burial-eligible ancestor emits one short legacy_epitaph through their origin model before archiving. The DescendantSpawn heir is seeded with the new specialist role, the epitaph and distilled milestone memories, then placed on a fresh least-loaded model slot, ideally a different model family.
Emergent roads and plazas
Roads are a record of feet, not a build menu. RoadNetwork counts foot and cart traversals per tile and promotes the surface as traffic accumulates.
| Tier | Traversals | Stamina multiplier |
|---|---|---|
| WILD_TERRAIN | 0 | 1.00 |
| TRAMPLED_DESIRE_PATH | 10 | 0.70 |
| PACKED_DIRT_ROAD | 35 | 0.45 |
| PAVED_STONE_ROAD | 80 | 0.20 |
Stone paving reaches PAVED_STONE_ROAD immediately and suppresses predator spawns on that tile. Road milestones link neighbouring settlements so a villager can follow a multi-hop route deterministically.
Plaza fairs are neutral gatherings where villagers from two or more settlements meet. A fact heard at a fair spreads no further than the plaza hearing radius, and provenance is recorded, so a rumour never becomes a global map read.
Fair headless AI QoL helpers
VillagerQolHelpers gives headless villagers deterministic quality-of-life routines: choosing a drink container, ranking tool candidates, reading a danger zone. Every helper is a pure function of its arguments with no clock, database, socket or shared mutable state, so a replay and a live run agree. The helpers never widen perception: an unowned station is invisible, and a creature contributes danger only when its species is already in that actor's own learned set. Quality is compared as exact qualityMilli integers, so fractional quality survives every choice.
Where the rules live
- Two-tier LOD and tick batching: docs/ARCHITECTURE_SPEC.md and hhlocal.server
- Roles, inheritance and descendant spawn: hhlocal.work.SpecialistsAndInheritance
- Persona persistence and reflection: cognition/sidecar.py, hhlocal.work.ReflectionLedger and WorldStore
- Roads, milestones and plazas: hhlocal.world.EmergentRoadsAndPlazas
- Fair AI helpers: hhlocal.ai.VillagerQolHelpers