When we first started prototyping Ashfall Chronicles' NPC system, we made the classic indie mistake: we tried to build everything at once. A fully simulated society. Needs, memories, relationships, economics. The dream of a living world so convincing players would forget it was authored.
Eighteen months later, with half the team burned out and a behaviour tree that crashed the engine every time more than 30 NPCs made decisions simultaneously, we threw it all away and started from scratch. This is the story of what we built instead — and why simpler, in this case, turned out to be far more interesting.
The Problem with Full Simulation
The appeal of simulating every NPC as an autonomous agent is obvious. If each character has genuine needs, motivations and memories, emergent stories will arise naturally. You don't have to write them — you just set the system running and watch.
The reality is more complicated. Full simulation is computationally expensive, notoriously difficult to debug, and — most critically — it produces behaviour that is often incoherent from the player's perspective. A character who acts with perfect internal consistency but whose motivations the player has no way to read might as well be a random number generator.
"A great NPC isn't one who behaves realistically. It's one whose behaviour is legible, surprising and meaningful — ideally all three at once."
We needed a system that felt alive without actually being alive. The key insight that unlocked our approach came from an unexpected place: theatre.
Actors, Not Agents
Traditional game AI thinks in terms of agents — autonomous entities pursuing goals in a simulated world. We decided to think in terms of actors — characters performing a role, with the performance adapted to their scene partner (the player) in real time.
Every NPC in Ashfall has three layers: a public persona (how they present to the world), a private state (what's actually going on), and a threshold (the conditions under which the gap between those two becomes visible). The drama of interacting with an NPC comes from sensing that gap and figuring out how to cross the threshold.
The behaviour tree drives the public persona. It's deterministic, legible and cheap to run for 200 characters simultaneously. The private state is a small set of flags and counters — not a full simulation, but enough to give each character something to protect. The threshold logic is hand-authored for named NPCs and procedurally generated for ambient characters.
The Breakfast Bug
No AI postmortem is complete without the bug that broke everything. Ours, which we affectionately called "the Breakfast Incident," occurred during an early playtest when we noticed that every single NPC in the starting settlement was attempting to prepare food at exactly 7:43am, regardless of what they were doing when the clock ticked over.
The cause was embarrassingly simple: our schedule system used a global time check rather than an individual delay offset. Every character had the same default "prepare morning meal" entry in their schedule, all triggering simultaneously on the first frame after 7:00am game time. Fix was two lines. Documentation of the lesson took considerably longer.
What the bug actually taught us was more valuable than the fix. When every NPC did the same thing at the same time, it was immediately, viscerally wrong — not because individual NPCs were behaving unrealistically, but because the population as a whole was too synchronized. Real communities aren't synchronised. Variance is the signal of life.
We added noise to every scheduled behaviour thereafter. Not randomness — noise. Noise is structured, organic, patterned. It makes a crowd feel like a crowd rather than a grid.
What We'd Do Differently
If we were building the system from scratch today, we'd invest earlier in the layer between individual NPCs and the player's perception of the world. The question isn't "how do I simulate a believable character?" — it's "how do I give the player the tools to project believability onto a system that's much simpler than it looks?"
Players are extraordinarily good at this. They want to be fooled. They want to find meaning in patterns. Our job is to make sure the patterns are there to find — and that when a player discovers them, the discovery feels earned.
Ashfall's NPCs don't think. They perform. But after 40 hours in that world, most players will swear they do.