September 3, 2015

Finger Counting

Math is something that the Digits of Vecna believe in strongly. We don't claim to be experts- just a handful of engineers, computer scientists, and a math minor. Two of us are math tutors and teach through 12th grade mathematics regularly, so the statistics of game design are pretty familiar to us. This new article series will explain some of the mathematics, both generally and specifically, of role playing games, paying special attention to the math of D&D 5e.
     This article will explain some of the basics, and we plan to expand on this in later articles.



Average Die Rolls 

Let's talk about the amount you should expect when you roll a die. Take the humble d6 for example: what would you guess the average of that die is? Most people expect the average value of this to be 3, since the average is the center of all values and 3 is half of 6, but let's do the math. The sum of the sides of a d6 are:


And the average of the sides is the sum divided by the number of sides, in this case 6:


3.5! That's a whole half greater than I expected when first asked this question. The question is, does this hold up for other dice? Do a few quick examples yourself if you’re not convinced. The average of a d8 is 4.5, the average of a d10 is 5.5 and the average of a d20 is 10.5. The rule is as follows:


Probability of Success

The probability of success is something that is almost always provided for the gamer, and is often created by the Dungeon Master. Armor Class (AC) and Difficulty Class (DC) are two mechanics that fill in one half of the equation of success. The other half is often something provided by the gamer and the roll of a die.

Using armor class as an example, if a 1st level rogue is attempting to hit a goblin with 16 AC, he rolls a d20 and adds his attack bonus, which let's assume is +5. This means if the rogue rolls a 11, his total attack is at 16, and hits the goblin. Since 11 and higher hits, there are 10 possible values to roll that hits. 10/20 = 50%, the probability of success.

Expected Value

The expected value is the amount of return you should expect when you take a chance. We can figure this out by taking the probability something will happen, and multiplying it by the average return if that thing happened.

While it's true that the rogue's damage die is a d6, and he gets to add his Dexterity to damage, he shouldn't expect to deal 6.5 points of damage when he rolls the D20. After all, he could miss. Or Crit.

Let's calculate this chance. If the rogue rolls below a 10, he misses the attack and deals no damage.

If he rolls between 10 and 19, he deals d6+3, which we'll assume is an average at 6.5.

If he rolls a 20, he crits, and deals 2d6 (7) + 3.

On a table:

d20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Damage 0 0 0 0 0 0 0 0 0 0 6.5 6.5 6.5 6.5 6.5 6.5 6.5 6.5 6.5 10

The sum:

The average damage, and hence the expected value, is the sum divided by 20:


Advantage and Disadvantage

Advantage and its evil counterpart, disadvantage, are a mystifying mechanic in D&D 5e. Unlike a static modifier to probability of success, the benefit offered by advantage changes based upon the probability of success, and makes it particularly tricky to understand. But how much does advantage and disadvantage help and hinder you?

Let's assume you gain advantage on a roll that has a 75% chance of success. Conversely, this means that you have 25% chance to fail. Only when the first die rolls a failure can advantage change the result of the roll, so this is what we'll focus on. Your chance of success, therefore, is the chance you'll succeed normally plus the chance that advantage will change a failure into a success.

Of the 25% of the time you roll a failure on the first die, you have a 75% chance of rolling a success on the second die. This means advantage helps you 75% of 25% of the time (this is 18.75%, if you're following along.) Therefore, the total chance of success is 75% + 18.75% = 93.75%.

The formula for chance of success with advantage is:

Probability of Success with Advantage = Probability of Success + Probability of Failure * Probability of Success

And we have a neat little equation here! I'll plug in some variables, rather than writing everything out. (Note: If you're a mathematics wizard, let my choice of variables names slide this time.)

And we can rewrite this a number of ways once we know that the chance of success is the complement of the chance of failure (S=1−F and F=1−S.) Three formulas probability of success with advantage:




A similar thing happens for the chance of success with disadvantage:

Probability of Success with Disadvantage = Probability of Success - Probability of Failure * Probability of Success

And we can do most of the same equation manipulation stuff here to get a couple more versions of this equation:



One last thing to note about the probability of success with disadvantage is that, since the probability of success is less than 1, squaring this number, as we do in the last equation, actually makes it smaller.

5 comments:

  1. Umm.... you have a mistake in the Probability of Success section. Since the rogue hits on a 10 or higher, there's 11 chances to hit (which you note in your next section), or 55%. And then your next example breaks down, because 11/20 is not 55%.

    ReplyDelete
    Replies
    1. Nice catch! (Off-by-1 errors get me every time.) I've adjusted the first example to fit the result, so I don't have to re-produce the math images.

      Delete
    2. Call me an idiot, but we were taught that 10/20 is equal to 50/100 wich is 50%. We were also taught that 11/20 is equal to 55/100 wich is 55%. Is there a variable I don't see or am I just an idiot?

      Delete
    3. Oh, you're right. That was a part of an edit I made earlier. It looks like I missed that section

      Delete
    4. Glad I helped. Just so you know, I am still confused by the math here XD. I'll get it one day.

      Delete