LLM Running Text RPG as Dungeon Master
I originally wanted to play D&D with Claude as the DM. I didn't want to build a web app that pays per token for a hobby game. So I built it as a skill that runs on paid plans. Later, I figured out this is a great way to test new models as you are continually talking to them and "listening" to how they react. BTW, the new Claude Opus 5.5 is really fun with this.
Your LLM like Claude or ChatGPT runs the story: the world, the people in it, the rulings.
A small Python script runs all the numbers. It rolls the dice and tracks hit points, spell slots, gold and inventory. It refuses an illegal change, like casting with no slot left or spending gold you don't have. Every roll shows on screen and is saved in a log
The LLM never touches the dice. It can't fudge a roll, even to save me.
In my first real session, a roll of 3 at disadvantage failed hard, and the LLM made a story to make me pay for it. Every number on my character sheet was right at the end of the test.
What's in it:
- Levels 1 to 5. Fighter, Rogue, Wizard, Cleric. 43 spells and 44 monsters from the 5e SRD.
- One world, with five ways to start the story.
- A plain folder as your save game, so you can stop and come back days later.
- Free and open source (MIT). No API key, no server, and no network code in the script.
It runs in the Claude desktop app (what used ot be Cowork), Claude Code, the ChatGPT desktop app, and OpenAI Codex. It doesn't run in plain claude.ai on the web, because the game needs a folder for saves. You also need Python 3.9 or newer (baked into Claude Cowork which is why I went this way)
I built it with Claude Code. It went through five AI playtests via Codex before I played it myself.
Install steps for each app are in the README: https://github.com/bradbushSFAI/tabletop-dm
SPOILER ALERT: If you want to play it unspoiled, stay out of the `seeds` folder and `metaplot.md`. That's where the secrets live.
Fell free to fork it. I probably not going to support it, but let me know what you like and what you don't like.
Posted Sep 25, 2026, 7:47 PM UTC