from Hacker News

We built an AI-powered Magic the Gathering card generator

by MWil on 9/8/23, 12:53 AM with 87 comments

  • by minimaxir on 9/8/23, 5:05 AM

    This post was originally made in 2022. In early 2023, I spent a lot of effort training a model with a new approach that made the generation quality extremely good...

    Then the ChatGPT API came out and made all my effort obsolete.

    In one hour, I was able to create a Notebook (https://colab.research.google.com/github/minimaxir/chatgpt_a... ) that was able to create mechanically valid and relatively balanced cards given a natural language prompt, even extremely absurd ones ("Create ten variations of Magic cards based on Spongebob Squarepants and ancient Roman history"). In all cases it's more stable and accurate than my hand-made solution.

    That notebook is now obsolete too, due to ChatGPT's structured data support now allowing for even more control and stability. I need to create an updated MtG card generator at some point.

  • by doctorhandshake on 9/8/23, 9:56 AM

    I’m stunned WOTC hasn’t sued them over this yet. I undertook a related project in ‘21 [0] and had two different lawyers tell me Wizards are notoriously litigious and that they’ve even come after creators of fan art in the past.

    [0] https://hardwork.party/#/entropy/ … recursively-generated MTG-style cards generated by GPT-3 (not 3.5t) and VQGAN+CLIP. The recursion brings out the crazy!

    I ended up scrubbing for every non-dictionary word in the MTG corpus - find a ‘nono’ word? Regenerate.

    Also did cosine vector similarity on the body, title, type, and flavor text fields against existing MTG corpus to throw out anything too similar.

    Also my partner on the project ZNO did all-original card BG, back, and icons.

    In the end the thing was an art piece so it didn’t suffer from deviating widely from MTG, although I’d say it probably would have been a bigger commercial success as a straight imitation.

  • by xarope on 9/8/23, 4:52 AM

    As a former MtG player I think the difficulty lies not in creating cards, but in ensuring there's a level of balance between existing cards and new sets.
  • by clarle on 9/8/23, 4:51 AM

      Infernal Light
      2BB
    
      Sorcery
      Search your library for a creature card card with power less than or equal to the number of cards in your hand, put that card onto the battlefield, and then shuffle.
    
      The eternal flame has no fuel.
    
    Very cool generator and it creates real-ish cards that mostly follow the color pie, but the power level is pretty bonkers for anyone that plays Magic.

    I think one thing that's a challenge for a LLM is that small changes to text like "Search for a card and put that card into your hand" versus "Search for a card and put that card onto the battlefield" can have very different meanings and power levels.

  • by dxuh on 9/8/23, 1:08 PM

    > Magic the Gathering is a collectible card game played with two or more players. Each player starts with a deck of cards and 20 life points and uses those cards to deal damage to the opponent and reduce the life points to 0.

    I would never risk the wrath of Mill and Infect players by omitting their favorite win conditions.

    If you look at the rules, there are a bunch of win/lose conditions in MTG: https://mtg-archive.fandom.com/wiki/Win_Conditions

  • by happytoexplain on 9/8/23, 3:31 AM

    Intellectually, and as a creator, I love AI image generation. As a casual user of the internet, I'm growing more and more annoyed with it, simply because of all the times I lean in to examine an image that my visual cortex is stumbling on some part of, only to realize after a couple seconds, "oh, it's AI", and sit back up straight.
  • by tstrimple on 9/8/23, 3:58 AM

    As someone who has played Magic off and on since 1997, most of these are actually quite terrible. None of them really make sense from a cost / utility standpoint. The images for the names of the cards and the flavor texts are all pretty good. But this model clearly didn't pick up enough details around the cost and mechanics.
  • by ivanche on 9/8/23, 12:12 PM

    Next step is, of course, to build an AI-powered exchange for Magic the Gathering cards. They could name it "Magic the Gathering Online eXchange" or something like that.
  • by labster on 9/8/23, 4:55 AM

    I love that “Bad Lightning Bolt” is literally just Lightning Bolt that does one less damage.
  • by MaxfordAndSons on 9/8/23, 4:51 AM

    This is cool, but surprised to see no lip service paid to RoboRosewater, a pioneer in the MTGML space.
  • by ChrisArchitect on 9/8/23, 5:55 AM

    (2022)

    Discussion about this a year ago:

    https://news.ycombinator.com/item?id=31412608

  • by jusquan on 9/8/23, 4:26 AM

    This is really cool! Would love to see a version for Pokemon and Yugioh to revive my childhood. Because the relative consistency of card formats, AI-generated trading cards seems like a great use-case, with some gaps depending on the type of card. For Yugioh, I imagine generating believable images is easier since the card art is extremely varied, but it's probably a bit harder to come up with meaningfully complex card effects/descriptions. It's probably the opposite for Pokemon, where there's a much smaller set of known Pokemon so AI-generated ones are easy to detect, but the moves that each one possesses are usually pretty simple (unless that card game has gotten way more complex from what I remember)
  • by keyle on 9/8/23, 3:21 AM

    This is cool. There is undeniable value in LLMs for inspiration. I think they really augment well the creative tasks.

    LLMs are getting a bad rep for not acrediting the authors, but the everyone cannot possibly know about every other source of information.

    If you think of LLMs as general corpus of human intelligence, and how they can be used for lateral-thinking, there is nothing quite like it.

    We live in unbelievable times.

    I get to tell my children "I remember the days without the internet" and in the same monumental shift in history, I feel, I will also get to tell them "I remember the days when we had no AI assistance".

  • by KingOfCoders on 9/8/23, 5:28 AM

    I found my old Gathering cards (e.G. Antiquities), and want to sell. Is there a good AI software that determines which cards are mint etc? I feel uncomfortable selling on eBay, b/c I have no clue.
  • by mock-possum on 9/8/23, 10:00 AM

    I like the corresponding white and black titans as a concept, but the implementation really needs tweaking.

    Bad Lightning Bolt is so hilariously perfect that I’m surprised it isn’t already an un- set card.

  • by terrycody on 9/9/23, 2:02 AM

    Great article! In 2019 someone posted same thing: https://medium.com/@lukbebalduke/mtg-hivemind-artificial-int...

    But sadly, he didn't keep going into it after that. Gladly, OP made huge progress on the same topic!

  • by jrflowers on 9/8/23, 6:08 AM

    It makes sense to think Wizards of the Coast when it comes to creating unlicensed physical media similar to what a company sells while also using their trademarks. A person could mess up and pick a ridiculously litigious company to do that with and invent a fine-tuned AI model that expedites getting sued by exuberant IP lawyers.
  • by fmc30 on 9/8/23, 7:04 AM

    I actually made a small hobby site that generates Magic cards using gpt (you can choose 3.5 or 4): https://mtgcardgenerator.com

    You'll need to log in though so I can keep costs under control, but it's a lot of fun to play around with :)

  • by filipezf on 9/8/23, 9:50 AM

    Why not allow the players to 'create' new cards on the fly and the LLM balance it automatically? So that one would feel like an 'real' wizard. Curiousy I was thinking on how to actually implement something like that tonight.
  • by fxtentacle on 9/8/23, 6:40 AM

    I'm surprised that they can get away with using "Magic the Gathering" in the headline and "Wizards of the Coast" in the image. I was pretty sure these would be trademarks.
  • by getwiththeprog on 9/9/23, 2:10 AM

    The last three or four MTG sets already seem to be designed by manatees, so maybe this will save them some dosh on tank cleaning.
  • by jmartrican on 9/8/23, 12:00 PM

    This is pretty cool. Though IMHO, the card Peanut Butter Jar that their AI generated should be 0/1, not 1/1.
  • by anxman on 9/8/23, 3:11 AM

    I bet WOTC would find this very useful!