Creating Magic: the Gathering Cards Part 1
I want to use AI to create convincing Magic cards. What will that entail?
Links to the rest of the series:
- Part 1: A Summary of the Tasks
- Part 2: Creature Types
- Part 3: Text and Numbers
- Part 4: Art and Putting it All Together
I'm just going to admit it-- I'm a huge nerd. As a kid I often preferred to read rather than play with the other kids, I was terrible at sports in P.E. and in seventh grade, I joined both the computer club and the LEGO robotics club.
On top of that, one of my biggest hobbies is playing Magic: the Gathering. I've been playing since 2008, and I've played in tournaments on 3 continents.
I really like using Magic: the Gathering for ML tasks, because there's a huge dataset (roughly 25,000 unique cards) readily available. Wizards of the Coast (the company that makes Magic: the Gathering) has a very kind fan content policy, which lets me do projects like this.
I'm not the first person to try and use AI to generate Magic:the Gathering cards. RoboRosewater ran on twitter from 2015-2019, and used RNNs.
The project was picked up later, and exists here This version uses smarter RNNs.
So why am I trying this out? Simply, I think a language model with transformer-based architecture will generate better cards.
What is Magic: the Gathering?
Since not all of you play Magic, here's a paragraph from Wikipedia.
"A standard game of Magic involves two or more players who are engaged in a battle acting as powerful wizards, known as Planeswalkers. Each player has their own deck of cards, either one previously constructed or made from a limited pool of cards for the event. A player starts the game with a "life total" of twenty and loses the game when their life total is reduced to zero. A player can also lose if they must draw from their deck when no cards are left. In addition, some cards specify other ways to win or lose the game."
Here are some external resources if you want to learn how to play:
In Magic, there are 5 colors of magic, White, Blue, Black, Red, and Green.
Each of these colors is produced by a different type of land (the resource in this game), and each color represents a different kind of magical power.
Each color has specific strengths and weakness, as well as ideological values-- In other words, color will be important to our task of generating Magic cards.
Here are some external resources about color in Magic:
- A wiki overview on color in MtG
- An article from Wizards of the Coast on color and gameplay
- Here's a Medium article on Magic's color philosopy
The anatomy of a Magic: the Gathering card
In order to generate Magic: the Gathering cards, there's a necessary baseline understanding of how the game works. Here's a graphic from Wizards of the Coast explaining how Magic cards are laid out.
What will we have to do?
In order to generate the cards, we'll need to do something like this:
- Use a specific type of statistical language model called an n-gram model to generate creature types.
- Generate convincing names and rules text for the creatures using one or more language models.
- Use a statistical model to generate the numbers on the card (cost, power, toughness, etc.)
- Generate art for the cards.
- Put it all together.