True Radiant quests with GPT and LLMs?

Discuss Daggerfall Unity and Daggerfall Tools for Unity.
Hurricane Otter
Posts: 35
Joined: Wed Nov 30, 2016 12:09 am

True Radiant quests with GPT and LLMs?

Post by Hurricane Otter »

With the rapid progress in large language models like ChatGPT, it appears the stage is set for a golden age of artificial intelligence in video games. The remaster of this beloved game, spearheaded by the brilliant efforts of Mr. Interkarma and so many others, means the table is set for our beloved Daggerfall as well.

One of the biggest complaints about Daggerfall is that it gets stale. The quests are copy-pasted versions of each other with mad-libbed names and dungeons.

LLM architecture could solve that problem. Unique, one-of-a-kind quests generated on the fly by a built-in AI! Not just "go here kill this," but generated stories with twists and fully formed characters. The possibilities!

If you haven't tinkered with ChatGPT, it's possible you might not recognize what this could mean. Not just for Daggerfall, but for all video games.

But yes, also for Daggerfall. :lol:

What if every character's story were *truly* unique?

What if *every* quest were custom-generated and tailored to the previous decisions of the player?

What if these weren't just sprite billboards, but fully realized characters, with new text generated by an AI every time you click on them?

Imagine if you weren't just limited to clicking "Yes" or "No," but if you could have text input with them, similar to talking to ChatGPT. Or text-to-speech, for greater immersion.

Each conversation gets tokenized, saved in the game files. They can be pulled up by the game and iterated on as much as you like through the normal gameplay loop.

You could make actual friends. Even romances, if you like.

Enemies you make in the early game could pop up again and again, working against your interests from one end of the bay to the other. Not just in one-off quests, but storylines that span dozens or even hundreds of quests.

And it would never be the same twice. Each playthrough would be 100% unique and different.

All of this is possible right now in some form with open-source transformers like GPT-2. Obviously 3 and 4 are off the table, but at the rate the tech is moving, I bet open-source catches up fast.

Has anyone else been thinking of this?

Is anyone pondering what I'm pondering? ;)

User avatar
Jay_H
Posts: 4061
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: True Radiant quests with GPT and LLMs?

Post by Jay_H »

I understand your excitement, and in the future this'll probably be something that games like Daggerfall could implement. However, I don't have the impression that ChatGPT is the engine that'll accomplish it :) In spite of its domination in the headlines, I find ChatGPT to be extremely underwhelming. Ask it to design three Fighters Guild quests for Daggerfalll, and it'll give you the exact same prompt three times, with one or two details changed -- which is the exact problem you're trying to avoid :lol:

Now, that's only touching the dialogue. Once you have to combine dialogue with a quest script, we're talking Everest-sized difficulties for something like ChatGPT. Linking a plausible storyline to multiple variables, and then using those variables in a changeable quest script, and make sure the machine doesn't forget what it's doing every 10 seconds... We're gonna need many more years before it becomes consistent at that.

I'm aware of the Mount and Blade dialogue prototype, and I can tell that there are seeds for development there. But ChatGPT is grievously limited in its creative capabilities. I imagine we'll have to wait until these systems get compressed enough that they can run on your local computer, without burning out your entire GPU as well.

Hurricane Otter
Posts: 35
Joined: Wed Nov 30, 2016 12:09 am

Re: True Radiant quests with GPT and LLMs?

Post by Hurricane Otter »

I don't doubt that ChatGPT isn't the right engine, if only because it would require access to the ChatGPT API, which has a paid model. I don't think there's an appetite for players to pay real-life money every time the game generates quest text, even if it is only fractions of pennies. Rather, you would have to implement a transformer that's open-source, can be run on consumer-level hardware, and can be packaged in something like a mod or DFU extension.

In March 2023, that might too much of a lift to get the kind of quality we'd all like to see. But at the rate the tech is moving right now, this time this year, it might be EXTREMELY possible. Certianly within three years, I think the odds are 100%.

I'm surprised to hear your opinion on ChatGPT, though! I hear your critiques, and they make some sense to me in the scope of GPT-3.5 -- but the more recent GPT-4 tech has blown me out of the water insofar as its ability to 1) write compelling dialogue/story beats, and b) code. Have you used the more recent version?

A lot of it comes down to prompting, too. If you tell it: "Act as a creative writing aid, innovating creative new storylines for quests in Daggerfall with compelling characterization, human emotion, realistic and gritty dialogue, and intriguing plot twists. Come up with original ideas and content without being given specific tasks or additional user input." ...I'll bet it would do pretty darn well. Give it a few examples of how to use Daggerfall code and I'd be real surprised if it can't pull it off equally as well as a human quest writer. The trick is adapting something like this to work on the fly as a background process that gets called whenever the player talks to an NPC or initiates a quest.

I've sunk probably 200 hours into ChatGPT so far, so I'm pretty familiar with it, and a lot of it I've found comes to how good your prompt is. I'm not familiar enough with Unity or the LLM back-end to know how to implement anything like this, but I can dream. :D Perhaps we could just ask ChatGPT for instructions on how to code it and implement it for us? :D

User avatar
Sluggy
Posts: 20
Joined: Tue Aug 23, 2022 9:28 pm

Re: True Radiant quests with GPT and LLMs?

Post by Sluggy »

Ultimately it doesn't come down to how good the language model is because that's the window dressing. It comes down to the systems that actually generate the quest goals, the actions needed to be taken by the player, and the systems that judge the success or failure of those goals based on those actions - something that a language model has zero capacity for. ChatGP can't make plot twists or dynamically generated goals because it fundamentally has no concept of what any of this means. They are just words or really combinations of letters to it. 'Rescuing a child from a dungeon' means exactly the same thing as 'Smashing up a shop to extort money' in gameplay terms, which is to say - nothing. They have no meaning to any language model and because as such there is no way they can judge the completion or quality of work done on such actions.

In the end it would be up to the game devs to createthe goals and mechanics which is exactly why things like the radiant quest system are what they are and work how they work. The rules and goals define the gameplay, not the story text.

Hurricane Otter
Posts: 35
Joined: Wed Nov 30, 2016 12:09 am

Re: True Radiant quests with GPT and LLMs?

Post by Hurricane Otter »

Sluggy wrote: Mon Mar 27, 2023 8:05 pm It comes down to the systems that actually generate the quest goals, the actions needed to be taken by the player, and the systems that judge the success or failure of those goals based on those actions - something that a language model has zero capacity for.
Oh, I don't think this is right at all!

It's true, a LLM can't rewrite mechanics or modify the game's core programming -- yet. To use your example, it can't create a new quest condition where you have to smash up the windows on the shop. Because smashing up windows isn't a feature that's programmed into the game. As such, the LLM would have no way of tracking it or understanding it.

But a LLM is definitely capable of generating entirely new quests on the fly within the parameters it DOES understand:
  • Interact with x person in y location
  • Interact with x item in y dungeon
  • Escort x person to y location
  • Bring x item to y person
  • etc.
You can tell a lot of story within the bounds of what the vanilla game allows you to do! And LLMs can ABSOLUTELY code. If you teach an LLM to code Daggerfall quests, it can code Daggerfall quests. The trick is devising a way for the LLM to inject its generated code/quest text into the message box.

Sluggy wrote: Mon Mar 27, 2023 8:05 pm The rules and goals define the gameplay, not the story text.
But I don't think it's right to say the text is just "window dressing" and therefore irrelevant to people's gameplay experience. This goes double for a game like Daggerfall! Remember, a lot of us fell in love with this game because it was a virtual life simulator.

In vanilla, I go down to the Bat and Wolf Tavern. I click on the barkeep, a box comes up that allows me to rent a room, buy food, buy drink, or cancel. It's boring, stale.

Conversely, what does a LLM allow you to do?

Let's carry this out to the (somewhat fanciful, but still THEORETICALLY POSSIBLE with CURRENT TECHNOLOGY) scenario.

A mod has come out which abolishes the vanilla yes/no dialogue box. Now, EVERYTHING in the game is done through natural language. I wear a headset on my head and talk into my microphone, and the game translates my speech to text.

With a LLM, I talk to that same barkeep.

Barkeep (text box popup): "OH! It's so good to see you again, Andel! It's been an age since you've been here in here! What have you been up to? Gone delving into another shithole dungeon for that Fighter's Guild of yours? Heh! Here, have an ale on the house!"

[Editable text box pops up for player response]

Player (speaking into microphone): "Actually, I've been away on business in the Dragontail Mountains, of all places."

[Text box auto-fills with the player's response]

Barkeep (in text box): "THE DRAGONTAIL MOUNTAINS? By Thorig's Beard! What in the blazes sent you out that way? It's cold as hell this time of year, isn't it?"

Player (speaking into microphone): "Colder."

The game keeps a running file for each NPC with current and past interactions. It remembers you have a relationship with this barkeep and what the context of that relationship is.

Now I have a reason for preferring for certain establishments. Every tavern is no longer a copy/paste, because I've built up a relationship with this barkeep, with the people in this particular tavern. I come in, they're glad to see me. They're my friends. The LLM generates backstories for them, personalities. Maybe they give me leads on work.

Barkeep (text box popup): "Well, it's grand to have you back! Grand! Say, I think Morvyn Greencroft was asking about you. He normally comes in about seven."

[CREATE QUEST: MEET QUESTGIVER MORVYN GREENCROFT. MORVYN GREENCROFT SPAWNS IN THE BAT AND WOLF BETWEEN 1800 AND 2000.]

I come back later that night and talk to Morvyn Greencroft.

Morvyn Greencroft: "Andel! It's good to see you! Say, remember a few months back, when I had that little rat infestation problem in my house? Well, the past few days, I've been dealing with a pest of a different sort, and I was just thinking I could use a good strong arm to take care of it..."

This could lead to another custom quest, taking you to a house, a town, a dungeon... Possibilities are limitless. I think this DEFINITELY affects gameplay. It's not just window dressing.

Things we used to only be able to imagine are suddenly becoming possible. I don't think any of this is far-fetched. Not at this point. I'll bet $100 when TES6 comes out, it'll have natural language AI, along with most other industry games.

With Daggerfall, the hard work is already done: recreating the game engine. Now all you need is a lightweight, open-source AI you can plug into the game. It would take work, maybe a team, but the result would be completely transformative. I don't think it's doable now, but doable within the next couple years once open source catches up to GPT-4, definitely.

User avatar
Sluggy
Posts: 20
Joined: Tue Aug 23, 2022 9:28 pm

Re: True Radiant quests with GPT and LLMs?

Post by Sluggy »

Well the important bit here is to define the difference between aesthetics and mechanics. If all you are interested in is a really really fancy way of 'randomizing' the dialog then yes that can absolutely be done with current LLMs and indeed already has in some games. To clarify, when I say 'randomizing' effectively I mean making up the fluff that comes between the key points in the dialog (such as character names, locations, artifacts, etc). And I completely agree that this can have a great impact on user experience but mechanically it's still the same game it always was. Personally I'd have little interest in such a thing because for me the Adventurer Lifestyle Simulator part comes mostly from the mechanics and not from the dialog. To each their own, I guess.

Anyway if you want to see an example of injecting a public chatbot into an already existing game look no further than Bannerlord's ChatGPT mod project. However, it is exactly limited to what I said it would be. It can't invent new situations or retain any information. Everything must be modeled in the mod itself and then fed into the chat prompt - effectively making the chatbot generate seemingly natural dialog for otherwise exactly the same situation that would exist regardless of its presence. There are other games that have been made in years past that use local chatbots that are part of the game and thus have the model built right into them. However they also don't have nearly the capacity for generating seemingly more varied or nuanced dialog.

On a slight side-topic: as for AI in game development, we've been doing it for years now. Animation being one of the big areas for that (though I suspect sound engineers have been borrowing tech from the music industry lately too). Level design is likely to be a key area that will be augmented in the near future as well. As for natural language models in games, I've been seeing that for decades now. Some were amazing at the time. Some were.... not. I think ChatGPT mostly gets the spotlight right now because it's easily available to anyone and because its model is particularly broad and has been engineered to fail much less spectacularly than most others. Also, let's not get into the coding debate ;) I would absolutely never allow an LLM to write any code that would then be executed on the fly. Period. Full stop.


[youtube]https://www.youtube.com/watch?v=akceKOLtytw[/youtube]

User avatar
Jay_H
Posts: 4061
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: True Radiant quests with GPT and LLMs?

Post by Jay_H »

the more recent GPT-4 tech has blown me out of the water insofar as its ability to 1) write compelling dialogue/story beats, and b) code. Have you used the more recent version?
I have not; the only one I've tried is at https://chat.openai.com/chat. If you have a method to access a newer version, I'd be happy to give it a try.

Hurricane Otter
Posts: 35
Joined: Wed Nov 30, 2016 12:09 am

Re: True Radiant quests with GPT and LLMs?

Post by Hurricane Otter »

Jay_H wrote: Tue Mar 28, 2023 5:53 am
the more recent GPT-4 tech has blown me out of the water insofar as its ability to 1) write compelling dialogue/story beats, and b) code. Have you used the more recent version?
I have not; the only one I've tried is at https://chat.openai.com/chat. If you have a method to access a newer version, I'd be happy to give it a try.
That's the website. In order to access GPT-4, you have to pay the $20 subscription for GPT-Plus. I jumped on the bandwagon early. I think they've temporarily turned off new subscriptions because it was impossible for them to scale up their infrastructure fast enough to keep up with demand. :)

I have a subscription though, so if you would like to suggest a prompt to test its capabilities and limitations, I would be happy to run it through the system for you. I actually don't know if it knows how to parse Daggerfall quest text natively, but I wouldn't be surprised if it did. I think they hoovered up most of the text on the Internet when they trained the model, which probably includes Interkarma's Workshop and other websites that deal with DF coding. :D

User avatar
MrFlibble
Posts: 410
Joined: Sat Jan 27, 2018 10:43 am

Re: True Radiant quests with GPT and LLMs?

Post by MrFlibble »

Hurricane Otter wrote: Mon Mar 27, 2023 3:21 am And it would never be the same twice. Each playthrough would be 100% unique and different.
Well, each playthrough in vanilla DF is already unique and different, isn't it?

I'm not really getting if you suggest that the AI write quest texts or design quests in the game?

If the former, you probably know that even before any deep learning AI, algorithmic chatbots have existed for like fifty years or so, and in the mid-90 they were quite versatile and popular as standalone programmes (especially before the advent of chats with real people via the Interwebs). I think there's a reason one was not built into Daggerfall, and I guess that apart from the extra effort needed for this to work, players would likely not want to go back to the previous era of RPG gaming when one had to type in keywords to converse with NPCs (although personally I think it can be a fun and rewarding experience).

As for the quests, when you remove the story-telling flavour, DF quests really boil down to a limited number of situations: the player needs to go either to a dungeon or to a town building and fetch an item/talk to character/slay a monster or character. Of course, there can be very different plots that can be woven around these functions, but how exactly would the AI do this better compared to man-made design?

Of course, I can imagine a different kind of quest where you'd be required to let's say solve a sage's riddle by looking up relevant information in the library, or something along these lines, which would be more text-oriented so to speak. Also if character interaction had a bit more depth and more functions then perhaps different kinds of stories could be created -- for example if NPCs really had individual life cycles like in Gothic so you could follow them doing their day-to-day things and perhaps help them, or play one character against another etc. Again, it is not clear how the AI would have an advantage as opposed to a predesigned system that randomizes a lot of variables and has let's say a dozen variants of flavour text for the narrative.

I remember some promo text in the early demo of DF that describes the game as a living world where all player actions have consequences, and gives an example where the player might be unexpectedly helped out by the mother of someone they rescued earlier. I believe this kind of living world could be made, again perhaps without the involvement of a deep-learning AI, but this would require the world of DF to be a little less generic and on a completely different scale. Indeed, what kind of long-term friendships with NPCs could you think of if the player is likely to visit many of the towns and cities once at best? I admit that Morrowind perhaps could benefit from more lively characters capable of realistic conversation instead of the automaton-esque dummies that they are. As it is, the reputation system in DF works fairly well to measure the consequences of the player's actions. Of course, this could be taken to a different level by some kind of over-arching quests with branching storylines, but I think some user-made quest packs have already created something like that, albeit on a limited scope.

Hurricane Otter
Posts: 35
Joined: Wed Nov 30, 2016 12:09 am

Re: True Radiant quests with GPT and LLMs?

Post by Hurricane Otter »

MrFlibble wrote: Thu Mar 30, 2023 11:34 am Well, each playthrough in vanilla DF is already unique and different, isn't it?
No. ;)
MrFlibble wrote: Thu Mar 30, 2023 11:34 amI'm not really getting if you suggest that the AI write quest texts or design quests in the game?
Yes! :D
MrFlibble wrote: Thu Mar 30, 2023 11:34 amIf the former, you probably know that even before any deep learning AI, algorithmic chatbots have existed for like fifty years or so, and in the mid-90 they were quite versatile and popular as standalone programmes (especially before the advent of chats with real people via the Interwebs). I think there's a reason one was not built into Daggerfall, and I guess that apart from the extra effort needed for this to work, players would likely not want to go back to the previous era of RPG gaming when one had to type in keywords to converse with NPCs (although personally I think it can be a fun and rewarding experience).
Pardon me if this is presumptuous. I think, if I am to guess from reading your post, you are maybe not aware of the current watershed moment we are experiencing in tech right now re: large language models, machine learning, and generative AI. Perhaps you have been a bystander to GPT-4, which released two weeks ago and has set off an earthquake in tech.

We are lightyears ahead of 1990s chatbots.

Cleverbot had enough gas to get me out of my driveway, maybe, if I was lucky.
Current generative AI can circle the moon and back, by comparison. That's how far apart these things are. In a year, it will be going to Mars, Jupiter, Saturn. In a decade, Alpha Centauri, probably.

The genie is out of the bottle. These are pre-sentient algorithms. There will be artificial general intelligence (AGI) within the next five years. In ten
to twelve years, I would put money on an AI gaining sentience and consciousness a la Data, Jarvis, Rosie the Robot. Hopefully not Skynet. Perhaps the tech will hit an unforeseen wall, but that IS the current trajectory as we understand it on March 30, 2023. If it sounds fanciful, it is only because we have been conditioned by pop culture to think of sentient machines as science fiction. But most science fiction becomes fact in time, and I can point to interviews with leading experts and founders in the AI field wondering not if, but when we will cross that Rubicon.

I think it's fairly obvious, integrating AI into video games. And I love Daggerfall, so of course I think it would be an awesome candidate!

But if it doesn't make any sense to you, the idea of an AI with human-level intelligence acting as built-in dungeon master, that can create custom dialogue and custom quests and even campaigns in the style of Dungeons and Dragons, in a game which was literally modeled off Dungeons and Dragons... ¯\_(ツ)_/¯

I think we are simply at a point where the tech is moving faster than the conventional wisdom right now. Too much inside-the-box thinking. People still think about chatbots as if it were 2005, when in reality we are at the beginning of a technological transformation, perhaps even an entirely new age of humanity to rival the Industrial Era or the Enlightenment in the way it will change the world.

I think some Triple-A studios and maybe a few indie devs will pick up on this, and the ones that do will reap incredible rewards: studios that implement generative AI even halfway decently will shoot out in front of the competition. With Daggerfall's Unity remake, the stage is set for this game to have a chance. I can imagine a possible future in the far-off year of 2026 or 2027 where literal headline CNN articles are written about Daggerfall, this game from 30 years ago, kept alive by a dedicated fanbase, who have now implemented revolutionary open-source AI, and now people are flocking to it as never before. There are few games suited to this as well as Daggerfall is, due to its D&D bones, its procedural generation DNA, its relatively low computational overhead, its lack of modern considerations like having to build out procedurally generated voice acting, its modern-engine remake.

All of this is to make a case for the community here to be thinking about this as artificial intelligence continues to unspool more and more fantastic capabilities over the next one or two years. I don't think it's possible NOW, not with OpenAI holding the keys to the kingdom and no viable open-source alternative. But keep this in your head as you read the news about AI in 2023 and 2024.

Post Reply