Varun Ramesh's Blog

ChatGPT is Good at Roleplaying Characters

Saturday, May 6th 2023

Last year I released a game, FeedVid Live, entirely controlled by natural language inputs. The character in that game (a fictional livestreamer) would respond to commands that were parsed using parser combinators. Unfortunately the character in that game couldn’t speak back to the player.

Recently, I’ve been experimenting with using ChatGPT to power NPCs that can actually talk back to the player. I’ve been blown away by how, with very little prompting, ChatGPT can entertainingly play a character and continually improvise in repsonse to player input.

Unfortunately, ChatGPT is still pretty expensive. Deploying a game to the public with AI-powered NPCs could easily cost thousands of dollars. Still, I wanted to share some of the experiences I’ve had since it’s entertaining and kind of eye-opening. I’ve created some character role-playing demos that you can try out below.

The Demos

You can talk to the characters below by typing messages in the input box. You can also roleplay actions by typing things like [I pour some food pellets into the tank.] or [I pull out a gun and shoot you.].

Enter Your OpenAI API Key

Your key will be saved locally in your browser and won’t be sent anywhere - API requests are made directly from your browser to OpenAI’s servers. If you want, you can also generate a temporary API key.

Be sure not to post or share your API Key anywhere.

Seaman

Seaman is virtual pet game that was originally released on the Sega Dreamcast in 1999. It featured a character that you could talk to using a microphone. The game was way ahead of it’s time. In a weird way it’s almost poetic to see things come full by re-creating Seaman using modern AI.

The Adoring Fan

The Adoring Fan is one of the most hated characters from the Elder Scrolls universe. Naturally I had to turn him into a ChatGPT powered AI-bot. I’ve noticed that bot will mention things from the game that aren’t specifically pointed out in the prompt - ChatGPT clearly has prior knowledge of the Elder Scrolls universe.

Kratos

Let’s try something a little more serious, boy.

More Characters

Wait… Maybe It’s All Just Roleplay?

One way to think about ChatGPT is that it’s always playing a role. When ChatGPT is used for more serious applications, it’s usually prompted with something like "You are a helpful, informative, and polite assistant.". Ultimately this is treated the same as any other roleplay prompt and the AI follows it to the best of it’s ability. You can see this in action by looking at the prompts for Bing AI which were leaked using specially crafted messages.

I find this kind of amusing. Language models are these massive, unpredicatable behemoths, and here we are asking them to be nice and hoping they follow our instructions.

There are also maybe some existential insights here. As humans, are we all not just perpetually playing roles? "You are an employee. You are a boss. You are a parent. You are a child."

I’ll leave those insights for others to discuss. For now, I leave you with a tool that you can use to create your own bots as in the demos above.

Create Your Own Character

You can use the form below to create a character and talk to it! This also generates a shareable link that you can send to others (the addres bar is updated).

#game-dev #artificial-intelligence

Similar Posts

Simple Tips to Level Up Your Python Programming Skills
An Introduction to Parser Combinators
Loop, Autoplay, Muted, Playsinline - Say Goodbye to...

Discussion

[Hacker News] ChatGPT is really good at roleplaying
[Reddit] Hear Me Out: Generative AI Diplomacy for Civ 7