Scenarios and templates¶
ScenarioLoader · EntityTemplate
| Kind | Engine infrastructure; data in data/ |
| Project | NextIteration.Persistence/ScenarioLoader.cs; data/scenarios/, data/templates/ |
| Exposes | POST /universes { scenario: "village" } |
| Produces | the initial graph, atomically, before the first tick |
| Status | designed · Phase 1 (#32) |
| PLAN | §15.2, §6.10, §7.3, §18.7 |
| Player | Riverside Village |
A scenario names the locations, edges, and what to spawn where; templates say what a spawned thing is. The loader builds the whole graph before the first tick, with every random value drawn from a StableHash-seeded RNG over (scenarioId, spawnIndex) — deterministic across runs, varied across NPCs.
Templates¶
{ "id": "npc_villager", "kind": "creature", "components": ["Sentient", "Mobile", "Mortal"],
"attributes": {
"hunger": { "value": 20, "variance": 10 }, "energy": { "value": 80, "variance": 15 }, "health": 100,
"perception_range": 2,
"personality_curiosity": { "min": 0.3, "max": 0.9 }, "personality_caution": { "min": 0.2, "max": 0.8 },
"personality_sociability": { "min": 0.2, "max": 0.9 }, "personality_aggression": { "min": 0.0, "max": 0.6 },
"faction_id": "villagers" } }
value + variance and min/max are sampled at spawn. Rates and durations use the unit in the key (regrow_per_day) or a string ("80/day") — see Data files. Phase 1 templates: npc_villager, building_wooden, berry_bush, wood_pile, campfire, bucket.
The village scenario¶
Eight locations with per-edge permeability (open air 0.3 heat, adjacent buildings 0.8, fire pit → inn 0.4), fifty villagers, twelve bushes, five wood piles, one pre-lit campfire, five buckets (three full), the World node with ticks_per_day: 200 — and, new in Phase 1:
The faction node. villagers (kind: "faction"), every NPC member_of it, seeded with knows edges (provenance: "seeded", observed_at: 0) to the eight locations and to every food, wood, water and vessel node. That is the village's shared knowledge; personal facts start empty and come from perception. Without it the storehouse's NPCs cannot know there is food in the forest, and the spike's whole-map gradient was the stopgap.
What the loader checks¶
Every rate parses into its key's unit; every depletable attribute in the world schema has a min; every template reference resolves; the World node exists and carries the clock constant.
History¶
| Phase | Change |
|---|---|
| 1 | Introduced: the village scenario with a faction node and seeded facts; unit-in-the-key rates; load-time checks. |
See also¶
The graph · Data files and the rate grammar · PerceptionSystem