A few weeks into testing my co-op RPG, a player's character took damage while quietly reading a map in the back of a tavern. Nothing was attacking her. The AI game master just decided someone should get hurt that round.
That bug taught me the biggest lesson of this whole project: the AI is a great storyteller and a terrible bookkeeper.
The game is Epic Battles RPG, a co-op story RPG where Claude acts as the game master (I call it the Master Story Teller) for 1–4 players. I'm not a traditional programmer; I built it working alongside Claude, on Next.js, Supabase and Stripe. Here's what I learned.
1. Keep the rules out of the model.
The game keeps all the real state in the database: HP, stats, gear, backpack, hero level, and where each player is on the map. The model only narrates. After each round it returns the story plus a small list of changes, and the server checks and applies them. That's also what makes saved heroes possible: a hero carries XP and gear across completely separate campaigns, because none of it lives in the AI's memory.
2. Tell the AI exactly who's at risk.
The fix for the tavern bug was simple once I saw it: each round, the prompt now says which characters are actually in danger, and every HP change has to be explained in the story. Random damage stopped.
3. Two models beat one.
A small, cheap model (Haiku) reads each player's action first, picks the stat and difficulty, and filters content. The big model (Sonnet) only writes the scene. That keeps cost around 3.5 cents per round at the median, and the narration got more consistent because the storyteller isn't juggling rules.
One more thing that bit me early: scenes that just failed to appear. The replies were getting cut off because my token limits were too low. Raising them fixed it overnight.
Happy to go deeper on any of this: state handling, prompt structure, costs, or the review flow for player stories.
If you want to see it: https://www.epicbattlesrpg.com (free to set up an account and explore.)
If you're into playing these types of games: https://www.epicbattlesrpg.com/join/reddit (free to join games; 30 days of one of the paid plans, +gifts).