cd /news/artificial-intelligence/transformers-js-dungeon-crawler · home › topics › artificial-intelligence › article
[ARTICLE · art-154025] src=mattcool.tech ↗ pub= topic=artificial-intelligence verified=true sentiment=· neutral

Transformers.js Dungeon Crawler

A developer built a browser-based text dungeon crawler on Transformers.js that runs the storyteller model locally on the player's device, using a separate structured JSON pass to propose game-state changes that a rules layer called OpenJev validates against the generated scene. The game tracks a coordinate map of visited rooms and passages, gives each floor one to three in-game days to find the next staircase, and awards XP and loot on defeats, with two attribute points per level-up. The author cautions that structured output makes state changes checkable but "doesn't guarantee a good story," and the first visit requires a model download.

read2 min views39 publishedSep 24, 2026
Transformers.js Dungeon Crawler
Image: Mattcool (auto-discovered)

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.

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!

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @transformers.js 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/transformers-js-dung…] indexed:0 read:2min 2026-09-24 · —