Random Number Programming and Magic the Gathering

I have been making progress on my Lights out game, coming up with new ideas, scaling back old ideas, putting some things to the side for latter, completely changing the user interface, and generally pulling my hair out at things that should “just work” seam to work on my machine and then just… don’t. So programming in a nutshell.

Now, what is that title about and how does it relate to my game?

Well for my game I have a section that generates random puzzles. As you can imagine this utilizes a random number generator, but it also uses a bunch of seed numbers (random between X and Y, target number, etc.) and I just recently realized a few mistakes I made when deciding these seed numbers. The most recent discovery was that for difficulty I was messing with entirely the wrong number and needed to change a different seed number to get the results I wanted, but more importantly I figured out that I was using the wrong scale of numbers. I had been using numbers in the 5-12 range and figured out I needed to use numbers in the 200-300 range. Why? Well lets get to one of the oldest design problems of Magic the Gathering to illustrate the problem.

In Magic both players start with 20 life, can generally generate one mana per turn of the game (dependent on deck and draw this can go way up or down but I digress), and start with 7 cards drawing one per turn by default. Those are the basic resources a player has to work with. In the first set of Magic they printed a card called Lightning Bolt, it cost one mana and dealt 3 damage to anything… and is widely considered one of the strongest direct damage cards in the game even 27 years latter with¬† about 4 sets per year. Latter they printed the card Shock, It was exactly like Lightning Bolt except it dealt 2 damage instead. Shock is considered a mediocre card, useful sometimes but your not excited to play with it. So why the giant disparity between reactions with the difference of 1 damage? Well the designers have said the ideal one mana direct damage spell would deal 2.5 damage, but they can only deal with whole numbers so it is either 2 damage or 3 damage. But imagine a world where all damage and life numbers were doubled. suddenly Lightning Bolt deals 6, Shock deals 4, and a new card could deal the new ideal of 5 damage. But because the resources they have to work with were set in stone 27 years ago they can’t actually tweak any of those numbers. Starting to see how this loops back?

By at first dealing with small numbers the number of changes I could make to the system was highly limited. But by dealing with giant numbers I can make much smaller changes for more precise control. Ironically Larger numbers allow for smaller changes.

This is a lesson I keep relearning, but as long as I don’t set things in stone and catch myself early enough I can afford to keep relearning it.

Leave a Reply