I’ve been thinking about how we can use Transformers.js for local AI on the client side. I’ve tried it in my train game and explored browser-based agents in the AI Lab. This time, I wanted to build a text-based dungeon crawler around structured JSON output.
I’ve clearly been reading Dungeon Crawler Carl and wanted to see if I could do a similar version in the browser.
I’ve seen AI Dungeon do this with AI-generated adventures: you type what your character does, and the story responds. It’s great! Their models run in the cloud, but can we do something similar running locally in a webpage? With Transformers.js, the models download to your device and generate the story there.

AI Dungeon’s Original Quickstart. Screenshot from AI Dungeon.
In my experiment below, you build your character and then the storyteller gets your attributes, inventory, nearby characters, and recent events. It writes the next scene, then a separate structured JSON pass proposes changes to the game state. OpenJev checks those decisions against the scene. The game applies the rules for time, health, enemies, XP, and loot. OpenJev also checks whether proposed starting skills fit the background you supplied.
A coordinate map tracks visited rooms and connected passages on each floor. The storyteller sees what you have discovered, and travel distance helps determine how much time an action takes. The exit stays unknown until you find it. Hostile creatures attack outside the guide room, so exploring quickly leads to encounters.
Each floor gives you one to three in-game days to find the next staircase. Actions spend game time; reading and typing don’t. At zero, the floor collapses and kills everything still on it.
Defeats immediately award XP and collect loot, including rewards from tougher enemies’ chests. If your inventory is full, the rewards stay in the chest. Later floors drop stronger equipment. Each level-up gives you two points to assign to your attributes.
The first visit needs a download, and generation runs locally on your device. This is still an experiment: structured output makes state changes checkable, but it doesn’t guarantee a good story.
Open the book below to play and let me know what you think!