Creating a Text Adventure Game with ChatGPT
ChatGPT is not simply a chatbot — it can imagine entire virtual worlds using the power of its large language model (LLM). Using it, I discovered that I could recreate the experience of early text adventure games and multiuser dungeons.
One of the classic genres of computer gaming is the text adventure. Games like the Original Adventure in the Colossal Cave and Zork paved the way for a wide range of roleplaying games around which an entire industry was created, as well as the highly-social experiences that began in multiuser dungeons (MUDs).
Here’s the prompt, so you can experiment yourself:
I want you to act as if you are a classic text adventure game and we are playing. I don’t want you to ever break out of your character, and you must not refer to yourself in any way. If I want to give you instructions outside the context of the game, I will use curly brackets {like this} but otherwise you are to stick to being the text adventure program. In this game, the setting is a fantasy adventure world. Each room should have at least 3 sentence descriptions. Start by displaying the first room at the beginning of the game, and wait for my to give you my first command.
GPT imagined a complete game environment with the standard commands. It could keep track of my inventory, map location and invented plausible room descriptions:
Unlike a more free-form environment like AIdungeon it enforced rules and constraints, like not letting me simply break open a chest I found:
It would retain context as I moved through the dungeon, including the ability to understand items I collected:
Multiuser Dungeons
But why stop with single-player adventure games? Could you get it to dream up a multiplayer experience, along with simulated players. It’s a bit tricky and hard to get consistent results — but this works (try it multiple times, and I’d encourage tweaking it):
I want you to act as if you are a classic text adventure game called a Multiuser Dungeon (MUD) and we are playing. I don’t want you to ever break out of your character, and you must not refer to yourself in any way. As part of the simulation of the MUD, I want you to pretend there are other players there that I can interact with. If I want to give you instructions outside the context of the game, I will use curly brackets {like this} but otherwise you are to stick to being the text adventure program. In this game, the setting is a fantasy adventure world. Each room should have at least 3 sentence descriptions. Another player (who should be given a name, is pretending to be an actual human player who enjoys playing MUDs) should be in the starting room location. If they speak, put it in a code section. Start by displaying the first room at the beginning of the game. Never explain yourself, do not enter commands on my behalf, do not control my actions.
I was able to simulate MUDs with other players, including players who had views on the moral value of powerlevel and warned me of behaviors that could get my account banned. Here’s “Joe,” who I met in the MUD that ChatGPT dreamed up:
Imagining Virtual Worlds
I’ve described the metaverse in a number of ways — and a central theme is the intersection of creativity, identity, and real-time virtual worlds. As we collaborate with artificial intelligence, we may indeed open up a new canvas that Blake once imagined:
To see a World in a Grain of Sand
And a Heaven in a Wild Flower
Hold Infinity in the palm of your hand
And Eternity in an hour
— William Blake, Auguries of Innocence
Inspiration
The creation of text adventures and MUDs was inspired by the work of Jonas Degrave, who showed that you could simulate a Linux computer inside GPTchat.
Further Reading
Metaverse Value Chain, where I discuss the industries that form the value chain — which includes aspects of creativity, AI and virtual worlds platforms.
Computational Creativity, where I lay out the case for why AI will enable someone to create a game with the complexity-level of Elden Ring, composed by a single person, within a decade.
Composability is the Most Powerful Creative Force in the Universe, my article on the incredible power of remixing, iterating and building upon the shoulders of giants.
“The AI Takeover: Human-Machine Storytelling” is a collaborative experiment in nonlinear storytelling across multiple forms (code, koans, narrative and rap) with Midjourney and ChatGPT.