- Personal
- Live
Dungeoneering with Friends
A multiplayer AI game master where the rules engine is real code and the LLM only narrates.
- automated backend tests
- 2,457
- REST API endpoints
- 296
- rules-engine tools the AI calls
- 32
- AI game master eval scenarios
- 455
A multiplayer tabletop RPG on web and Android with an AI game master. Game rules run as deterministic code. The LLM is called only when the rules need narration or a judgment call.
What it is
Dungeoneering with Friends is a tabletop-style RPG that you play with friends, with an AI as the game master. You build characters, invite your party, and go on generated delves: one-sitting dungeon missions with combat, traps, secrets, loot, shops and bosses. Between delves there is a persistent account layer with bastions, an economy and progression.
Most "AI dungeon master" apps hand the whole game to an LLM and hope it keeps track. This one does the opposite.
Deterministic first, AI only when the rules call for it
The core design rule is deterministic mechanics, narrative LLM. Dice, DCs, attack rolls, damage, HP, conditions, the action economy, initiative, inventory, encounter budgets and loot all live in ordinary, tested Python services built on the D&D 5e (2014) ruleset. The model never gets to decide whether you hit or how much gold is in the chest. It gets the result and describes it.
- Every player message goes through an ordered gate pipeline before any model is called: mission exit, initiative lock, surrender, silly-action, social encounters, attack clarification and more. Many turns resolve entirely in code.
- Short replies like "the goblin" or "yes" are claimed by pending waiters in a fixed priority order (leave confirmation, attack target, movement, skill check, loot), so the game knows what the player is answering without asking a model.
- Intent and movement classifiers turn free text into structured actions. Skill checks are gated and rolled by the rules layer, not invented by the model.
- When the LLM is called, it works through a registry of 32 tools backed by the rules engine: location and encounter context, stat blocks, skill checks and saving throws, dice, combat (start, damage, conditions, turn order, end), party movement, loot and inventory, and campaign memory search. State changes only happen through those tools.
- The model gets full local context for the room the party is in (room JSON, encounter, party and combat state). Retrieval over pgvector is used only for things outside the room, like NPC history and past events. That keeps answers grounded and cheap.
Quick actions with free text still open
Turn-based play is easy to fumble on a phone, so the app turns the actions available on your turn into suggested quick actions: attack this target, move to that exit, search, take the loot, make the check. One tap sends a structured action that the rules engine resolves directly. A custom text box is always there too. Anything typed goes through the same classifiers and gates, and only falls through to the AI when the rules say it needs interpreting.
Ollama for free players, OpenAI for subscribers
Inference is routed per turn.
- Free players run on Ollama models in my homelab at no cost to me, through a single global FIFO DM worker. It processes one generation at a time on purpose, so a small GPU stays responsive. When the queue gets deep, players get a notice that responses are slower.
- Subscribers get fast response: their turns go to an OpenAI model through a separate dispatcher with a bounded concurrency pool. The same tools, prompts and caps apply, so behaviour is consistent across both providers.
- If the home Ollama host is unreachable, the OpenAI path is the fallback.
Free accounts get a daily budget of delve credits. Subscribers get unlimited delves through Stripe on the web or Google Play Billing on Android, tied to one account and one entitlement.
Multiplayer
- Friends by username, delve invites with Web Push notifications, invite codes for non-friends, and public open tables anyone can browse and join.
- A lobby where the roster locks when the host opens the session, players ready up, and the host starts play.
- Per-character location is authoritative, so party members can split up. The session tracks whose turn it is and gates actions accordingly.
Under the hood
- Vue 3 PWA front end, also shipped to Android with Capacitor. Flask REST API, PostgreSQL with pgvector.
- Schema-first: changes start in 74 JSON schemas, then models, API, tools and UI. The Flask API exposes 296 endpoints.
- Procedural mission generator with length tiers, topology rules (secrets never sit on the critical path), boss scaling and loot quality tied to length.
- Optional narration with a self-hosted Kokoro text-to-speech service.
- A DM eval harness that drives the same path the front end uses (post a message, queue the job, run the worker turn, poll), against an isolated database or the live cluster. It grades tool use, soft skill-check intent, research antics and creative play across 455 scenarios in seven suites, so I can compare models before I switch.
- Runs on Kubernetes in my homelab, with separate dev and prod namespaces and Android releases through Google Play.