The Pioneer Program is open. Get early access before public launch. Become a Pioneer
From the Mohio team

Why I'm Building a 40-Year-Old Text Adventure in a Language That Doesn't Exist Yet

Ron Smith 6 min read

It started as a compiler test. It turned into the best decision I've made building Mohio.

A dungeon doorway with glowing torchlight, a crystal ball and scattered maps — the world of Zork rebuilt in Mohio

It started as a compiler test. It turned into the best decision I've made building Mohio.


I need to tell you something that sounds ridiculous on paper.

I am building Zork. The text adventure from 1977. The one where you type "go north" and "get lamp" and a grue eats you in the dark if you run out of light. That Zork. Rebuilding it from scratch, in a programming language I am writing at the same time, while the compiler for that language is still being built.

And it is the smartest thing I have done.


Why Zork

When you are building a new programming language, you need something to build in it. Not a hello world. Not a todo app. Something real. Something that breaks things. Something that touches every corner of the language and forces it to work.

Zork is that thing.

Think about what a text adventure actually is when you strip the nostalgia away. It is a web application. It has routes. Every command is a request. It has a database. Every room, every object, every game state lives somewhere. It has authentication. The game knows who you are and where you have been. It has caching. You don't want to regenerate the same room description every time someone visits. It has AI decisions. What should the narrator say? What is in the room? What happens when you try something the game didn't expect?

Every primitive in Mohio gets exercised. listen for handles the commands. retrieve pulls the room from the database. find checks the cache before calling the AI. check/when/otherwise handles the game logic. upsert writes the response back to the cache. ai.generate produces the narration. The error handling, the session management, the audit trail, it all gets tested because Zork needs it.

I did not plan this. I built Zork to test the compiler and the compiler kept telling me what was broken. Every room that would not render was a bug. Every command that would not parse was a grammar issue. Every AI response that came back wrong was a confidence problem. The game became the test suite.


What the database IS

The old Zork had the game baked into the code. Rooms were variables. Objects were structs. The world was static.

In this version, the database is the game. All 34 rooms live in a table. The objects, the connections, the descriptions: all queryable, all editable, all real data. The game engine is about 213 lines of Mohio that reads from that database and renders a world.

That means the world can change. Not just through code changes but through data changes. Add a room in the database and it exists in the game. Change a description and the next player who visits sees something different. The game and the data are the same thing, which is how all applications should work but rarely do.


What changes when AI is built in

The original Zork narrator had maybe 200 canned responses. You would see the same description every time you walked into a room. That was fine in 1977. Players understood the limitations.

This version does not have that limitation.

When you walk into a room, Mohio checks whether there is a cached response for this room and this session. If there is, it serves it immediately. Fast, cheap, consistent. If there is not, it asks the AI to narrate the room in context. Your history matters. What you have already done matters. The narrator adapts.

The first time someone visits the cellar it is dark and cold. The second time they come back, after they have lit the lamp and defeated the troll, the narrator knows. It is still dark and cold, but now you are someone who has done something in this world.

That is not a feature you add to a text adventure. That is what happens when AI reasoning is native to the language you built it in.


The thing about kids and logic

Here is something I keep thinking about.

Generations of developers learned programming by reverse engineering text adventures. Not by reading them. By playing them, failing, and asking why. Why did that command work and this one did not? What is the rule? Where is the edge? The game never told you. You had to figure it out.

That is logic. That is programming. The game was a puzzle box and the puzzle was the system underneath it.

Kids still learn this way. Give a ten-year-old a text adventure and they will methodically try every combination. They are writing tests. They just do not know that yet.

I am doing the same thing at a different level. I am reverse engineering the compiler by building a game in it. Every time Zork breaks, I learn something about Mohio. Every time I want to add a feature to the game, I have to decide whether it should be a new primitive in the language. The game is the puzzle box. The compiler is what I am figuring out.


Where this goes

Zork is not the end state. It is the proving ground.

Once the base game is solid, ai.generate can do more than narrate rooms. NPCs can reason. The world can have memory that persists across sessions. The game can respond to natural language, not just parser commands. "I want to look around" works the same as "look."

Then there is miotranslate. Run the same Mohio program and the narrator speaks Portuguese. Hindi. The game world does not change. The language it speaks does.

Then there is the sector profile concept applied to a game world. sector: dungeon activates dungeon rules. sector: haunted_mansion activates different ones. The same engine, different physics.

Zork is teaching me where Mohio needs to go next. It always has been.


Why I am telling you this now

The demo is at zork.mohio.io. I will be honest with you: it may or may not be working when you read this. I am still building both things at once: the game and the language underneath it. Some days the compiler wins. Some days the game wins. Most days something breaks and I learn something.

That is what building something new actually looks like.

Mohio exists because one person decided that AI reasoning should be a first-class primitive in a programming language, not a library you bolt on. Zork exists because that same person needed something real to test it with.

The grue is still out there. The lamp still runs out of oil. And the compiler is getting better every time it does.


Mohio is an AI-native programming language in active development. Open source. mohio.io. And if you are feeling adventurous, zork.mohio.io

Share

Ron Smith

Founder of Mohio and Particular LLC. Building the first AI-native programming language from Mooresville, NC.

Mohio founder

Questions about this topic

What is Zork?
Zork is a text adventure game from 1977, one of the earliest works of interactive fiction. Players navigate a world by typing commands like 'go north' or 'get lamp.' It is widely regarded as a foundational work in gaming and programming history.
Why use Zork to test a programming language?
Zork exercises nearly every part of a language at once: routing, database queries, AI decisions, caching, session management, and error handling. It requires all these systems to work together in a real application, which makes it more comprehensive than any purpose-built test suite.
How does AI change a text adventure?
In a traditional text adventure, every room description is pre-written and static. In Mohio's Zork, the AI narrates rooms based on your history and context. What you have already done matters. Responses are cached after the first generation so repeat visits are instant and free.
What is the APPLANG caching pattern?
APPLANG caching stores AI-generated responses in the database after their first generation. On repeat visits, the cached response is served immediately without calling the AI again. Your AI cost scales with novelty, not with traffic.
Where can I try the Mohio Zork demo?
The demo is live at zork.mohio.io. It runs on Railway with PostgreSQL and is built entirely in Mohio. The compiler and the demo are being developed in parallel, so the experience evolves as the language does.
← All articles

Try it yourself

The compiler is open source. Clone the repo, run your first .mho file, and see what changes.