Various

DnD Storyteller

DnD Storyteller

Side projects and learning

Side projects and learning

Tell novel stories personalized to a DND game, using OpenAI’s API linked to a Google sheet powered front end.

Tell novel stories personalized to a DND game, using OpenAI’s API linked to a Google sheet powered front end.

Role

Role

Explorer, designer, developer

Explorer, designer, developer

Team

Team

Me + the internet

Me + the internet

Timeline

Timeline

2 weeks

2 weeks

Overview

I play DnD with my friends weekly, and have used Chat GPT to help write a TTRPG scratch to great effect. I thought it would be fun to learn how to write a more custom implementation of GPT for regular DnD sessions.

DnD Storyteller


I play DnD with my friends weekly, and have used Chat GPT to help write a TTRPG scratch to great effect. I thought it would be fun to learn how to write a more custom implementation of GPT for regular DnD sessions.


I didn’t want to try and challenge the creativity of a human storyteller, but at the beginning of each session it can be nice to start with some “flavor” about what’s going on in a town to set the mood.


My opportunity was then to take the GMs story they had set up and have GPT connect some dots and paint a scene with no impact to the important story.


My web app takes data from a Google Sheet about a town and it’s inhabitants, and can either write about what a few inhabitants are up to (including a minor conflict), a bar scene or the consequences of a die roll.


I expedited the beginning by forking an existing project for the UI and then I learned and used VS studio spaces as my IDE, Express / Node as my application framework, Render for continuous deployment, OpenAI’s API, Mid Journey for the art, and a third party Google Sheets API for importing user entered data.


You can try it, but be patient (it takes a while to respond) and I do have a monthly limit on the API calls.

Check it out

System diagram

System prompts


The prompt passed to Open AI tells the system to be a DnD storyteller. This happens behind the scenes so the user doesn’t have to pass it through every time. It’s surprising how simple priming the system to interpret subsequent input is!

The town and it’s residents


In general, it’s a terrible idea to use a spreadsheet as a database. However! This didn’t need to scale past 1 user. I also wanted to make sure that our game master could easily update and change things as the game went on. It allowed me to format the data in way that was visually parsable, and left the door open for rewriting to the cells as well.


In the future, I could save a summary of events in a different cell and refer to to them for subsequent calls, giving the program a memory and making it that much more helpful for adding flavor.