Narrative Vision
Joe posed some really good questions in the comments here, and I’d like to address this one:
I am curious to see if there is any depth or UGC interaction across the world as it is played or whatever final vision you have in store for the player designed inputs.
I’ve talked a lot here about how I’m using AI to write the code, but haven’t really gone into depth on how I am currently using it in the game at runtime to geneate narrative content, or how I see that evolving in the future. So let’s get into it.
AI Strengths and Weeknesses
First off, let’s talk about what AI is good and not so good at. In my various experiments using it for interactive fiction games and making it DM D&D for me, I found that it’s pretty good at tying together existing ideas into something that sounds logical. It’s not great at inventing from whole cloth, especially if it doesn’t have enough context to chew on.
So my goal when using AI to generate narrative content is to essentually use it as something of an apophenia engine. For that to work, first it needs strong inputs to operate on.
AI Input #1: User Generated Content
The most obvious input right now is the user generated motivations that you type at the start of character creation. These motivations are included in many of the LLM prompts, and it’s encouraged to weave those themes into the content it generates and find connections whenever possible.
When I first wrote that screen I put in three sample answers to help clue the user in to what to do. Watching people play though I realized that since this screen happens so early they often don’t really know what to put here and just go with the default. I don’t want every game to feel too samey, so I recently added ten sample answers to each quesiton and a little button to cycle through them. Thanks to Joshua’s input I also changed it so you can directly edit the suggestion so you can find one that fires your imagination and then tweak it as you see fit.
AI Input #2: NPC Tables
The other major input to the LLM is the NPC’s motivations. Each NPC during creation is given one or two unique motivations that drives their personality. And these motivations are generated by good old table rolling, very much inspired by some of the tables found in Matt Finch’s Tome of Adventure Design.
Here’s a sample of one of the motivation tables:
{
"motivation": "Reclaim the {{roll:legendary-items}} that {{character}} stole from my family, even if it costs everything.",
"relationshipContext": "sworn enemy of"
},
{
"motivation": "Acquire the {{roll:legendary-items}} that once belonged to my family, no matter the cost.",
"relationshipContext": null
},
{
"motivation": "Outmaneuver {{character}} and be the one to {{roll:deeds}} - I will not let them take this from me too.",
"relationshipContext": "competes with"
}
This is just a small sample - there are lots of tables exploring themes of rivalry, loyalty, ambition, etc. You’ll notice that there are some variable substitutions here - the {{character}} block will be replaced with a known character (either another NPC or the player), while the {{roll:legendary-items}} tag indicates a roll on another table. There’s also an optional relationshipContext which creates hard references to other characters in the game with a contextual relationship between the two.
This is where intentional human design comes in. Yes, there’s a lot of procedural generation here, but the tables are hand written and thus can push themes and tone. The deeper down you dig in these tables the more specific the data becomes, with intent to give the game a feeling of specificity and consistency. And of course so far I’ve only written a small number of these - my hope is to continue to add to them over time and refine them to push the tone and themes I want in the game.
Speficity in Design-Time Data
Giving AI too broad a brush to paint with comes out feeling like uber-generic fantasy. I may not be there quite yet with my data, but my goal is to include highly specific details in the tables for the AI to latch onto. This is something I learned from using Jeff Rients’s What’s My Motivation tables in my D&D games.
These are some pretty great tables you can use for players who are looking for a reason for their character to be here in the first place. What I noticed using these was that the added specific details are what makes these tables sing. A motivation of seeking vengence is nice, but specifically seeking vengence agains the Troll King immediately starts to imply things about the world and gives lots of follow up questions to answer. My personal favorite entry is “PC’s parents imprisoned. Corrupt official will release them in exchange for the Star Ruby of Umman-Gorash.” This gives my character so much to work with and so many interesting questions about the world to answer!
AI Output: Encounters
Ultimately the output of all this is simply encounters, which are still largely hand-written in a sort of mad-libs template style. The LLM is simply filling in the blanks. The major exception to this is the initial encounter with an NPC, at which point the LLM is allowed to pick which templates to present to the player. As I add more systems (ie the Quest system), we’ll get more templates to pick from. But still the LLM is just picking content to combine, not inventing content from nothing.
Persistence and Longer Story Arcs
Also probably not very clear in the current build is that a lot of stuff persists across adventures. The game is meant to allow you to create a character that goes on multiple adventures in sequence, much as we do when playing D&D. Between adventures we retain lots of data – not only the player’s character, but all NPCs that survived and all legendary items and places that exist in that character’s world.
The LLM keeps a record of all player interactions with each NPC during an adventure, then compacts these down into long-lasting memories that are included in prompts in later adventures. I’m also thinking about how to provide this for the player. Maybe some short questionairre at the end of an adventure - an opportunity to update the player’s motivations and maybe quickly reflect on the adventure to use as context in future. I see this as kind of allowing the player to write their character’s backstory, but slowly over time in bite sized increments.
My hope is to keep developing these ideas to allow for larger scale story arcs that evolve over the course of many adventures. That said, I know that LLMs are not great at bringing narrative to resolution, so I’ll be looking for ideas on how to achieve that as I go. This is the real guts of this project for me honestly, to give me a sand box in which to explore solutions to exactly this kind of problem.
Adventure Modules
Another under-developed idea I have lurking at the end of my roadmap is creating “adventures”. I want to be able to write high level templates for adventures that seed things like specific items, places, NPCs, and goals while still having entry points to weave in the current existing dynamic content. I think of this like writing a D&D module, but with more blank spaces and mad-libs-esque entry points for the game to fill in. But they should include enough of a skeleton to make it feel like you’re going on a specific adventure to say go find the Star Ruby of Umman-Gorash to rescue your parents.
And if that works, maybe I even open up creation of these adventure modules to the users. I think it would be pretty cool to have a means of creating and sharing cool adventures to run your characters through. But that sort of thing is a long way off. There are still lots of pretty big problems laid out above for me to solve before we can get to that!