Sunday, 18 June 2017

D20 = 21 - D20 ?

One of the little tricks that can be used when designing a dice-based procedure is to transform a single die into its complement.

Now what do I mean by that?

We all know that a single D6 produces a uniform distribution of the numbers {1, 2, 3, 4, 5, 6}, all with equal probability (that's what a "uniform distribution" means in statistics and probability theory). Similarly, a single D20 produces a uniform distribution of the numbers 1 to 20, and so on.

Often, such a distribution is modified by a die modifier. E.g. when we roll a D6+2, we get a distribution of the numbers {3, 4, 5, 6, 7, 8}, again all with equal probability. A roll of D8-1 gives us {0, 1, 2, 3, 4, 5, 6, 7}, and gives us again a uniform distribution of those numbers.
 (However, adding two dice rolls, such as when rolling a 2D6 or 3D6 or D6+D8+D10, does NOT produce a uniform distribution. I will come back to that in a future blogpost.)

The die modifier can be negative, but we can also make the result of the die roll itself a negative number. E.g. if we would roll a -D6 (note the minus-sign!), we would get a uniform distribution of the numbers {-1, -2, -3, -4, -5, -6}. And we can add a modifier to that as well. So, when we roll 3-D6, we can get the results {2, 1, 0, -1, -2, -3}, again all with equal probability.

And if you can't get your head around taking the negative number rolled on a die, you could always use a die using negative numbers!

Taking the complement

You might say that using dice to produce negative numbers like that isn't very useful when designing a game mechanic. And probably that's true. I also cannot remember seeing a mechanic that uses negative dice rolls. But, you can use the arithmetic of negative dice to play around with existing die rolling procedures to make them more intuitive to use.

A key insight is that a single D6 produces exactly the same distribution as 7-D6 (check this for yourself if you aren't sure!). What we have done by rolling 7-D6 is taking the complement of each number against the number 7. A single D6 produces the numbers {1, 2, 3, 4, 5, 6}, and 7-D6 produces {6, 5, 4, 3, 2, 1}. Rolling a 1 gives us 7-1 = 6; rolling a 5 gives 7-5 = 2, and so on. In the end, we get exactly the same numbers as an ordinary D6.
For other die types, you can use exactly the same arithmetic. In general, x+1+Dx will give you the same distribution as the original Dx. Thus, 21-D20 is completely equivalent to a D20.

Transforming die rolling procedures

Transforming a positive die into a negative die this way is useful when you want to transform a procedure from rolling "low" to rolling "high" or vice versa. Let me give an example from my own gaming history to illustrate this.

In a fantasy roleplaying game we used to play regularly a long time ago, the attack roll went as follows:
  1. Look up your own Attack score (ATT), usually a number from 11-20
  2. Look up the defender's defensive score (DEF), usually a number from 1-10
  3. Compute ATT - DEF
  4. You hit the opponent if you roll a D20 lower or equal to this target number. In other words, the attack is succesfull if D20 <= ATT - DEF.
This procedure makes sense mathematically. But we didn't like it, for the following reasons:
  1. First, you need to ask the opponent for his DEF score before you could compute a target number. I am a big fan of die procedures that allow you to roll a die without having to ask the opponent for information.
  2. Second you need to roll lower or equal to the target number, which for some reason feels "wrong". Players like to roll high!
So, how can you change this procedure? You can simply switch terms from the left side to the right side of the inequality, as you would do with algebraic expressions. If you want to address the first issue, you could alter the mechanic to D20 - ATT <= -DEF (move the ATT term to the other side of the inequality). Roll a D20, subtract your own ATT, then compare to the negative DEF score of the opponent. But with all the negative signs, this is weird ...
(Some of you might see similarities to AD&D 1st edition, with THAC0 and negative Armour Classes etc ...)

What else? Perhaps we can rewrite the inequality to DEF <= ATT - D20. Take your ATT score, subtract a D20, then compare that roll against your opponent's DEF score. That also addresses the first issue, but still is weird due to the negative D20, which still means you want to roll low..

So here's the trick: replace the D20 by 21 - D20, and you transform a negative die roll to a positive or vice versa. So D20 <= ATT - DEF can be rewritten to 21 - D20 <= ATT - DEF, and further to 21 + DEF <= ATT + D20, which is equivalent to D20 + ATT >= DEF + 21.
This is a much more elegant mechanic. You roll a D20, add your ATT score, and compare against the DEF score + 21 of the opponent.

The +21 die modifier is a bit strange, so you could replace all old DEF scores by new ones by adding 21. Since the original DEF scores usually ranged from 1 to 10, this would mean DEF score going from 22 to 31. But we can play around with the +21 factor as well, by distributing it over both sides of the equation. E.g., instead of using D20 + ATT >= DEF + 21, we can also use D20 + ATT - 10 >= DEF + 11. Since the original score for ATT ranged from 11 to 20, we now would get new ATT scores from 1 to 10, and the new DEF score would range from 12 to 21.

Whether you like the new procedure better than the old is of course a matter of taste.