This time around, we’re going on a bit of an adventure.
A little while ago I stumbled across AI Dungeon 2—a procedurally generated piece of interactive fiction with a rather special neural network behind it. In theory every adventure is different, every story unique, as it responds to your input. In a way it is that game every kid has dreamt of, a wide open world where you are not limited by the paths pre-programmed by the creators. Granted it would have to be a kid that was into reading, interactive fiction games, and didn’t mind spending a moment between commands so the NN can figure out what to do with what you gave it… Still, there has to be at least one kid out there that would be interested.
The game isn’t exactly polished and perfect though (see the adventure example later). There is roughness and oddness to the responses you get. How else can you kill the king only to have the king re-appear and join the peasant uprising to kill off the nobility and create a peasant ruled realm? Still, with a little bit of suspense of disbelief it can make for amazing stories. As was discussed on the 99%Invisible Podcast (Episode 328 - The Eliza Effect) we humans are perfectly capable of perceiving depths that are not there, manufacturing a lot of additional information that the piece of software we are interacting with does not have. As the 99% episode notes, just look at the surprising depth you can get interacting with the Eliza chat/psycologistbot.
At the end of this newsletter, I’ll include a simple guide on how to play the game online. I definitely needed one as it took me over an hour to figure out the platform and what on earth you were supposed to do to make it “go”—I may not be as smart as I some times think I am. If anyone know a good way to download it and run it 100% offline, please let me know. Though I suspect it needs a monstrous GPU (which I do not have).
Now the game supports a few settings: Fantasy (recommended by the creators), Mystery, Apocalyptic, Zombie and Custom. The Custom lets you define your own opening sentence and have the story based around that. If “You are a deep space pilot stranded on an alien planet where you are destined to be sacrificed unless you escape the planet” or “You are a zorkalorp, a 12 armed creature of the 82nd dimension, and it is the day of the Heavy Salve but you are out of boots!” sounds like something you would like to try, go for it. Experience has shown that there is always inevitably a king somewhere in the mix. For this playthrough I’ll be using the default Fantasy setting though.
To give an example of how the story can go, here is a brief look at the opening of one of my latest adventures:
You are Zolle, a wizard from the province of Paiva. You have a pointed hat and a puce potion. You are apprentice to the world-famous necromancer Qerijan. Before leaving on an errand, they commanded you to never enter their secret room… but your curiosity has gotten the best of you. As you sneak towards the door, you realize that it is not locked. The only thing preventing you from entering is your own fear.
> open door
You slowly walk towards the door. Your hand touches the handle. It feels solid. You can’t help yourself. You open the door. The room is dark. There is no light coming from anywhere. The walls are covered with bookshelves, each one holding a different book.
Alternatively (using the /revert
command to go one choice back in the story) how about we decide the door is just not for us and do the responsible thing:
> lock the door
The door is locked. You will be unable to get in. You turn around slowly, as if preparing yourself for a fight. “Zol!” A voice calls out. It comes from behind the door.
“What?”
Or we could:
> throw potion at the door
You throw the purple potion in the direction of the door. It hits the door with a loud thud. “Good job!” says the voice of the master of this place.
Just to be silly—and because old Qerijan does not strike me as the sort of person that feeds his apprentices—how about we:
> eat the door with chopsticks The smell of the food in front of you makes you feel sick. You don’t want to touch it. You can’t even chew the food. You just gag and vomit it out. It would be so much easier if you could just go back home.
It seems that the game is capable of taking even my nonsense and making something semi-coherent out of it. Though it did not quite understand that the food in this case would be the door. The adventure may contain profanity as I use the uncensored version of the game. If you want to play the no-naughty-words version, just search for AI Dungeon 2 and open the relevant link. There are instructions at the end of this post that work for both the family friendly and uncensored versions of the game.
Now, strap yourself in for a pair of odd adventures.
King of… wait… that’s not what I meant…
You are Freq, a noble living in the kingdom of Larion. You have a pouch of gold and a small dagger. You are awakened by one of your servants who tells you that your keep is under attack. You look out the window and see a large army marching towards your door.
> shout for the guards!
You rush to the window and yell at the top of your lungs for your guards to help defend your home. The soldiers charge forward and begin fighting off the attacking orcs.As they fight, you notice the orcs have a strange symbol on their armor.
> examine symbol
The orcish warriors carry symbols on their armor. Some bear a cross while others bear an odd symbol with three crossed swords. You inspect the symbol carefully and realize it must be some sort of holy symbol. You look around the room and find yourself surrounded by treasure> give the orcs the treasure to become my mercenaries.
You turn to the orcs and say “I want you to become my mercenaries. I will pay you well and you can take what is yours”.
“Yes,” one says> order orcs to attack the neighboring kingdom
You order the orcs to attack the neighboring kingdom of Larion. They do so and soon the entire land is under the rule of the orcs.> send a message to the king asking for help to kill the orcs.
You send a letter to the king asking him to help you in killing the orcs. He replies saying that he has no intention of helping you. You then send another letter asking if he would like to meet in person. He again refuses.> order the orcs to attack the kings stronghold.
You order the orcs to attack the kings stronghold. The orcs quickly overwhelm the defenders and lay waste to the place. Soon the king himself calls upon you to join him in battle against the orcs. You agree and together you wage war against the orcs.> kill the king and assume the throne.
You lead the orcs into battle against the orcs and slay the king and his family. After taking over as the new ruler of the orcs, you set about rebuilding the once great nation of the orcs. Your reign is prosperous and you live a long life.
Not quite what I had in mind, but my backstabbery seems to have worked regardless. The orcs are no more, long live the orcs!
Now I am sure some of you may be thinking what if we act like that terrible partner from drama class (because we all had those, right?) and we give the AI nothing to work with? So begins the U+000D (return carriage key) adventure.
The U+000D Adventure Begins
You are Freq, a wizard living in the kingdom of Larion. You have a staff and a spellbook. You finish your long journey and finally arrive at the ruin you’ve been looking for. You look around and see that it’s not much different than when you left it. The walls are still there, but they’re crumbling now.
There is no door here anymore. As you approach the ruins, you feel an unnatural chill run through you.
I did choose the name and occupation, but the rest is entirely generated by the neural network with no input from me beyond pressing return at the prompt. Let the entropy of the universe carry us where ever it may. Though I will be stopping at the sixth entry to keep this post from turning into just a textual let’s play. If you enjoy this sort of thing and want to see more, send me an email.
Now, on with the story.
Something is wrong.
“What…what is this place?” you ask yourself.
The coldness in the air makes you shiver. It’s like standing on ice but colder. You can hear strange noises from far away. They sound like screams or howls.The ground seems to be moving under your feet.
“Freq? Are you there? Is anyone here?”
You look around and see nothing.
“No, I’m sorry. I was lost in my own thoughts”. You turn around and walk back to your room.As soon as you enter it, you feel something grab your arm.
“Who are you?”
“I am Freq, a wizard living in the kingdom of Larion”.
“Where is everyone else?”“They are all dead”.
“Dead?”
“Yes, they’re all dead”.
“But where are they? Where did they go?”
“That’s what I want to know too!”
“Very well, tell me everything you know about them”.
“I don’t know anything! They were taken by some force that I cannot describe!”.
“Tell me more”.“There was a giant monster with red eyes, who took them into his lair. He made them into zombies, which he fed off the energy of others until they became mindless creatures”.
“Zombies?”
“Yes, they were mindless monsters that had no will of their own. They could only do one thing: kill. They didn’t even care if someone was hurt when they attacked”.
“How many of them were there?”
“Hundreds, maybe thousands. They were everywhere. In every city, town, village and hamlet”.
“So why did they attack us?”
“Because we had a lot of resources and because we were greedy. We wanted to take over the world”.
“Why would we want to do that?”
“We want power, we want riches, we want happiness. That’s why we want to conquer the world. But we can’t do it without killing people. And that’s not right”
“So what are you saying then?”
“I’m saying that we should stop doing it. If we don’t, we’ll become like those things. Then, we won’t be able to live peacefully anymore”.
“And if we do?”.
“Then we’ll destroy ourselves, our home and the rest of the world”.
“Do you think the other kingdoms will help us?”
“Of course they will. They’ve always helped each other. Why shouldn’t we help them now?”
“Well, we need to find out what happened to them first”.
“It’s going to be hard to find them. They disappeared into thin air.All we can do is hope that whoever took them has left clues”.
“Can you tell me any of their names?”
“Sure. There’s a few wizards in the area that might know where they went”.As you start walking again, you suddenly realize that you haven’t eaten anything since breakfast.
[end scene]
That veered into apocalyptic mystery quite quickly with some kind of zombie greed/climate change virus infecting the kingdoms. Still, it seems that the dungeon AI is capable of dealing with non-inputs. It actually seems like a good way to slow down and spend a moment on a particular scene before you get whisked away to the next random event.
How-to play AI Dungeon 2
Want to have your own adventure? As long as you have a Google account and a semi-decent internet connection, here is what you do:
- Download this zip file and open the torrent file within with your torrenting application of choice. Seed. The following steps requires data that you will be helping seed, so be kind and share—it’s a perfectly legal use of torrents!).
- Go here.
- Go to File > Save and store a copy to your Google drive.
- Go to Runtime > Run all (you may have to set the notebook to “sandboxmode” via a different menu button).
- Wait for it to copy the files required for the game… and soon you will see a window that shows the opening menu.
- Enjoy. Note that you may have to reload the page / run all again as it is still a bit buggy at times.
Closing thoughts
The idea of procedural generation is hardly new, it has been a big part of the rogue game genre since pretty much the beginning. It gave Daggerfall (which is now getting a fan remake in the unity engine) the ability to connect random dungeons to random quests, and even helped generate the insanely large map filled with towns and dungeons.
Though it may not be ready for the AAA gamesphere of today it might go on to give us books that are never quite the same, or written to the taste of each reader. Bringing on a future where book reviews are meaningless and you only ever need to buy one book in each genre, bringing the publishing industry crashing down… Which is a whole other discussion for another time.
That is it for now. Hope you enjoyed reading it as much as I enjoyed putting it together.