Experiments with AIDungeon

A few months ago I found out about this amazing ai-powered tool called AIDungeon. You can find it at aidungeon.io

It is built as a text-based adventure, where the GM side is managed by a machine learning model known as GPT-2. GPT-2 has been trained with a large body of literature (including many choose your adventure books) and it can infer the best way to complete a text based on the training material and a prompt. By collating GM text and player text in a growing text, AI Dungeon generates more GM interactions.

I have seen the relevance of the game generated text leaping forward in the past six months and I started putting together an adventure by copying and pasting bits from Tomb of The Serpent King, the Trophy Gold book and my memories of ToTSK games I played. When you build an AI Dungeon scenario you can also create some hidden text that the AI uses both for mood and to create facts about the world and that is where I copy-pasted paragraphs from the pdfs and wrote up some rituals.

The tool is amazing not just for solo roleplaying (it also supports turn-taking narration with a multi-user mode) but it can be used as a generator of characters, items, places and as an oracle to find out what happens next. It can often amaze you and take you to strange places.

Just for a small taste… this is the adventure of Fionn, a scholar that went to explore the tomb, to never leave it again, killed by a companion possessed by the ghosts of the serpent race - https://play.aidungeon.io/adventure/05bb86f1-039d-49fd-9194-31675c7fed6b

And here is the adventure of the Neven, a noble descended into the tomb looking for power… and encountering it too soon in the shape of a fire breathing dragon… https://play.aidungeon.io/adventure/fe12cea2-05dc-4efa-80de-62efdc2150ff

Talia, a Warrior Priestess of the Sisters, is the first to lead an expedition that has not come to its end, yet. This is how the story starts. Let me know if you would like to see more. The first line starting an inset paragraph is usually my inputs to the AI dungeon engine. It is usually just one sentence long and is completed by the AI.

A landslide has opened access to a secluded valley. On the bottom of the pit of an open sky mine there is the entrance to a hidden tomb complex that is said to have belonged to the ancient race of the Serpent Kings.

You hired Baso, a mercenary. Theon, a spelunker and burglar is also part of the group. Your friend the sorcerer Sareh also joined the team.

You are Talia, a fierce Warrior Priestess. You want to enter the Tomb of the Serpent King to find the ancient reliquary of the Sisters, stolen away by the Serpent Kings.
Your group is small, but you are sure that it can handle whatever is inside the tomb.

You didn’t expect to find a full adventuring team already inside the complex. A motley group of half mad explorers and crackpots led by a woman called Helena. She is obsessed with finding the lost city of the Serpent Kings.

The expedition team has been studying the complex for months, stealing in after dark to gather clues to solve the mystery of the tomb.

The group is worried. A few days ago they found Helena’s missing boyfriend Ral in a dead faint, smelling of snake venom. He has been acting very strange ever since.

Helena is hysterical, claiming that the complex is cursed and that everyone who has entered it has died. Her expedition team is beginning to look like the walking dead.

Your own team members are nervous. Theon is the only one who has ever met Helena. He claims that she is full of hot air and not to be trusted.

Talia walks up to Helena’s camp just outside the entrance to the complex.
You approach the camp of Helena and her expedition team. You see her, dressed in a tight fitting leather outfit, a whip in her hand, standing over the bodies of her workers. She turns towards you, a sneer forming on her face as she addresses you.
“So… you came to see me after all,” she says.

Talia says “Theon told me you are the best at what you do. I knew then I had to speak to you.”
“Hmm, Theon did say that,” Helena says, giving a faint smile.

Talia says “he told me you would help fellow adventurers if they could help you back”
“Well, maybe,” Helena says.
“I have heard the rumors about the tomb. Is it as impressive as is claimed?”
“Better.”
“It better be,” you reply, before smirking.

11 Likes

I’ve fooled around with this a bit, but not to the extent you have. Nice to see someone pushing the limits of this tool!

1 Like

Oh, now I remember why this was so familiar. It was on one of the Corridor Crew episodes.

Really cool idea. When I went on a dragon slaying quest, the generated name for the dragon was “Smokey”. :smiley:

1 Like

I find that it really shines when you try custom scenarios and you play like you were playing a serious game with a human GM. Custom scenarios allow you to create the right mood and tie in to all the right cultural references.

1 Like

I played around with this a couple of days ago. My zombie survival story ended with me getting married and growing old with one of the other characters, spending my days reminiscing about the good old days when the world ended. It was weird and cozy. As the apocalypse should be.

2 Likes

So recently, AI Dungeon switched over to GPT-3, with two models available: a free version called Griffon, and a version only available to Premium members ($10/month) called Dragon. GPT-3 is well-known for its general-purpose text generation capabilities, so long as you design the right prompts. Which gave me an idea…

I posted on r/proceduralgeneration about my experiment with using AI Dungeon’s Dragon Model to generate characters using the “7-3-1” technique created by Jason Cordova. It seems to work 40% of the time on autopilot (and it’s very easy to undo, retry, or alter the output…so the actual success on the field is probably much higher), so the results are promising to me. I look forward to creating new prompts for AI Dungeon to use, thereby generating content for tabletop RPG sessions.

There is a catch though - it is very easy to write prompts, but hard to debug them and figure out what’s going on right or wrong…so I’ll need to learn how to do “prompt engineering” properly. That, or wait for OpenAI (the creator of the GPT models) to let people find-tune the GPT models, thereby making them more efficient at tabletop RPG content generation.

2 Likes

I have read your example and it is really amazing. I should probably switch to GPT-3 as well. The potential for creativity aids and tools is incredible.

I was thinking to use this model within a more controlled framework (as you did actually) and mixing it with more procedural generation techniques.

@igorhorst do you know Abulafia? I have built an API on top and you can query for specific generators… I would love to use this in conjunction with GPT-3

I have heard of Abulafia, and even used it a few times. Is your API documented anywhere? I might want to try it out.

Hm, I guess the existence of an Abulafia API gives me an interesting idea - use Abulafia to generate a few example paragraphs and then feed them into GPT-3 with the correct prompt. If this can all be done programmatically, then I think I got a good foundation for a “National Novel Generation Month” project. All I need to do is to figure out how to write a prompt that succeeds all of the time…

You can start experimenting with a service endpoint that I created.

Try this example: https://abulafia-library-ptrpwdvrrxkp.runkit.sh/pick/1E_DMG_Demon/main

The “1E_DMG_Demon” is the name of the abulafia page you want. Try these ones as well:

If you find some value I will go into more detail and give you the code. Let me know if it breaks somewhere!

I was also reasoning on the same rough line as you… some basic narrative structure, Abulafia prompts and GPT-3!

1 Like

Also, about NanoGenMo… yes I think it can be done. Even the GPT-2 results that I got for Tomb of the Serpent Kings were nothing short of amazing.

You can have good fun also using the back cover of books or the reviews of d&d modules as prompts for the AI.

BTW, this is the follow up of the TotSK story above.

Talia says “can you give us some intel on the Tomb before we go in?”
“Sure,” Helena says. “You’ll need these.”
Helena hands you a small vial of something and a silver dagger, its hilt wrapped in snake skin.
“What is it? An antidote?”
"Of course. If I were you I’d stick it in my arm first and then drink what’s in the vial. If you want to survive the experience.

Talia takes the antidote vial and the snake skin dagger.

Talia says “is the dagger magical?”
“It has a minor enchantment. It won’t kill you, just hurts like hell. You’ll be able to speak basic sentences in the snake tongue for the duration though.”

Talia says “thank you Helena, I am in your debt. May the Sisters grant you what you wish for.”
Helena smiles, before barking out a command to her team, the next few hours are spent in preparation.
The main pavilion of the camp is large, decorated with symbols related to the dark arts.

Talia asks Sareh what is the meaning and function of the symbols.
“Those symbols?” Sareh asks, pointing at the dark symbols on the tent. “Those are infernal symbols. You don’t want to know what they do. I suggest you just avoid them.”
Sareh looks at the ground, deep in thought.
“Those are necromantic symbols.”
“What’s the difference?” Talia asks.
“Those symbols… they bind the infernal powers to this world. If you draw those symbols, you are calling upon infernal powers.”

Talia says “why do you think Helena is getting this place decorated with necromantic symbols?”
“She wants the powers of the dead. This place… it’s a gateway to the dead.”
Talia suddenly stares at Sareh with suspicion.
“How do you know all this?” you ask.
“I’ve… I’ve done a little reading.”
“You’ve done a lot of reading, Sareh,” Talia says.

Talia gets her crew going towards the entrance of the tomb complex.
“Well, you heard the woman. Let’s get inside and get this job done,” you say.
You and your men move forward into the entrance of the necromancer’s lair.

Talia says “Theon, check out the entrance and scout ahead”
“Yes, sir,” Theon says.
Theon salutes and moves ahead into the darkness.
You stand in the entrance of the necromancer’s tomb.

Talia lights up a torch and follows Theon in the tomb.
You take the opportunity to scout ahead, and move forward into the necromancer’s lair.
The area is a large underground chasm, with strange symbols carved into the walls.

Talia lights up the symbols with the torch to see them better.
Talia takes the opportunity to mark the walls with symbols of power.
Theon returns from scouting ahead.
“The area is clear, sir,” Theon says.

Talia says “well done Theon. Sareh, do you recognize these symbols on the walls?”
“Those are infernal symbols.”
"What do you make of them?
“I’ve never seen these symbols before. This is a summoning chamber,” Sareh says. “This is bad. Very bad.”
You see a large, demonic looking creature standing in the chasm.

Talia looks down the chasm at the demonic looking shape.
You take a look down the large chasm, and see the demonic shape. It has an odd head with two insect-like antennae coming out of its forehead.

Talia studies the figure to understand if it is a statue of some kind.
“It’s a statue,” you say.
Talia looks at the demonic statue.
“It looks like stone, but it feels like… like it’s made of flesh,” Talia says.
“Let’s move on,” you say.
You take a look at the large chasm. There is a walkway along the wall of the chasm.

“We should go along the walkway,”
the party moves forward, Theon leading, Talia following with the torch, and Sareh and Baso closing the line.

Suddenly, the chasm gives a large rumble.
" Run!" you shout.
Sareh and Baso run towards you. You hear a growl, and turn to face the large chasm. You see a large, black shape moving rapidly towards you.
“Back to back!” you shout. “Mortal bullet versus demonic invasion! Who will win: iron, or iron?”

Talia says “fast Sareh, cast a protection ritual!”
Sareh begins to chant.
“Hold your ground!” Baso shouts.
You draw your crossbow and fire at the creature. The dart makes contact, but it seems to have no effect.

Talia prays the Sister to cast a searing light on the dark shape.
Talia prays to the goddess, and a bright white light appears, illuminating the beast. It’s skin appears to be made of hundreds of Eyes, all peering at you.
Sareh’s ritual seems to be working. The dark shape begins to writhe and roar in pain.
“shoot it!” you shout.
You aim your crossbow at the creature, and fire. The bolt hits home, and the demonic shape begins to scream in pain. It begins to rapidly writhe, trying to escape the light.
Baso and Theon target the creature with a volley of arrows, and though it stops screaming, the creature now clings to the wall. It begins to burn, and in a few seconds is reduced to ash, leaving the wall scorched.
“Ha! It’s dead!”

Talia examines the rests of the creature.
“It’s ash,” you say. “We should go.”
“I’ll say,” Baso says. “Well, let’s get going.”
You and your allies begin to head out of the room. You head back to the passage along the chasm you were previously exploring. You walk along corridors and descend stairs. Eventually, you find yourself in a massive treasure room. It is covered with gold and gems.

Talia asks Theon to check the room for traps.
Theon walks through the room, examining each object.
“Well?” you ask. “What do you see?”
“No traps,” he says.

Talia sorts through the treasures looking for anything that might have been stolen from the Sisters’ temples.
You sort through the gems and gold, but find nothing.
“We should keep looking,” Talia says. “Sister Yvette said they would be here.”
“Are you sure this is the place?” Theon asks.
“I’m sure,” you say. “We have to find them.”
“Well, let’s keep searching,” he says.
Suddenly, there is a scream from above. Theon and Baso look up, while you look where they are looking. You see a hooded figure standing on the edge of a balcony.
“Shoot them!” the figure shouts.

Talia says “hide behind the pillars now!”
You quickly hide behind the pillar.
Theon and Baso are already doing so.
“Theon, Sareh! Now!” you shout.
The two mercenaries quickly get up and fire their crossbows at the assassin, but they miss. Then, the figure throws something at Theon, which hits him in the head and knocks him unconscious.

Talia shoots her crossbow to the hooded assassin.
Talia raises her crossbow, aiming at the assassin’s head.
Suddenly, Talia shoots the figure with her own crossbow. There is a gasp, and the figure falls from the balcony to his death.

Talia watches out for other hidden assassins.
“Baso! Sareh!” Talia shouts.
Sereh and Baso begin running towards you, both still aiming their crossbows. Then, there is a sudden shriek from the balcony.
“Go! Go!” you shout, running towards the exit.
Sereh and Baso fire their crossbows, but they, too, miss.

Talia grabs Theon and drags him to the exit.
You run as fast as you can, and just make it to the door. As you run out of it, you are dragging Theon. Then, the door closes, and the lock engages.

3 Likes

So I forgot about this thread and my original idea of using Abulafia to generate a few example paragraphs that I would tend seed into AI Dungeon. Instead, I took a different path…

As part of National Novel Generation Month, I used AI Dungeon to create a fan-made supplement for the RPG Legend of the Five Rings that deals with the mysterious Kolat secret society. I simply provided it prompts, and then edited the generated outputs.

Interestingly, the “prompts” I used was simply giving it an example, and then letting AI Dungeon imitate that example. For example, I was able to create Adventure Seeds simply by giving AI Dungeon an example of a “real” Adventure Seed in the sourcebook Emerald Empire. So I am very confident that using Abulafia’s generated paragraphs would wind up working…after all, it worked well for this project.

Due to lack of time, the supplement itself only contains a total of 3260 words, so for the NaNoGenMo submission itself, I added a bunch of “meows” at the end.

For more information about the project (and how I used AI Dungeon), you may look at these links:

4 Likes