Skip to content

Simulation Model

The headless analytical simulation is Toaster Chef's primary deliverable. It is scenario-driven, agent-calibrated, and exports SimulationOutcome JSON. The Phaser game is a secondary visualization surface; the simulation runs and matters whether or not anyone is watching it.

Server-authoritative design

All game and simulation state lives on the Colyseus server — NPC positions, power, inventory, Community Trust, life-state transitions, crime events. The client renders state and sends input; it never mutates state directly. Map generation runs exclusively server-side, which prevents cheating and guarantees every client sees the same world. (Full technical detail in Architecture.)

Three tracked resources

The simulation balances three resources through cooperation:

  1. Money — donations and Donor Moments → hiring, buffs, infrastructure
  2. Food — Chef output and donations → serving NPCs
  3. Community Trust — good service, delight, relationships → unlocks infrastructure and new areas

A fourth resource, Carbon Footprint, is a [HYPOTHESIS] design direction — not committed. See Architecture.

NPCs as simulation participants

The simulation is unified, not two parallel systems. NPCs in the world are siMPowerUp participants; a Kitchen Garage is a Circle facilitator; serving food to an NPC is responding to a help request. Each NPC carries a housing state (housed ↔ unhoused), an employment state (employed ↔ unemployed), hunger, trust, and an emotional state. Transitions are driven by food access, nutrition quality, and Community Trust over time.

The NPC life-state model is a simplified simulation. It is not an accurate model of how poverty or food insecurity work in reality, and must not be described as one.

Scenarios and batch runs

Behavior is parameterized through ScenarioConfig JSON files loaded on room creation. Three named scenarios establish the baseline:

Scenario Purpose Key parameter
baseline.json Tier-2, moderate need, no bad actors — performance floor badActorFacilitatorFraction: 0.0
high-need.json Tier-3 urban, demand > helper capacity npcCount: 100, responseRate: 0.55
bad-actor.json 15% predatory facilitators — tests trust collapse and automation bias badActorFacilitatorFraction: 0.15

All three keep mpwr.enabled: false until siMPowerUp's token economy comes online (Layer 2+). The eventual headless batch mode (Layer 4) runs scenarios without the visualization and exports a SimulationOutcome per run. The simulation clock can compress time — at timeScale: 100, help-request expiry windows (critical 6h / urgent 24h / routine 72h) collapse to ~3.6 / 14.4 / 43.2 minutes of real time per run.

Map generation

Maps are generated deterministically from a seed, server-side only, then serialized to JSON and synced to clients:

  1. Seed the RNG; build a street skeleton (cellular automata via rot-js).
  2. Place Kitchen Garages and other points of interest by Poisson-disk sampling on street tiles.
  3. Generate hunger / crime / poverty heatmaps with simplex noise (createNoise2D()); zone size scales with map tier.
  4. Seed NPCs on street tiles (Tier 1 ≈ 20, Tier 2 ≈ 60, Tier 3 ≈ 150), each NPC's need level derived from its zone.

Three map tiers scale difficulty: Tier 1 (Corner / Trailer Park — small, mistakes hurt), Tier 2 (Suburb / Small Town — needs hired Pilots, infrastructure matters), Tier 3 (Urban — dense, multiple garages, full simulation active).

Calibration and validation status

A sub-agent ecosystem calibrates scenario parameters against real-world research (community-kitchen costs, census/USDA need data, mutual-aid network studies). Every output is tagged [SIMULATION OUTPUT] — a marker between [HYPOTHESIS] and [PILOT VALIDATED]. Simulation results narrow uncertainty but never substitute for field data and are never promoted to [PILOT VALIDATED] without real users.