Skip to main content
Under Active Development

Allegory.js
Allegory.js

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.

How It Works

Allegory.js reimagines interactive fiction by treating stories as living simulations rather than branching trees.

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.

Event-Driven

No 60fps game loop. The engine idles until a user input or system event occurs, making it perfect for narrative-focused experiences.

Web-Native

Built on standard TypeScript/ESM. Leverage the browser ecosystem—CSS, WebGL, Web Audio—without proprietary compilers or tools.

Under the Hood

ECS Data Model

Entities, Components, and Systems treat your world as a relational database.

Semantic NLP

Intent classification via embeddings, not rigid string parsing.

Laws & Middleware

Decoupled logic with automatic specificity scoring and conflict resolution.

Reactive Event Bus

NPCs and systems respond to world changes, enabling emergent behavior.

example.js
// "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.");
    });
Blog

From the Blog

Thoughts on interactive fiction, engine architecture, and the craft of game development.

On Laws & Specificity

Read more
Active Development

Recent Activity

Follow along as we build Allegory.js in the open.

allegoryjs/allegoryjs

Stay up to date

Get occasional updates on Allegory.js development, new features, and insights into building interactive fiction for the web.

No spam, ever. Unsubscribe anytime.