10 votes

Why I decided not to do Emrakul, and how we shipped it anyway

10 comments

  1. [9]
    riQQ
    Link
    Another MTG programming insight: https://fl.reddit.com/r/MagicArena/comments/125rqw4/a_bug_to_pierce_flesh_and_spirit_alike_the_story/
    3 votes
    1. [8]
      DawnPaladin
      (edited )
      Link Parent
      Wow. That works? I've never seen something that could reliably generate code from English without careful programmer oversight, ChatGPT and Copilot included. What are they using for that, I...

      Much of our rules engine code is machine-generated: we use a natural-language processing solution to interpret the English words on the card and create code (this is an article, or a series thereof, by itself!). This has two relevant features: one, every release involves a new generation of all the code that comes from card text - we don't just freeze the original parsed code. Two, due to being machine-generated, many components of the card behavior code are highly generic, as this example will illustrate.

      Wow. That works? I've never seen something that could reliably generate code from English without careful programmer oversight, ChatGPT and Copilot included. What are they using for that, I wonder?

      ETA:

      Machine learning is not used in our parser. The generation of code is intended to be deterministic, which is a feature machine learning is not a good fit for. Our natural language processing techniques are more old-school stuff like generating syntax trees from grammatical productions and encoding semantic meaning with first-order-logic expressions. #wotc_staff

      In practice, at least 75% of the cards' generated code do not need individual attention. The advantage of the language of MTG cards is that it's very precise. This is what allows our project to not be a fool's errand in the first place. #wotc_staff

      6 votes
      1. [7]
        Tygrak
        Link Parent
        MTG rules text is very regular, and most cards are quite simple. I bet they dont need any special NLP.

        MTG rules text is very regular, and most cards are quite simple. I bet they dont need any special NLP.

        6 votes
        1. [6]
          streblo
          Link Parent
          From the above linked post: I'd always assumed this was the case. The rules of Magic rely a lot on English grammar and once you get beyond parsing simpler cards you'll quickly run into a wall...

          From the above linked post:

          Much of our rules engine code is machine-generated: we use a natural-language processing solution to interpret the English words on the card and create code (this is an article, or a series thereof, by itself!).

          I'd always assumed this was the case. The rules of Magic rely a lot on English grammar and once you get beyond parsing simpler cards you'll quickly run into a wall writing your own card grammar. See e.g. the various open source MtG parsers that lay abandoned in non-working disarray 1,2, 3.

          Edit: Just realized you were replying to the same snippet and I think I misinterpreted what you were saying.

          2 votes
          1. vivarium
            (edited )
            Link Parent
            To add to this, a good demonstration of the complexity and strict regularity of Magic card wordings is the custom magic card subreddit . Often times, half the comment section on user-submitted...

            once you get beyond parsing simpler cards you'll quickly run into a wall writing your own card grammar.

            To add to this, a good demonstration of the complexity and strict regularity of Magic card wordings is the custom magic card subreddit . Often times, half the comment section on user-submitted custom cards involves nitpicking what the "correct" templating should be. Custom cards may sound reasonable in plain English, but need precise tweaks in order for the card to functionally work under Magic's rules.

            Thankfully, I think this means that going in reverse (deriving logic from card text) is more possible than someone might think, given the strict structure involved in official card wordings.

            3 votes
          2. [4]
            Tygrak
            Link Parent
            Oh yeah reading it now my reply doesn't make too much sense. What I wanted to say is that I'd bet that it doesn't use any machine learning like (ChatGPT/Copilot). I also think it doesn't exactly...

            Oh yeah reading it now my reply doesn't make too much sense. What I wanted to say is that I'd bet that it doesn't use any machine learning like (ChatGPT/Copilot). I also think it doesn't exactly create code (as in programming language code) for the cards, instead some representation that is then better executable ("ProposeEffectCostResource" to me sounds exactly like an object that would be created for this, maybe the object contains what costs it has to activate and what is the result). I might be wrong though of course!

            I actually created something a much simpler but a bit similar before -- I was making a roguelike card game (think slay the spire), where I made a system which would basically work in reverse, I would describe the effect of the card in nested objects like this and I would have automatic rules text generation from those objects. I'd bet that is quite common for card games.

            3 votes
            1. [3]
              stu2b50
              Link Parent
              No, they probably do use machine learning. What you're describing is basically just writing a parser and lexer for a language, which is decidedly not considered NLP. That being said, there's a lot...

              No, they probably do use machine learning. What you're describing is basically just writing a parser and lexer for a language, which is decidedly not considered NLP. That being said, there's a lot in "machine learning". The very first thing you'd learn in an undergrad ML course is linear regression, after all. ML is an umbrella big enough for both something as simple as (X'X)^-1 X'Y and ChatGPT.

              1 vote
              1. [2]
                DawnPaladin
                Link Parent
                According to this comment, they do not use machine learning.

                According to this comment, they do not use machine learning.

                2 votes
                1. stu2b50
                  Link Parent
                  Interesting, if they said they don't, then they don't. It seems pretty misleading that they characterize it as natural language processing. It's factitiously true, but if you can express it with...

                  Interesting, if they said they don't, then they don't. It seems pretty misleading that they characterize it as natural language processing. It's factitiously true, but if you can express it with lexers and syntax trees then that really just means that the language of magic cards is roughly a context-free grammar (+ probably some context augmentation). While CFGs are subsets of natural language, it'd be like calling a regex engine natural language processing. Usually you'd go with the most specific bounds of the problem space.

                  3 votes
  2. JRandomHacker
    Link
    Ian (the author of this article) is a fantastic guy - he regularly hangs out in a Magic-focused Discord that I'm active in, and he's super hands-on with the community. Our community tends to be...

    Ian (the author of this article) is a fantastic guy - he regularly hangs out in a Magic-focused Discord that I'm active in, and he's super hands-on with the community. Our community tends to be pretty boundary-pushing in terms of Magic complexity, and he's oh-so-tolerant of us sending him the weirdest bug reports, and willing to share some fun stories from the dev process.

    3 votes