• Home  
  • Dev Diary: Creating Arena Powered Cube
- Technology

Dev Diary: Creating Arena Powered Cube

As you all know by this time, MTG Arena will be running Powered Cube events starting October 28. How did this come to be? Well, it started with … Experimental Frenzy No, not the four-mana red enchantment. “Experimental Frenzies” (EFs) are what we often call our hackathons. Once a quarter, each MTG Arena developer is encouraged […]

As you all know by this time, MTG Arena will be running Powered Cube events starting October 28. How did this come to be? Well, it started with …

Experimental Frenzy

No, not the four-mana red enchantment. “Experimental Frenzies” (EFs) are what we often call our hackathons. Once a quarter, each MTG Arena developer is encouraged to take three days off their normal work to just … try things. Experiment. Explore. Poke around. Try to make something neat happen. Sometimes, people work by themselves. Sometimes, they work in teams.

Some of the work people have done in EFs is way out there, pie-in-the-sky, and even, at times, silly. And a bunch of it is, from your perspective, totally behind the scenes: making it easier to schedule events, investigating backend networking optimizations, and things of that sort. But EFs have also led to a variety of MTG Arena features, both big (achievements, having cube drafts at all) and small (the big “this creature has reach” icon).

So, our story begins with an “Experimental Frenzy” in April 2023, when I decided to investigate adding a powered cube to MTG Arena, purely from a card-rule implementation perspective. I started by looking at the entire list from Magic Online‘s Vintage Cube. Not because there was ever an intent to port that cube list directly onto MTG Arena, but because it was a good “default” cube list. There’s a fairly lengthy selection of cards that are absolute Cube staples (the Power Nine, obviously—plus Balance, Mana Vault, and more), and I didn’t want to try to list them all off the top of my head. Starting by examining an existing list would—in addition to giving a good estimate for the overall scope of necessary work—make sure that we didn’t slap our foreheads and say “Oh, right. Animate Dead! How did we forget that?”

I then did my best to assess the difficulty of implementing those cards on MTG Arena. My initial pass, from more than two years ago, was something like this:

  • There were 215 cards that were already on MTG Arena.
  • There were 200 cards not on MTG Arena that should function with basically zero RULE implementation work.
  • There were 20 or so cards that would not work out of the box but would take a “normal” amount of work.
  • There were 10 or so cards that were waiting for mechanics implementation and seemed likely to come to MTG Arena soon (for instance, delve and suspend). Remember when Ancestral Vision was a Cube staple?
  • The rest of the cards were cards we were unlikely to add to MTG Arena for various reasons. More on that later.

That took about half of my three days of EF time. So, then I decided to start trying to implement some cards. The first card I worked on was Fastbond, which I finished. Then I started on Dack Fayden. And the greatest thief in the Multiverse defeated me … at least, for the moment.

So, I wrote up a summary, presented my work, and asked the powers that be whether they were interested in bringing a powered cube to MTG Arena. They said yes. And then I asked if I could spend maybe 10% of my time (about half a day per week) plugging away at the list of hard-but-doable cards. And they said yes.

So … I started implementing cards.

My Job RULEs

It’s probably worth taking a moment here to discuss what it means when I say that I was “implementing cards.” I’m an engineer on the RULE team. That means my job involves making cards work within the rules of Magic by converting card text into a set of digital rules that our game engine understands. I discussed this process at greater length in this article.

Is that all it takes to put a card on MTG Arena? Not in the slightest. Here’s a partial list of other work that has to happen for any card to actually be fully implemented live on MTG Arena (not in order):

  • A producer does a bunch of spreadsheet and database work to properly organize the cards that will be added, including choosing which version of a card will be added for cards with multiple versions.
  • The Art team adjusts and crops the art and frame to look correct. For many cards, they also need to build new frame elements. Cards on MTG Arena are assembled from dozens to sometimes hundreds of individual parts like mana symbols, type lines, pinlines, legendary headers, and more. New cards can often require creating new pieces and new rules for assembling them.
  • The Design team makes various decisions about how players should interact with the card. For instance, if a card says “You may sacrifice a creature or discard a card,” does the player first choose between buttons that say “Discard a card” and “Sacrifice a creature,” or do they just get an option to click on either a card in their hand or a creature they control? The Design team also decides about “smart stops” (like when you get priority in your upkeep when your opponent controls Sheoldred, the Apocalypse) and various other details such as whether a targeted ability should give you an “Are you sure?” prompt if you target your own creature.
  • The Duel Scene team makes sure that the card displays correctly in the client and that all of the decisions the player makes show up consistently and clearly. They control everything that you see and interact with on the client while playing the game.
  • The Localization team takes all the card text (including text that shows up on triggered abilities, button labels, and more) and makes sure it gets translated into each supported language.
  • The Content team sets up key information about the set, like which cards are craftable with wildcards and which are styles, format legality, and more.
  • Rarely, some other teams get involved. For instance, Grist, the Hunger Tide required work from the team that works on deck building and validation to make sure it interacts with companion restrictions properly, and all planeswalker cards require voice-over assets from the Audio team.
  • The QA team tests all of the above.

So, when I say I’m “implementing” a card, am I making the card work all by myself or doing the most important step? Neither. We couldn’t put a card on MTG Arena without all of the above steps. Every one of them is essential. But what sets the RULE work apart is that it’s the most variable and unpredictable.

A lot of cards take literally zero RULE work to implement because our parser can convert their card text into digital rules with no extra human intervention needed. And I’m not just talking about simple cards like basic lands, or even simple-adjacent cards with just an activated ability like Mother of Runes. Here are some cards that we added to MTG Arena for Powered Cube that parsed and work perfectly (from a rules-correctness perspective) right out of the box, despite having somewhat complicated rules text:

  • Emrakul, the Aeons Torn
  • Currency Converter
  • Dauthi Voidwalker
  • Recurring Nightmare

On the other hand, some cards take days, weeks, or even months of RULE work. So, the implementation I was doing ahead of time didn’t mean that everything was finished. But it did mean that when the time came to run Powered Cube, we would be able to confidently schedule all the remaining work necessary to fully implement the cards with as few surprises as possible. What I did not want to happen was that we eventually launched Powered Cube without Balance, or Animate Dead, or Flash, because we just didn’t have time to do the RULE work.

None of this is to say that the work the other teams do is always fully predictable. I know that Duel Scene, for instance, spent a long time getting the text box on Comet, Stellar Pup to display properly. But the variability between cards is the most extreme for the RULE team.

Implementation Tales

I spent about eighteen months doing part-time work on implementing cards for Powered Cube. Here are some highlights from the process (though at the time, some of these felt like lowlights):

By a good margin, the hardest card I worked on was Necromancy. Necromancy has two lines of text. Each of them, independently, is a bit of a rules nightmare. I started by implementing and testing the card Parapet since it shares the same can-cast-with-flash-then-it-gets-sacrificed ability. This ability has a very unusual structure in that it provides a “timing permission,” meaning it lets you cast it at unusual times, and then does or does not create a delayed triggered ability based on whether you used that timing permission. Our normal development process is that we write Python code which converts card text into a programing language we call CLIPS rules. But this ability was such an oddball that I eventually gave up and wrote the associated CLIPS rules by hand. Necromancy, of course, also has its reanimation ability, which has a ton of special cases. Do you know what happens if you copy its enters trigger? I do! Although I kind of wish I didn’t.

Grist, the Hunger Tide is almost the first card on MTG Arena that has a static ability active while in the library, and it had a very puzzling bug where it would seem to work for a while and would stop working. I eventually realized that it worked fine up until the point when the library was shuffled. Shuffling the cards in a library effectively makes them all “new” objects, and we weren’t reapplying the continuous abilities of these new objects. I suspect, but at this point cannot prove, that for years, if you shuffled a library with Sphinx of the Guildpact in it, it would cease to be all colors for as long as it remained in the library.

In several cases during this period, I implemented a card, checked its behavior, thought I got it all working, wrote a test to verify that behavior, and … QA found a bug in it:

  • When you Flashed in a Silvergill Adept, if you wanted to pay its mana cost to keep it from being sacrificed, it would incorrectly ask you to pay the additional “reveal or pay” cost.
  • Kytheon, Hero of Akros was a card that I initially implemented for Powered Cube. Kytheon was reprinted in Pioneer Masters, was briefly power-crept out of our cube list, and was later added back in. It had a bug where, when checking if it and at least two other creatures had attacked this combat, it would only count creatures that were still on the battlefield and still creatures.
  • If you tapped Urza’s Saga for mana in response to the third chapter ability’s trigger, it would remain on the battlefield rather than being sacrificed for as long as that mana remained in your mana pool.
  • The buggiest card of them all was Mox Diamond, which has an extremely unusual enters-the-battlefield replacement effect. Another programmer did at least three separate fixes on various subtle bugs, including making token copies of it, having it enter the battlefield face down, etc.

Special Guest

One Powered Cube card has a bit of its own story … Booster Tutor. Tabletop Cube players have adopted Booster Tutor as one of the more popular Un– cards, but it’s generally not played as written. Opening up a literal sealed booster pack would very rarely result in a card powerful enough to make an impact in a Cube game. Rather, the typical behavior is to “open” a “cube pack.” That is, you take fifteen random cards from the cube, look at them, and add one of them to your hand.

It occurred to me one day that there’s an entire mechanic that is already implemented in MTG Arena which is very similar to that: drafting a card from a spellbook. You start with a list of fifteen cards. The player is presented with three of them at random. They pick a card from among them. Then, a copy of that card is conjured and added to their hand. Change “fifteen” to “540” and change “three” to “fifteen” and, presto: Booster Tutor! I was envisioning an extra step where, each time we put Booster Tutor into a cube, we came up with a spellbook for it which was the entire cube list.

I proposed this idea, asked if anyone else wanted to work on it with me for an “Experimental Frenzy,” and a bunch of people basically (politely) said “That’s a dumb way to do that, we can do it better.” What was dumb about it? First, it would be a massive bug-inviting hassle to keep updating the “spellbook” every time we ran a cube event. Second, we’d need special case code to not let you right-click 540 times and see every card in the cube as if they were in a spellbook. Third, it would not allow for any of the collation or color balancing that cube packs have.

Instead, we came up with a much better scheme in which, when a Cube match is created, the program that manages the match is given a list of all the cards in the cube, randomized in a collated order. Then, when someone casts Booster Tutor, instead of three cards being picked at random out of a spellbook of fifteen, we pull the next fifteen cards off that collated list. This also ensures that each time you cast Booster Tutor in a given match, you’ll always see new cards.

We got that working in an “Experimental Frenzy,” due to a lot of hard work from people who were not me. It was functional, and we were excited. Then the Duel and Art teams got their hands on it. Now it not only works, but it looks sweet.

Cards That Remain Exiled

There are a fair number of cards that you might expect to see in a powered cube that are not in Arena Powered Cube. At least not currently. Some of these were just design or balance decisions like you make when building any cube, but some cards ran into other problems.

I’m not going to try to go over all of them, but there are a few that are worth discussing, as the reasons for their exclusion are particularly close to my area.



Corpse Dance
Shallow Grave

Both of these cards depend on the order of the cards in the graveyard being maintained, which you might think would be super easy to do digitally. Just don’t let the player drag the cards around and, presto: order maintained. The sticking point comes when multiple cards are put into the graveyard at the same time. To make these cards fully rules-compliant, every time two or more creature cards were put into a graveyard at the same time (whether they were milled, discarded, or destroyed), we’d need to pop up a little dialog and ask the player what order to put them in. The dialog would need to support ordering a potentially very large number of cards.

If we absolutely had to, we could certainly do that. There’s even backend code to support it. But we want MTG Arena to be fast and fun. And graveyard order mattering is something that is no longer printed on new cards. So, we decided that the cost of developing and maintaining that system (because once we add it, we have to make sure it works with everything going forward, forever) was not worth it.

But if you want a Cube bucket list item to aim for, you can get the same effect by discarding Emrakul, the Aeons Torn, flashing in Necromancy in response to Emrakul’s shuffle trigger, then equipping Emrakul with Lightning Greaves.

This card provoked more discussion than any other. Why? It’s a pretty simple card. It has the same effect as Sneak Attack, which is in the cube. So why did we leave it out?

Because I pranked you. Here’s the full card image:

That’s right, Through the Breach has splice onto Arcane, which is among the Magic abilities that would be the hardest to add to MTG Arena. The way MTG Arena models casting and resolving spells is just not set up well to add dynamic additional steps to the spell resolving. Casting spells is even trickier, particularly given that spliced spells can cause spells to gain targets, with all the baggage that comes along with that. Splice onto Arcane is also one of those abilities that needs work from RULE, Design, and Duel Scene teams.

Which is ironic, given that, in Cube, the splice ability just does not matter.

I have played countless Cube matches and watched even more from various content creators, and the number of times I have seen Through the Breach being spliced is, as best as I can recall, zero. Our current cube list has zero other Arcane spells. In order to splice Through the Breach, you’d have to do something very unlikely, such as draft a second copy of Through the Breach via Booster Tutor, or hit your opponent’s Through the Breach with Etali, Primal Conqueror. You’d have to have a really large amount mana. And you’d have to have an incentive to do it at all. It just wouldn’t come up.

However, Through the Breach is a fairly important card, as having it in the cube means that there are two Sneak Attack-like cards that can be drafted rather than one, which makes a pretty big difference for the playability of that archetype.

So, what should we do? We came up with five or so plans:

  1. We could actually make splice work. Sadly, this would be way too much work from way too many teams.
  2. We could put Through the Breach into Powered Cube, called “Through the Breach,” without splice, make sure to mention this change in some article somewhere, talk about how hard it would be, and only release the card in Powered Cube.
  3. We could put “A-Through the Breach” into the cube, which was Through the Breach but without splice.
  4. We could put nothing in.
  5. We could put Kavaron Consumed from Alchemy: Edge of Eternities in instead.

We definitely considered the second option. But we eventually decided that we don’t want to establish a precedent of releasing partially implemented cards, even if in this very precise situation the distinction would come up so vanishingly rarely. We liked option five, even if it’s a generally weaker replacement, but we eventually decided to include only true-to-paper cards in our first Powered Cube. For the moment, Sneak Attack is on its own.

Things Get Real

And, eventually, once I was done implementing individual cards, things started happening. We had several EFs in which we tried to actually fire up a playtest, and they turned out to be surprisingly hard. We’d never before tried to run a cube event involving cards that were not collectible (meaning cards that players are generally allowed to own) and a bunch of things went wrong.

Most memorably, we finally got the event working enough that players could join a draft and see all the cards (albeit most of them had no art, so they looked like Fblthp). It was a Quick Draft event, and we had made no effort to do any card weighting, and it was not properly Singleton. So, the bots would take cards totally at random. You’d easily get like six pieces of Power every draft, including, say, two copies of Black Lotus.

Then you’d get to deck building, and a message would pop up saying “Some of these cards are illegal for this event,” and all of your Power would vanish!

It turned out we had a line of code that basically said, “If someone is building a deck and they have an uncollectible card, something has gone horribly wrong. Don’t let them put that card into the deck.” This is a reasonable safeguard in general, but obviously completely wrong for Powered Cube events.

And … Let’s Draft

I’m incredibly excited to be playing my very favorite Magic format on MTG Arena. Finally, after years of hard work, meetings, Frenzies, bugs, playtests, and a genuinely unbearable amount of “Oh, no, I can’t talk about that yet,” I will finally get to fulfill my dream of … drafting five-color midrange soup with no power and going 3-3.

I’ll see you there!

First Appeared on
Source link

Leave a comment

Your email address will not be published. Required fields are marked *

isenews.com  @2024. All Rights Reserved.