Building an AI game engine by simulating less

I started Lore in April 2026 after working on Sleeve and its Eidolon game. Lore was not a direct extraction from Sleeve. It was a separate game-engine project where I could apply what I had learned. I used ideas from LangGraph as an initial reference, then kept only the parts that fit the project.

The first design tried to simulate every nearby non-player character separately. Each character received its own context about what it knew and perceived. A model decided what each character wanted to do, and the engine combined those decisions into the next scene. A turn could take up to two minutes because it required several model calls. It was also expensive. Players do not want to wait that long for every action.

The current version uses freeform text instead of options. The player can enter anything. One model call interprets the message and turns it into a plausible character action using the possibilities supplied by the engine. Another writes the narration and dialogue using only the selected context. Dangerous or consequential actions can still move into a more detailed resolution process. The average turn now takes about 20 seconds.

Ruby owns the game state and rules. A player's message expresses intent, but it cannot declare an outcome or invent facts. Models interpret that intent and write prose without changing canonical state directly. Their output must match a structured contract before anything is committed. An invalid result can be retried or rejected without advancing the story. This prevents generated prose from silently becoming game state.

The harder problem has been the quality of the generated scenes. Early results repeated themselves, contradicted earlier events, hallucinated details, or gave weak responses. The engine also had trouble deciding whether a player's message described an action or something the character was saying. Getting the scene text and NPC behavior to a passable level required many rounds of changes to prompts, context, and validation. The balance between response speed and quality is still not right.

I built the Unleaving Inn as a constrained scenario for that work. The player finds themselves in a strange inn without their memory. The limited location and cast made it possible to test the engine's mechanics in a contained setting. I created the core concepts and characters. Language models helped fill in the details.

Coding agents wrote all the code. I directed the architecture and implementation, and I read most of the code before approving the pull requests. I used skills to guide the work, and review agents checked it throughout development. I started building reusable Ruby and Rails skills during Sleeve and refined them during Lore because agents kept making the same mistakes around application boundaries, validation, error handling, and tests.

The longer-term idea was a shared open world generated as play continued. A game master could author parts of it, but that would not be required. Work on that version has not really started. Lore remains a basis for future projects.