Thursday, December 12, 2019

Dungeon AI and GTP-2

By now, many of you will have heard of Dungeon AI, the automated text writer which can create coherent adventures based on some source text and inputs from the users. While not perfect, it allows the player to experience virtually unlimited outcomes in an RPG setting.

Dungeon AI uses GTP-2, an Open AI program which generates responses using millions of parameters. The output seems to work best when kept to a few words, rather than creating a whole story at once. The user can guide the story by their input, which can help eliminate nonsensical outcomes.

Transformers are a type of neural network architecture that transforms an input sequence into an output sequence. One example of a transformer program can be found here:
https://transformer.huggingface.co/

I fed the program two sentences describing a castle.

Upon the hill stands a large fortress, with many towers and bulwarks. Banners depicting a red dragon waver gently in the breeze.

From there, the AI took over and (with my help) created a full setting for an adventure story.

The castle is surrounded by a tall green hedge that extends from the outer walls of the stronghold. The castle guards, armed with shields of bronze and helmets of gold, keep watch over the castle and its surrounding land.
The castle has been the center of a civil war since it was built in the time of Tairnadal. During the last battle, the castle was burned and its inhabitants were forced to flee. In the meantime, the walls and towers had been stripped of their protective spell work, and were left to the wind and the elements.
This spell work was later restored and incorporated into the tower, but was lost when the castle was abandoned. Now, a few people are still allowed to enter the castle, but others must take a deep breath of the bitter wind and climb over the stones and rocky walls to reach the castle's interior.
The entrance to the castle is guarded by a large number of soldiers dressed in red and white and wielding broad swords, which look very menacing in the dark. These guards are stationed on the eastern and western gates, where one can find a few small buildings that overlook the entire area. From the western gate, one can see a small bridge leading to the nearby town of Korth. This bridge serves the main highway between the castle and the outside world, but the area of the bridge is too dangerous to pass without a very high level of protection.
From Korth, one can see the ruins of an ancient city which once stood on the opposite side of the river. The ruins can be reached by traveling a few miles upriver and crossing a small wooden bridge. At the bridge, one can find a small temple built by the ancient people of the region. This temple's altar has the inscription: "Here lies the soul of a god of fire, the Lord of the Burning Skies".
The temple is guarded by a very large group of soldiers, who are wearing red and gold tunics. The soldiers were apparently summoned by their Lord, who appears as a huge fiery dragon with a long fiery tail. A few of these soldiers are carrying bows that are too heavy to use, but still have the ability to shoot arrows of lightning.
The other troops appear to be more than willing to give the player any loot they want if they have the appropriate level of stealth and patience. One can see from the distance where the group is located, and a sign says: " Fire Keepers - If you are the Lord of Fire, come to this temple and claim your reward."
After walking for about ten minutes, the player will notice some smoke rising from the ruins.

The AI uses search engine results and the preceding text to produce one to three choices for the next text sequence. Output can be fantastic, realistic or hilarious.

The applications for this technology to be used in RPGs are astounding. It's not far-fetched to think that very soon, a dungeon master might be able to create a detailed adventure in minutes with the click of a button. Complete character generation, new monster generation and magic item creation all seem very feasible as well.