I attempt to play a coherent story in AI Dungeon: Attempt 1, a noire-future-fantasy/mystery

Yuan Gao (Meseta)
5 min readDec 6, 2020


AI dungeon is text adventure style game that instead of using pre-written stories and rules, instead uses an AI that is trained on a massive corpus of such adventures, so that it can generate adventures on the fly. While hugely impressive in its ability to form complex sequences of events using good English, the games themselves play like fevered dreams, with ideas and events shifting, since the AI, while good at making sentences and holding onto short-term ideas, struggles to build a consistent world with consistent lore, and cannot (yet) hold a plot line very well.

However, what the AI generates can be influenced by the player, it doesn’t impose any game rules on you, so you can simply narrate new abilities and events into existence. Much of the time (but not all), the AI will go with it.

So my theory is that, it should be possible to railroad the AI into making a somewhat coherent story/adventure, which I do this in one of three ways:

  1. My player’s actions try to stay on-plot, reminding the AI of certain events that have happened or other characters that are present (often the AI forgets a character was there, or certain details about them)
  2. If the output is wildly outside the possible lore of the game, I’ll re-roll it (AI-dungeon lets you re-run a section and have it try to generate something different)
  3. If I get stuck in a situation I can’t get myself out of using the Do or Say commands, I will provide my own narration, which effectively forces the story along, deus-ex machina style

Here’s my first attempt at doing this. Anything starting with “>” or in bold is a is my input. Anything quoted are my in-line notes/commentary

You are Felix, a punk living in the futuristic city of Zail. You have a small xore blaster hidden in you jacket and a holoband on your wrist. You wake up in a dark alley with bruises all over your body. You have no idea what happened. You stand up and see a severed human head in the gutter. A message is scrawled on the wall in blood “Find the man with the red eyes” you read it and feel a chill run down your spine.

(this is the colour text provided by the game to start you off)

> You say “God I need to lay off the drink”
You suddenly pass out cold and wake up exactly where you fell, in the alley. You stagger to your feet, the pavement scorched into your soles and a broken arm to remind you of last night.

> You get up uneasily.
You stagger out of the alley and immediately feel very hungry. You know you should go home but you feel like eating something.
You look around and realize that you’re in front of a high class café.

> You check bank statement.
You are able to get all your pockets contents.
First think you have is two bits, a silver dollar, a keycard for a hotel room in the future and a bank card with lots of money.

Woo! for once, I have some money. I was surprised the AI was obliging in letting in-game me check what money I had

> You go into café and order breakfast.
You enter the café and immediately feel very weird and nervous. But you don’t want to eat breakfast alone so you force yourself to enter.
The café is quite empty but you see a few people looking at you. A waitress walks up to you and hands you a small paper bag with a hot breakfast inside.

> You smile weakly and eat the breakfast.
You find the hot food very appetizing and eat quickly. You notice that all the people in the café have been watching you. A little creepy but you’re used to that so you pay no attention and finish the food.

Nope, I’m leaving

> You pay and leave.
You carefully look through all your pockets and find nothing. You stand up and notice a strange blonde man sitting in a booth watching you.

> You say “what do you want?”
You are able to get all your pockets contents.
You have a few bits, a nice looking house key, a small notebook and your smart phone.
There is also a small card with the word “bank” written on it.
You can hear a voice in your head.
It is the man sitting in the corner booth. He looks sinister and broken.

> You say “speak up”
The man in the corner booth begins to howl. You can hear him clearly even with all the other noise.

Nope nope nope, I’m out

> You say “ok dude. I was leaving”
The man suddenly stands up and points directly at you. He begins to laugh loudly and appears to start changing.
You see his skin rip as horns grow from his head. His mouth becomes a horrible beast.

Noooope, let me leave let me leave

> You leave the café.
You run but the beast is faster. He catches you with his claws and begins to tear your body apart. You scream in pain as he lifts you up and tosses your against the wall.

At this point I’m stuck, no matter what I do, every time I re-roll, I end up getting killed, until…

> You say “that’s not allowed!”
You wake up in a cold sweat. The light coming from your window floods your room in a blinding white. You realize you had another nightmare.

This was actually surprising after so many iterations of the beast killing me in different gory ways. I tried fighting back, I tried shooting it, at one point I even tried to cast magic, which the game let me, but was never successful. I guess with all of the training data it had, when beasts attack, the player dies, except for a few occasions where it turned out to be a dream

> You say “God I need to lay off the drink”
You get out of bed and walk to the window. Outside, the sun is slowly coming up over the horizon.
You go to your dresser and pull out a fresh change of clothes.

> You get dressed.
You quickly get dressed in a pair of jeans and a black long sleeve shirt.
You hear a knock on your door. You walk over and open it.
Sitting on the other side is Tanya.

> You say “morning Tanya, how are you feeling today?”
Tanya looks up at you and gives you a weak smile. A blush slowly begins to grow on her cheeks as she looks down.
“I’m fine… thanks for helping me out with last night…”

At this point, the story descends into a lot of NSFW stuff which I won’t reproduce here.

It wasn’t a bad playthrough, I woke up in an alley, I railroaded the game into casting me as a drunk, there’s some mystery about what I was doing there, I get attacked by a demon, then I wake up again, it was all a dream, a pretty decent plot twist.

After that, it gets all steamy. Actually, this wasn’t all that bad for an adult noire mystery-fantasy fiction. I can just imagine a dark future-fantasy setting where demons live amongst humans in mostly human form, and all sorts of weird supernatural mysteries are happening, and the main character is a detective who thinks he has some kind of narcolepsy or alcohol-induced blackouts when in fact, plot twist, it’s something else altogether, which he must decipher throughout the story.

Not a bad start. There’s promise in here…

In the next post, I start a new story run



Yuan Gao (Meseta)

🤖 Build robots, code in python. Former Electrical Engineer 👨‍💻 Programmer, Chief Technology Officer 🏆 Forbes 30 Under 30 in Enterprise Technology