Side project · C# + OpenAI
AI Dungeons & Dragons
A procedurally generated console RPG. Dice rolls pick the setting, enemy, and objective from curated story banks, and a chained GPT conversation acting as dungeon master turns them into a unique adventure every run.
- When:
- Apr – Oct 2023
- Role:
- Solo
- Stack:
- C#, .NET 7, OpenAI API, GPT-3.5 Turbo, Prompt chaining
Overview
One of my first LLM projects, built in 2023. You create a character with Health, Strength, Speed, Magic, and Luck stats, then play through a four-chapter adventure: an intro, encounters, an optional side quest, and a final battle. No two runs are the same.
How it works
Each chapter appends to a single chat conversation, so the model always has the full story so far. A system prompt casts it as the dungeon master.
01
Character
Stats: HP, Str, Spd, Magic, Luck
02
Dice rolls
Pick from curated story banks
03
Rules in code
Stats + RNG decide outcomes
04
GPT narrates
Dungeon-master system prompt
05
Next chapter
Appended to same conversation
↺ Repeats for each of four chapters, with full story context
Design decisions
- Curated story banks of locations, enemy types, elements, objectives, NPCs, and combat verbs act as a small domain vocabulary. Dice rolls choose from them, so the model riffs on a coherent setup instead of inventing from nothing.
- Outcomes are decided in code. Stats and dice rolls determine whether a side quest succeeds, how much you heal, or whether you fall in battle. The model then narrates the result, so the story can’t contradict the game state.
- Some calls use low temperature and tight token limits to keep the prose short and on-script.