An agent-driven voxel world, run for 592 simulated days. The fear of the dark wasn't authored — it was a decaying scalar field that the colony's pathfinder learned to route around.
The simulation is a deterministic voxel world that runs itself. There are no quests and no scripted NPCs — only a population of autonomous agents, a day cycle that is for working and trading, and a night that sends monsters out of the dark.
Each agent runs a real cognitive loop: it perceives a local neighborhood, scores its options, commits to a goal, plans a sequence of actions to reach it, and remembers what it sees. Stack a hundred of those loops on a shared map for a few hundred simulated days and the interesting behavior is the behavior nobody wrote.
These are notes on the machinery that makes that possible, and on what one seed-locked run actually produced.
The result, then the mechanism
The behavior, and the field beneath it
By day 592 the colony had recorded 10,849 deaths — agents caught in the open after dark. The eye-catching part is that the town visibly reorganized itself around the danger: it routed travel away from killing grounds and pushed labor toward shelter and walls as dusk fell. That reads like fear. Under the hood it is something more precise.
The world maintains a coarse, decaying danger field over the map. A wound deposits 1.0 into its grid cell; a death deposits 6.0. The field fades at 0.97 per tick, so a killing ground is roughly half-forgotten in about twenty ticks unless something dies there again. Crucially, the pathfinder has no special rule for avoiding danger — it simply adds 4 × danger to the cost of stepping through a cell. A lethal tile therefore reads as if it were dozens of tiles further away, and routes bend around it on their own.
So the colony's "memory of where it is dangerous" is literally a scalar field with a deposit rule and a decay constant, and its "fear" is that field leaking into a cost function. You can watch it accrete after a bad night and evaporate over a quiet week. The slow mind, running separately, narrates the same state from the inside — beliefs that hardened across the population and were recorded verbatim:
“The nights are claiming too many of us.”
a belief recorded in common across the colony — emergent, unscripted“The wilds are claiming too many of us, so I'm reinforcing every wall before dusk.”
generated reflection · the same state, narrated from the insideThe field is the mechanism; the sentence is the colour. Neither was authored. That pairing — a legible numeric system, and a slow mind that gives it a voice — is the whole design.
The core architecture
Two minds, two clock speeds
The hard constraint in this kind of agent world is latency. A slow-mind call costs hundreds of milliseconds; a believable town needs hundreds of decisions per second. So each agent carries two minds, and they run at completely different rates.
▸ Fast mind · every tick
Deterministic, sub-millisecond
A utility-AI scorer feeding a GOAP planner. Pure code, no network. It decides what to do and computes the steps to do it, hundreds of times a second, identically on the same seed.
~419 ticks / second · <1 ms / decision
▸ Slow mind · off the hot path
Interior life, on a slow clock
Thoughts, dialogue, daily reflection, building design. Dispatched asynchronously and capped in-flight; results are queued and applied on the tick thread, so a slow call never stalls the world.
dispatched async · capped in-flight · non-blocking
The fast mind makes the town run; the slow mind makes it legible to a human watching. The decisive choice is keeping the slow mind strictly off the simulation's hot path — present everywhere as voice, never as a blocking dependency.
Under the hood
The hidden engine
Most of what looks like intelligence in the simulation is a handful of small, classical algorithms composed on a shared world. None of them is individually exotic; the behavior is in how they interact.
Deliberation
Utility AI with commitment
Every tick an agent scores a shared goal set — gather, build, trade, research, defend, shelter — through a personality weight vector, not a separate code path per type. A single safety term, , multiplies every work goal, so productivity collapses near a monster and after dark and recovers at dawn — a continuous field, not a state machine. The winner isn't taken greedily: the agent samples among goals within 82% of the top score, so identical agents diverge. And it commits for a short randomized stretch to avoid dithering — but a hard need (hunger, nightfall) breaks the commitment instantly.
Planning
GOAP over a recipe graph
The tech ladder — wood → stone → iron → diamond, smelting, armour, beds — is not hand-coded. It's a set of declarative actions with preconditions and effects; a means-ends planner backward-chains from a goal to the deepest action executable right now and replans each tick. Change a recipe and the plan re-derives itself. That's the line between planning and a fixed if-ladder.
Danger field
A decaying map of where it hurts
Deaths and wounds deposit danger into a coarse grid that fades every tick; the pathfinder folds it straight into edge cost (). No avoidance logic — risk-aware routing falls out of arithmetic. This is the machinery beneath the result above, and it's why the avoidance is graded rather than binary: a tile that killed someone last night is given a wide berth; one that killed someone last week barely registers.
Stigmergy
Roads that lay themselves
Nobody plans streets. Each agent drops a faint scent on every tile it crosses — heavier when hauling goods — and the scent decays slowly. Busy supply lines pack down into worn roads; abandoned paths fade out. It's ant-colony stigmergy: the road network optimizes itself from a few million footfalls, and the renderer simply draws whatever has worn in.
Market
A wage that clears the labor market
Gathering wood pays exactly what wood currently sells for. So when the chest runs low and the price climbs, the effective wage rises and labor floods into gathering; a glut drops the price and drains labor back out to other work. The workforce reallocates itself across a single price signal — a one-line wage function standing in for a central planner.
Concurrency
The slow mind never blocks the world
The slow mind runs on a thread pool with a hard in-flight cap (6 conversations, 8 plans). Results never mutate sim state directly — they're marshalled onto a queue the tick thread drains at the top of each tick, the same discipline as player commands, so there are no cross-thread races. Hit the cap or stall a call and that agent silently falls back to a deterministic template; the simulation never waits. Caching and a hard cost ceiling bound the bill.
Determinism
Bit-identical, replayable to the tick
Every stochastic draw comes from one seeded generator per world — ~55 call sites routed through it, including the spatial queries, which bucket the map into 8-wide cells and scan a 3×3 neighborhood (verified to match the brute-force scan exactly). Same seed in, identical run out, down to the order of every birth and death; the generator's state is saved and restored, so a resumed world continues the exact stream. Reproducible in fact, not just in principle.
From memory to behavior
The pipeline that produced the result
The danger field handles where it's dangerous. A parallel, four-stage pipeline handles what the town comes to believe, and it is the line that produced the emergent dread:
Witness. An event fires — a death, a theft, a structure finished. Every agent within an 18-tile radius records it, tagged with a salience score for how much it mattered; a death is maximal, a routine trade negligible.
Gossip. When two agents talk, only memories above a salience threshold hitch a ride. A retold memory becomes the listener's own, which they retell in turn — news propagates through the conversation graph rather than by broadcast.
Belief. Accumulated salient memory hardens, via the slow mind, into a stance about the world. “The nights are growing too dangerous.” “Word travels fast in this town.”
Action. Beliefs feed back into the fast mind's goal scoring, tilting the weights. The loop closes — and what began as one bad night can become a town-wide policy of building walls before dusk.
Population dynamics
It found its own ceiling
Population isn't a fixed number. Carrying capacity is recomputed live as min(housing, land, food) under a hard cap, and new arrivals appear stochastically only while the town sits below it — a logistic growth curve with no target baked in.
The run settled around 127 agents against a capacity near 102. That overshoot isn't a bug: structures are destroyed on bad nights, which knocks capacity down beneath a population that's already standing, while existing agents don't vanish to match. The result is a living tension between births, building, and nightly losses that the colony negotiates on its own, tick after tick.
A load-bearing system, idle by design
The war that never came
The town split into two factions early — anchored to districts and to high-renown leaders. The conflict system behind them is complete: armour tiers, weapons distinct from work tools, per-faction barracks, war chests, conscription, sieges, captured territory, ransomed prisoners, rare permadeath last-stands, treaties, and a stone memorial raised when a war ends.
- crimson bannersworn members
- 115
- blue bannersworn members
- 12
⚔ wars fought in 592 days: 0 — standing: allied
Across the entire run, that machinery sat idle. War is gated behind sustained, mutual hostility plus two armed musters, so it has to be earned, not stumbled into — and left alone, two prosperous neighbors drifted to an alliance instead. The interesting outcome was the system never having to fire. It only reads as restraint because the alternative was fully built and genuinely reachable.
Cost
An interior life for a hundredth of a cent
Because the slow mind is off the hot path and called sparingly, a whole population's interior monologue is nearly free. In a representative window the slow mind made 101 calls for a total of $0.0114 — about one hundredth of one cent per thought. The economics, not just the latency, are why it can be everywhere.
Field report — the 592-day run
seed-locked · replayable- simulated days
- 592
- agents at equilibrium
- 127
- deaths recorded
- 10,849
- structures standing
- 77
- factions / wars
- 2/ 0
- per thought
- ~$0.0001
- ticks / second
- 419
- tests, all green
- 207
The deterministic fast mind runs identically whether or not the slow mind is attached at all — the world never depends on it.
We wrote a set of small, legible rules. The colony wrote everything that mattered.
The simulation — an agent-driven voxel world.
~4,900 lines of deterministic simulation · 207 passing tests · per-world seeded RNG · two-speed cognition (utility-AI + GOAP fast mind, async slow mind) · decaying danger field · stigmergic road network · price-cleared labor market · live three.js viewer over WebSocket.
Quoted reflections are verbatim from agents in the run. We wrote the rules; the simulation wrote the rest.