Trigger core loop events from world movement. Connect space to risk.

Location + Probability = Event. Now we connect the zones from last week to game events. Being in a dangerous area creates a chance of something happening. The world is no longer passive — it reacts to where the player is standing.

Ami — Combat Risk Engine

When the player is in the Manhattan (danger) zone, there is a small percentage chance per second to trigger an encounter. The higher the risk level, the more likely an encounter fires. For now, an encounter is just a console message — no UI yet.

// Check every frame: are we in danger? if (gameState.zone === "danger") { if (Math.random() < 0.01 * gameState.riskLevel) { triggerEncounter(); } }
Ida — Economic Growth Engine

When standing on a buildable lot, the player can press "E" to accept a job. Each job appears with a cost (materials needed), a payout (karma earned), and a simulated time to complete. Jobs are the economic trigger — without accepting one, nothing happens.

The triggerEncounter() function creates an encounter and stores it in game state:

function triggerEncounter() { if (gameState.activeEvent) return; // Don't stack events const encounter = { type: "encounter", enemyPower: Math.floor(Math.random() * 16) + 5, // 5-20 timestamp: Date.now() }; gameState.activeEvent = encounter; console.log("Encounter triggered!", encounter); }

The createJob() function generates a job offer:

function createJob() { if (gameState.activeEvent) return; // Don't stack events const job = { type: "job", cost: Math.floor(Math.random() * 20) + 5, payout: Math.floor(Math.random() * 40) + 10, duration: Math.floor(Math.random() * 3) + 1, // 1-3 cycles timestamp: Date.now() }; gameState.activeEvent = job; console.log("Job available!", job); }

Store the active event in gameState:

const gameState = { zone: "safe", riskLevel: 1, activeEvent: null, // Current encounter or job // ... other state };
  • Add triggerEncounter() function
  • Add createJob() function
  • Store active event in gameState
  • Wire triggers to zone detection from Day 10
  • Test: walking in danger eventually triggers encounter
  • Test: standing on lot can generate job
  • Checkpoint

    Walking in the danger zone eventually triggers an encounter. Standing on a lot generates a job. Both events appear in the console.

    No animations. No UI panels yet. Console output only.

    Encounter triggering every frame — use a timer or cooldown so encounters don't fire 60 times per second.

    Job generating without being on a lot — always check zone before creating a job.

    Not clearing the previous event before creating a new one — check gameState.activeEvent before firing a new trigger.

    This is where the world comes alive. The connection between space (Day 9-10) and events (today) is the core architectural insight. The player's position in the world now has consequences — that's what makes a game feel real. Ask: "Why must events be triggered by space?"