Simulation-First
World state is managed by a physics/logic simulation, not a narrative tree. Every object, character, and rule exists in a living, reactive world.

A Web-Native Interactive Fiction Engine
Bridge the gap between parser-based narratives and systemic game design. Write living simulations with natural language, managed by a modern ECS, directly in the browser.
Allegory.js reimagines interactive fiction by treating stories as living simulations rather than branching trees.
World state is managed by a physics/logic simulation, not a narrative tree. Every object, character, and rule exists in a living, reactive world.
No 60fps game loop. The engine idles until a user input or system event occurs, making it perfect for narrative-focused experiences.
Built on standard TypeScript/ESM. Leverage the browser ecosystem—CSS, WebGL, Web Audio—without proprietary compilers or tools.
Entities, Components, and Systems treat your world as a relational database.
Intent classification via embeddings, not rigid string parsing.
Decoupled logic with automatic specificity scoring and conflict resolution.
NPCs and systems respond to world changes, enabling emergent behavior.
// "Open box", "Lift lid", or "Check chest" all map to this handler automatically:
ThereIsAContainer('chest')
.withCapacity(10)
.containing('golden-key')
.onIntent('OPEN', ({ entity }) => {
if (entity.isLocked) {
return Failure("The chest is locked tight.");
}
return Success("The lid creaks open, revealing treasures within.");
});Thoughts on interactive fiction, engine architecture, and the craft of game development.
Follow along as we build Allegory.js in the open.