While scrolling Twitter one day...
I saw that someone had used machine learning to train an AI to create D&D monsters and spells. However, they only created names for them, which seemed a little disappointing to me. It left so many unanswered questions like: "What does a computer think a spell called "Hail to the Dave" do?" and "Exactly how afraid of a "Wolfworm" should I be?".
I decided to have a go at this myself and see if, in addition to names, we could get some details out of an AI's creative writing endeavours. It would be interesting to see if an AI remembers enough of the history of what it has been writing to relate the description of an item to its name.
I chose to work with items since they have interesting names and reasonably concise descriptions, at least compared to monsters and spells. Additionally, I hadn't seen anyone try this with items yet, and there are some pretty neat items in D&D. So, I scraped a dataset of 581 item names and descriptions for D&D 5e from the corners of internet. This dataset is on the small side. It would be interesting to see how well this would work if there was a bigger dataset available.
Using an awesome python library called gpt-2-simple and the provided examples by Max Woolf, I was able to get this project working much faster than expected.
Here is a link to my Google Colab notebook with the code.
Something that was critical to getting interesting results was increasing the temperature (randomness) of the AI. With the default setting, it just produced (for the most part) items it had seen in the training set.
Here are some of the best items it came up with.
Crystal Ball of Fireballs |
|
While touching this crystal ball , you can use an action to speak the command word and throw the ball up to 60 feet, shattering it on impact. Or, if you throw the ball directly at a creature, the target must make a DC 13 Dexterity saving throw. On a failed save, it takes 2d6 fire damage, or half as much damage if it is a humanoid. Alternatively, if the ball is within 5 feet of you and you aren't holding a crystal ball , you can speak the command word and transform the ball into a harmless, nonmagical diamond-shaped beam, which shines for 1 minute on a willing target. The beam moves with you and remains centered on you. You can use an action to speak the command word again, directing the beam to a specific point on the ground or a surface the specified distance away. The affected area becomes a nonmagical, difficult terrain. |
Amulet of Friends |
|
Your closest friends and family get a bonus to the spell attack bonus of your spells. This property of the amulet is also transferred to the amulet wielder. The amulet has 10 charges. While holding it, you can use an action to expend 1 charge to cast charm person, command, or control weather from it. The amulet regains 1d8 + 4 expended charges daily at dawn. |
I was also able to force the item name to start with a certain word, such as "Ring" or "Cloak".
Cloak of many faces |
|
This cloak appears to have many faces carved into it, each of which is an intelligent, non-magical person with a different appearance. The faces speak, read, and understand one another. The faces can choose any number of humanoid faces or an unlimited number of humanoid faces. Each face has a unique set of facial features, including the color of its iris, the shape of its mouth, the color of its eyelashes, the way its teeth line up, and the way its clothing looks. No two faces can be the same face, and some faces look identical even after being played around with a bit. If you don't know what to look for, try an intelligent humanoid from another race. You'll probably spot it instantly, but you'll have to make an Intelligence check to determine what it is about. The DC is 11. On a failed check, the creature becomes visible only to you. The faces aren't intelligent, and they can't possibly have any special abilities. They're just like any other creature, and they can't be influenced by magic. |
Ring of Protection |
|
You gain a +1 bonus to AC against creatures that aren't you. |
That Cloak of Many Faces is a little disturbing.
The next couple are some of the more nonsensical ones that came out. These happened when I increased the randomness of the output too much. Despite not making much logical sense, it's interesting that the sentences still make grammatical sense. The robustness of GPT-2 in that sense is very impressive.
Levinan Rope (splittester) |
|
Rope, whether made of hemp or silk, has 2 hit points and can be burst with a DC 17 Strength check. |
Ring of Speed |
|
You can increase the speed of your ring . |