I started working on some NPC dialogue. The end goal is to have some basic generated backstories for NPCs in the game. If that goes well I have some long term ideas, but for now this is just flavour. I can’t program much, but I know enough about it that I can suggest a rough algorithm at least.
The basic algorithm I have uses three phrases and checks a couple things. At present I think these questions would only be available to companion NPCs.
Player question: “so, what’s your story?”
Phrase 1: no checks needed. This is a framing statement along the lines of:
Back in the day I [PHRASE 2].
Well, in a past life, I [PHRASE 2]. Seems like another world.
Tough to imagine now, but I [PHRASE 2].
Phrase 2: some of these will check to see if the NPC has a particular skill first (eg. To be a nurse the NPC has to have first aid >1) examples:
was a starving student
worked as a temp
was a bike courier
had a decent life
was a pretty big-name video blogger
The phrase 2 selection will also give the NPC a set variable “job” that lets me call on it later on when I set up more detailed dialogue trees.
Phrase 3: so far I think the check with this, if any, will just be if the NPC is a starting NPC or not. Starting NPCs don’t get a phrase 3, because the player already knows how they got out. There might also be an NPC gender check on some of them.
The third phrase will also create a set variable “survival story” that I can call on. These won’t all be unique… I have several different variations on “Evac shelter survivor” that will all get the same dialogue settings.
I made it to one of those evac shelters, but it was almost worse than what I left behind. Escaped from there, been on the run since.
I got evacuated earlier than most, wound up heading out of town to a FEMA camp. Thank God I got out of there in one piece. That’s a hell of a story in itself.
I was home with the flu when the world went to shit, and when I recovered enough to make a run to the store for groceries… Well, I’ve been running ever since.
I gotta be straight with you though: I honestly think I like this better. Fighting for survival every day? I’ve never felt so alive. I’ve probably killed a thousand of those bastards. Sooner or later one of them will take me out, but I’ll go down knowing I did something actually important.
That’s part one. I already have a pretty big repository of phrases, but I plan to make it enormous to reduce repetition. Some of the backgrounds will add some lore references as well.
Part two would be tougher to add as I understand it, but I’d like some backgrounds to trigger a second “tell me more” question, opening a new dialogue tree. This would be where those variables earlier come in, so that I can pull up references to the NPC’s history as they previously described it.
Onward, I have big visions for slowly developing this into an NPC personality system, but first I’d just like to make some simple procedurally generated backstories.