
Show HN: Make your own AI-generated Magic: The Gathering cards with GPT-2 - minimaxir
https://minimaxir.com/apps/gpt2-mtg/
======
phaedryx
I chose the name "Javascript" and let it choose:
[https://imgur.com/a/mlqJmjK](https://imgur.com/a/mlqJmjK)

~~~
phaedryx
When I generated it:

1\. Haha, Javascript _is_ sorcery. Awesome.

2\. Wait, Javascript is evil sorcery?

3\. This card does a lot

4\. Wait, the result of this card is that I do something pointless, then I
give my opponent 7 cards from my library, then I put the rest of my library
into my graveyard?

~~~
Tyr42
Nah, you show them 7, and they pick 0 to go to your hand, and 7 to go to the
trash.

~~~
saghm
The best part is that you have to also choose a card name, but it doesn't do
anything.

------
YeGoblynQueenne
This is remarkably more coherent than previous attempts at M:tG card
generation with a deep RNN [1] but on the other hand, the ability text on the
few cards I've generated so far seems oddly famliar.

In fact, I got one that is identical to an actual card.

Generated by GPT-2 [2]:

    
    
      Tephraderm {1}{R} (common)
      Sorcery
      Each player sacrifices a land.
    

Actual M:tG card (copied by hand by me and keeping the same notation):

    
    
      Tremble {1}{R} (Odyssey common)
      Sorcery
      Each player sacrifices a land.
    

Also, the names of cards don't seem to be generated by the RNN. "Tephraderm",
above, is an actual Magic card (a red rare creature from Onslaught). I
certainly did see a "Bontu, Primal Calamity" (which I didn't save) whose name
was basically a mashup of the names of "Bontu the Glorified" and "Zacama,
Primal Calamity".

_______________

[1] [https://www.mtgsalvation.com/forums/magic-
fundamentals/custo...](https://www.mtgsalvation.com/forums/magic-
fundamentals/custom-card-creation/612057-generating-magic-cards-using-deep-
recurrent-neural)

[2] [https://i.imgur.com/PdHkBXr.png](https://i.imgur.com/PdHkBXr.png)

Cards discussed above:

Tremble:
[https://shop.tcgplayer.com/magic/odyssey/tremble](https://shop.tcgplayer.com/magic/odyssey/tremble)

Tephraderm:
[https://shop.tcgplayer.com/magic/onslaught/tephraderm](https://shop.tcgplayer.com/magic/onslaught/tephraderm)

Zacama, Primal Calamity: [https://shop.tcgplayer.com/magic/rivals-of-
ixalan/zacama-pri...](https://shop.tcgplayer.com/magic/rivals-of-
ixalan/zacama-primal-calamity)

Bontu the Glorified: [https://shop.tcgplayer.com/magic/amonkhet/bontu-the-
glorifie...](https://shop.tcgplayer.com/magic/amonkhet/bontu-the-glorified)

Sorry, can't link to the Gatherer for any of the cards above- it's down for
me.

~~~
minimaxir
I go into it more in the README but yes, GPT-2 overfits Magic cards _very_
quickly despite my best efforts (usually it shifts the mana cost/rarity a bit
more though than your example).

~~~
mxwsn
To avoid copying the training set you can increase the temperature at sampling
time. This should trade off between accuracy (maximum likelihood) and
quirkiness (more stochastic background).

~~~
minimaxir
See the dumps for various sampling temperatures. Even at 1.2 (versus 0.7),
there is some evidence of overfitting.

The app uses a random temperature between 0.7 and 1.2 to prevent it from going
off-the-rails.

------
minimaxir
Dump of thousands of pregenerated cards: [https://github.com/minimaxir/mtg-
gpt-2-cloud-run/tree/master...](https://github.com/minimaxir/mtg-gpt-2-cloud-
run/tree/master/generated_card_dumps)

------
bartcobain
This is really great. Is there any other AI similar to this one? Maybe one
that generates AI illustrations for the cards...?

~~~
minimaxir
I've also released an interface for a Reddit-based GPT-2 API:
[https://minimaxir.com/apps/gpt2-reddit/](https://minimaxir.com/apps/gpt2-reddit/)

~~~
lowdose
> _Putin ran away to the north pole_ while the ice was melting. then a huge
> car crashed and one person died. The other person then was injured while in
> the car. How long did it take for the ice to melt?

Pretty awesome

------
sp332
I like it! [https://imgur.com/a/2IthWGz](https://imgur.com/a/2IthWGz)

This worked for a couple of cards and then broke. The image is not related to
the data listed to the side.
[https://i.imgur.com/HiuuPU0.png](https://i.imgur.com/HiuuPU0.png)

~~~
minimaxir
That issue is likely due to a race condition when two images are generated at
the exact same time. (I'm thinking it's due to how Python's subprocess module
works, but it's not an easy thing to debug!)

------
kowdermeister
Oh hai Max, I remember you from the TC comment section :)

Here's a Hacker News card:

[https://imgur.com/a/vFI9CGw](https://imgur.com/a/vFI9CGw)

------
TrueDuality
Would be awesome if you added the ability to choose the card's image in the
render (like source from imgur or something).

------
mychael
The punctuation in your title is jarring. "Make your own AI-generated Magic
cards with GPT-2" would be a lot better.

~~~
grenoire
You don't want to deal with litigation by people who thought the generated
cards are magical in nature.

------
JamesBarney
Really cool!

The first couple of cards I generated were way overpowered though. The first
one was an uncommon 9/8 for 4 mana.

~~~
minimaxir
In my testing it generated more underpowered than overpowered cards, which was
interesting.

~~~
cbsks
The first one I generated was a 1/1 creature costing 1 black mana, that had
the ability "if you control 8 or more lands during your upkeep you win the
game". It's been a while since I've played Magic, but that seems a little
overpowered to me :)

~~~
piker
Not far off these days. Might not see play in most formats. Would be cool in
standard or limited though.

~~~
mxwsn
Too weak in modern, basically like any other bomb in limited but less
interesting, and too non-interactive in standard.

------
lordleft
Amazing. I wonder if there will ever be a CCG comprised entirely of AI-
generated cards.

~~~
reificator
I don't know how they're created, but I know that Keyforge is randomized
somehow.

[https://www.fantasyflightgames.com/en/products/keyforge/](https://www.fantasyflightgames.com/en/products/keyforge/)

------
scarejunba
This is really cool. Very entertaining.

------
happppy
Not working for me

Internal Server Error

------
jonahss
really great!

