ktyl ~ blog

Game dialogue with ChatGPT

ChatGPT has become the latest AI application to enjoy viral popularity. At time of writing it's a closed-source research tool developed by OpenAI, with the only access being via their web portal. Users have to create an account to interact with the bot, and have no API access, though they no doubt have one internally. I think given its capabilities, this is probably a good idea for now, but I'd like to outline the impact it can already have in game development, even in its fairly limited form.

However, it can already be made immensely useful for content generation, without any kind of API access. Generally, characters come in two flavours: main characters, whose motivations and actions shape the story; and generic NPCs, who exist to fill out the world for the player.

For the story to carry the author's intent (which they might not necessarily care about), it would probably be best not to leave ChatGPT to generate a plotline on its own. Its susceptibilty to bias is a problem - try generating men or women and count how often they're describing as petite, as having chiseled jaws or as wearing form-fitting dresses. It can be coaxed out of this with enough description, but lots of manual intervention defeats any content generation technique.

The other group of characters, though, I think represents ripe pickings. Often in a game world, background dialogue quickly becomes stale, as lines are reused. ChatGPT can already easily be used as a supporting writer to generate a huge amount of less-than-critical dialogue. Take, for example, a merchant.

generating merchant dialogue

This psuedo-format is instantly combatible with a simple templating system. It would be trivial to generate variations using perfectly traditional programming techniques. This prompt took a minute to write, and includes specific about the character's context, as well as a slightly more than default personality.

We've instantly generated 8 perfectly workable dialogue options for our character, from some basic and mostly templated information about their context. However, we notice that our item choices weren't included in the output, though we described them. So we ask:

merchant items

And, instantly, another 8 lines. We now have, after a modicum of input, 16 possible lines for a background merchant character to respond with when interacted with. With some templated prompt generation, this could be made even faster than the description given here.

It's also capable of going beyond just lines dialogue. Ibralogue's developer taught it the syntax, had it generate an example and then taught it a new feature:

sprite prompt
sprite response

All that's left is to copy the output and paste it into a text file for a game to use.

This is barely even a scratch on what ChatGPT or systems like it are already capable of. At present, the website gets overloaded, you can't save and reload conversations, and its content filtering is very much evolving problem. However, even with those limitations it's an extraordinarily powerful tool, and this is just one very minor example of an application.

That's it from me, but I'd love to read more discussion about use cases and the ethical issues at play. If you have anything interesting, please get in touch!