Sunday, February 12, 2017

Buckets of Dice

Die rolling procedures in wargaming come in many different variations. In the previous blogpost I discussed opposed die rolling. This article focuses on the method that is most commonly known as the “buckets of dice” method.

For those of you for which the name does not ring a bell, the “buckets of dice” method generally refers to rolling a large number of dice – usually D6s – against a target number, and count the number of successes in order to resolve combat. This method is found in many wargaming rules, but the best known ruleset that makes use of it is without doubt Warhammer. But also historical rulesets such as Black Powder or Lion Rampant employ the buckets of dice method.

Often, the method requires several die rolls in succession. E.g. one player might roll 12 dice, requiring a target number to hit. Subsequently, the defender tries to “save” the hits by rolling versus another target number. Some rulesets even require three successive die rolls. Exact terminology and procedures might of course vary from a ruleset to ruleset.

As with any dice rolling procedure, the buckets of dice method itself does not define a ruleset. It only provides meaning when embedded in the context of a full set of wargaming rules. However, it is still useful to understand the underlying principles of such a procedure, irrespective of any surrounding framework. A good workman must understand his tools, and I think a wargamer, especially when he writes his own set of rules, must understand the inner workings of how dice work.

Before we proceed, let us first discuss some notation. We assume the use of normal six-sided dice. A roll of 5+ means a 5 or 6 is needed to score a “hit” or “success”, a 4+ means a 4 or higher is needed and so on. Similarly, 5- means a roll of 5 or lower is needed. When we roll 10 dice, needing a 3+ to score hits, we will write this down as Bucket(10, 3+). This saves us from writing down repeatedly how many dice we will roll versus what target number.

As for writing down probabilities, and depending on context, we will either use percentage numbers (e.g. 30%) or fractional numbers between 0 and 1 (e.g. 0.3), which are more commonly used for probability calculations.

As a last remark, we will consider everything from the point of view of the player trying to score hits or successes. In most game systems, this is the player trying to resolve an attack. This implies sometimes converting die rolls from “successes” to “fails”. E.g. when a “saving roll” is called for, needing a 5+, this implies the roll is deemed successful for the attacker on a 4-. A sequence in which the attacker needs 3+ to hit on 10 dice, and the defender needs a 5+ to save those hits, is written as Bucket(10, 3+, 4-).

Mathematics

I guess most wargamers understand that if you roll a single die, a target number of 4+ gives you 3 possible successes out of 6 possible results, a target number of 5- gives you 5 out of 6 positive results and so on. The table below summarizes these (rounded) probabilities for scoring a single success on the roll of a single die.

Single D6
1+ or 6-
2+ or 5-
3+ or 4-
4+ or 3-
5+ or 2-
6+ or 1-
% success
6/6 = 100%
5/6 = 0.83
4/6 = 0.67
3/6 = 0.50
2/6 = 0.33
1/6 = 0.17

When we roll multiple dice, things are more complicated. Suppose we roll 12 dice on 5+, how many successes can we expect? What is the probability we will score exactly 4 hits, etc.? Luckily, this branch of probability theory has been studied extensively. The mathematical function that describes such probabilities is called a binomial distribution. This function gives us the probability of scoring a specific number of successes, given the total number of dice rolled, and a probability for scoring a hit on a single die (see table above). We will not explain the full formula here, but the interested wargamer is referred to the appendix. Alternatively, one can found a lot of information online.

Let’s look at some charts to get an idea how binomial distribution look like in practice. The graph below plots the various outcomes for Bucket(6, 6+). As you can see, there is a 33% probability we will have 0 successes, 40% probability we will score exactly 1 success, 20% chance we score exactly 2 hits, etc. As can be expected, the probability for scoring 5 or 6 successes is almost zero (and too small to visibly plot on this graph). Note also the asymmetric distribution of the possible outcomes, with the event of scoring exactly 1 success being the most likely to occur.

Probability distribution of number of successes for Bucket(6, 6+)

A similar pattern is observed when the target number is kept at 6+, but we increase the number of rolled dice from 6 to 12. The plot below shows the distribution for Bucket(12, 6+):

Probability distribution of number of successes for Bucket(12, 6+)

When we increase the target number from 6+ to 4+, we expect more hits to occur, but we should also see a symmetric distribution since the chance for success and failure are both 50%. The graph below shows the distribution for Bucket(12, 4+):

Probability distribution of number of successes for Bucket(12, 4+)

Although such graphs provide us with a lot of data, it is a bit daunting to get a good grip on the variety of numbers. It is therefore easier to use of a more concise metric to characterize the possible outcomes of a binomial distribution. Two characteristics typically used are the mode and the expected value.

The mode is the number of successes that have the highest probability of occurring. For Bucket(12, 6+) the mode equals 2, for Bucket(12,4+) the mode equals 6, as can be immediately seen from the graphs above. It is not so that the mode will occur in more than 50% of the cases (a common misconception), but rather that of all possible outcomes (0 hits, 1 hits, 2 hits, …), the mode is the most frequent occurrence.

For the buckets of dice method, the mode can be computed by multiplying the number of dice + 1 by the probability of scoring a hit on single die, and then rounding down. Thus, for Bucket (10, 5+), we multiply 11 (10+1) by 2/6 = 3.67; rounding down results in 3 being the mode. Note that for a low number of total dice rolled, or for a low probability, the mode can possibly be equal to 0. There is one caveat, which happens when the result of the multiplication before rounding down produces exactly a whole number. In this case, the computed mode, as well as the mode - 1 both have the highest chance of occurring. E.g. the mode of Bucket(11, 5+) is both 3 and 4.

The expected value is a more fine-grained characterization of the buckets of dice method and expresses the average number of successes we can expect. As an example, consider Bucket(10, 5+) which might yield anything from 0 and 10 successes. If we would repeat Bucket(10, 5+) many times, and compute the average number of hits we score over many tries, we end up with the expected value. Alternatively, the expected value is computed by multiplying the total number of dice by the probability of a single success. For Bucket(10,5+) the expected value is computed as 10 times 2/6 = 3.33. This is not a whole number and perhaps a bit counterintuitive. After all, we will never score exactly 3.33 successes.

A good analogy to understand the difference between the mode and the expected value is by looking at the average number of children in a typical family, which equals 1.7 for many Western European countries. There is of course not a single family with 1.7 children, but this is simply the result of tallying all children and dividing by the number of families. However, families with 1 child are the most numerous, and therefore, 1 is the mode.

As a further illustration, the following table gives the mode and expected value (in brackets) for rolling 4, 8, 12 and 16 dice vs. various to-hit probabilities:

2+
3+
4+
5+
6+
4 dice
4 (3.33)
3 (2.67)
2 (2.00)
1 (1.33)
0 (0.67)
8 dice
7 (6.67)
5 and 6 (5.33)
4 (4.00)
2 and 3 (2.67)
1 (1.33)
12 dice
10 (10.00)
8 (8.00)
6 (6.00)
4 (4.00)
2 (2.00)
16 dice
14 (13.33)
11 (10.67)
8 (8.00)
5 (5.33)
2 (2.67)

For the buckets of dice method, the mode and the expected value differ by at most by 1. Therefore, both numbers equally give us a good idea of the nature of the distribution and the number of successes we can expect.

Successive buckets of dice

Often, wargaming rulesets require a succession of buckets of dice. A typical example consists of first rolling a number of dice as a “to-hit” roll, then rerolling the number of successes as a “to-save” roll. What can be expected in terms of successes for such a combined procedure? Again, mathematics comes to our rescue. The global behaviour of a succession of buckets of dice is itself a binomial distribution, with a probability for success equal to all separate probabilities multiplied.

Let’s use an example to clarify this. Suppose Bucket(12, 5+) is our “to-hit” roll, followed by a 4- saving roll (remember we look at this from the point-of-view of the attacker). This is equivalent to a single binomial distribution using 12 dice with a probability of 0.33 x 0.67 = 0.22 for success. The mode of such a distribution is 2, and the expected value equals 2.67.

This mathematical trick makes it very easy to compute the mode for successive buckets of dice procedure. The table below shows the resulting modes for 12 dice (and again showing the expected value in brackets), for two consecutive rolls:

12 dice
2+
3+
4+
5+
6+
2+
9 (8.33)
7 (6.67)
5 (5.00)
3 (3.33)
1 (1.67)
3+
7 (6.67)
5 (5.33)
4 (4.00)
2 (2.67)
1 (1.33)
4+
5 (5.00)
4 (4.00)
3 (3.00)
2 (2.00)
1 (1.00)
5+
3 (3.33)
2 (2.67)
2 (2.00)
1 (1.33)
0 (0.67)
6+
1 (1.67)
1 (1.33)
1 (1.00)
0 (0.67)
0 (0.33)


A useful insight is that the order in which the dice are rolled does not matter. Thus, you could as well roll the “to-saves” first, then the “to-hits”, and the overall statistical behaviour remains identical. Whether this makes sense within the terminology and intuition of the ruleset in use is a different matter, but from a pure mathematical point of view both procedures are exactly equivalent.

An identical analysis can be made for 3 consecutive buckets of dice. Warhammer typically uses a to-hit roll, a to-wound toll and finally a saving throw. Suppose that for a specific attack we roll 15 dice, and that the to-hit roll requires a 3+ to hit (0.67 probability). The to-wound roll requires a 4+ (0.50 probability), and the saving throw is at 6+ (0.83 probability success for the attacker). The combined multiplied probability equals 0.28, resulting in a mode of 4 and expected value of 4.16. Again, the order in which the die rolls are made is irrelevant.

As a consequence of the order in which the rolls are made not being important, a good practice is that in a succession of buckets, one could roll the dice versus the most difficult target number first. This will result in fewer dice to be rolled during the second roll, and might speed up dice counting and gameplay. Thus, if you need to roll versus 2+ and subsequently against 6+, consider reversing the target numbers. The statistical outcome will remain identical, but fewer dice are needed during the second roll.

Modifying the target numbers

Changing the target number by a series of +1 or -1 modifiers is the most common way to adjust for cover, weapon types, tactical situations, etc. A +1 or -1 results in an increase or decrease of the probability 1/6 or 17%. Some unexpected rounding effect might happen, but roughly speaking, we can expect that the mode goes up or down by 1 for every multiple of 6 dice and for each “click” by +1 or -1.

When considering a succession of buckets of dice, the effect will be further reduced since the 0.17 alteration is further multiplied by the probability of the other dice rolls. Let’s take an example of 3 consecutive rolls, scoring successes on 3+, 4+ and 3+. For 12 dice, the mode equals 2. Suppose the first roll has a +1 modifier, resulting in target numbers 2+, 4+ and 3+, now with a mode of 3. Although one tends to think the +1 modifier is a big deal when throwing 12 dice, the mode only goes from 2 to 3. Moreover, it does not matter that much on which of the three rolls the +1 modifier is applied. Suppose the modifier is applied to the 2nd roll. The target numbers now are 3+, 3+ and 3+. This gives also a mode of 3. Applying the modifier to the last roll results in a sequence of 3+, 4+, 2+ with a mode of again 3.

I have to admit I choose a set of numbers in such a way that applying a modifier did not have a major effect on the mode, but the example is typical. You might work through some examples by yourselves.

However, specifying different modifiers towards different rolls, each with their own terminology and flavour, can add significantly to the game design. But the actual effect on the expected numbers is most likely identical, irrespective whether you modify the 1st, 2nd or 3rd die roll in the sequence.

The latter implies that there is some latitude when defining a set of modifiers. As a rule of thumb, modifiers defined by the status of figures should be applied to dice rolls made by the player controlling those figures. A figure in cover that is shot at should get a positive modifier on his to-save roll, rather than applying a negative modifier to the to-hit roll. In the same manner, modifiers that depend on the range of fire, should be applied to the attacker’s roll, not to the defender’s roll. When players only have to check the status of their own figures, time is saved and the game flows faster.

Altering the number of dice

Another type of modifier is altering the number of dice. Some rules prescribe the number of dice as a function of distance for ranged fire; other rules might specify the default number of dice to be divided by 2 or 3 depending on situations such as cover or movement.

In any case, the effect on the number of hits we can expect is easy to see, since both the mode and expected value scale linearly with the number of dice: half as many dice roughly means half the mode, and half the number of expected successes.

Both type of modifiers (die roll modifiers or number of dice) can work in the context of game design. But I do think it is bad practice to mix them both. A ruleset that changes the number of dice depending on range, but then also modifies the target numbers on those rolls, is bad design. Either modify the number of dice, or the target numbers, but not both. A single set of coherent modifiers is much easier to remember for players, and mixing them all up leads to excessive consultations of the summary sheet or even worse, the rulebook.

Conclusion

Let's conclude with a summary of the good practices when designing your own buckets of dice procedures:
  1. Modifiers should be applied to the die roll made by the player controlling those figures that trigger the modifier;
  2. Either modify the number of dice, or the target numbers needed for success, but do not mix both in the same set of rules;
  3. If applicable, roll versus the most difficult target numbers first. This will reduce the number of dice in subsequent buckets of dice;
  4. And a last one, for aesthetics: invest in a number of dice, all of the same colour and size. It is much more visually pleasing to the eye when you can roll a handful of dice that look similar. Moreover, if your figures are painted to a high gaming standard, why stick to a crappy set of dice? As with figures and scenery, your dice deserve to be of high (visual) quality as well!
Appendix 1

The binomial distribution Bin(k, n, p) is usually expressed as a function of 3 variables: k is the number of successful events out of a total of n events, and p is the probability of a single event (in our case a die roll) being successful. If we roll 12 dice, with success being scored on 3+, Bin(5, 12, 0.67) then gives us the probability that exactly 5 dice will score 3 or higher.

The full formula is given by Bin(k, n, p) = C(n, k) . p^k . (1-p)^(n-k) with C(n, k) the combinatorial function C(n, k) = n! / k!(n-k)! ; and n! the factorial function n! = n x (n-1) x (n-2) x .... x 2 x 1. p^k is simply p raised to the power k.

As an example, let’s work out Bin(5, 12, 0.67). First we need to compute C(5, 12) = 12!/5!7! which works out to (12 x 11 x 10 x 9 x 8) / (2 x 3 x 4 x 5)= 792. Plugging this result into Bin(5, 12, 0.67) = 792 x 0.67^5 x 0.33^7 = 0.05. Hence, we have a 5% probability of scoring exactly 5 hits when throwing 12 dice and needing a 3+ to score a hit.

Most spreadsheet tools have a built-in function that computes the binomial distribution, so there is no need to program this yourself. Moreover, there are a number of useful apps to be found online that do the same and are able to produce nice graphs and charts.

Appendix 2 (added April 2018)

You can play around with the probabilities of the binomial distribution yourself, by downloading the MS Excel spreadsheet I have used for computing all the values shown in this blogpost. It allows you to alter probabilities, compute expected values, modes, etc.
I have only used this file in MS Excel, so I have no idea whether it works in other spreadsheet programs.

15 comments:

  1. Excellent analysis, Phil, offering much to consider!

    ReplyDelete
  2. Another great post, and great intro to the binomial distribution for the novice. (Though these days to generate these kinds of outcome distribution tables I skip the deterministic formula and just simulate many thousands of trials in R.)

    If you're looking for a suggestion for your next post, you might write something on how to find the probability of *at least one success* for a given number of trials n and individual probability p. It's probably one of the most frequent questions I get asked, and yet many people can't seem to grasp the logic of [1 - (1-p)^n].

    ReplyDelete
    Replies
    1. Yes, the "at least one success" mathematics are often confusing to people. Good suggestion!

      Delete
  3. Yes please; that'd be a great help for the profoundly unmathematical...like me for instance.

    ReplyDelete
  4. What an excellent (albeit potentially explosive) initiative this blog is. :-)

    I would love for you to provide similar analysis of card driven engines, or more specifically of card decks with variable amount of cards for two sides and a single card ending a game turn, as used in many rulesets by for example Too Fat Lardies.

    ReplyDelete
    Replies
    1. That would be a possibility. Mathematically, these things can be worked out ... ;-)

      Delete
  5. I abandoned dice for random number generation, and using a gaussian distribution to obtain outcomes similar to rolling 4 or more dice. This is as close to gaussian as required. Once you use this approach, the whole game process speeds up enormously. The price is to adjust games mechanics away from dice. An example of a combats results table is here

    https://iactaaleaest.files.wordpress.com/2008/07/crt-prob-small.jpg

    For rules for the wars of Louis XIV

    https://iactaaleaest.wordpress.com/2008/07/10/the-age-of-reason/

    ReplyDelete
  6. Ian,

    You do roll a single D100 to generate a combat outcome in your system?

    ReplyDelete
  7. anydice looks like a very useful tool in this area:
    anydice.com

    ReplyDelete
  8. How would I calculate the probability of a wound if I roll multiple dice to hit, and then roll the successes again to see if I wound?

    ReplyDelete
    Replies
    1. That follows the same procedure as outlined in the post. When you only roll the 2nd dice based on successes scored on the first, that doesn't alter the combined probability. Thus, if you need a 4+ on the first dice, and again a 4+ on the second, the combined probability is 0.25. Whether you roll that 2nd dice (after a failure on the first), is irrelevant, since the fail already happened.

      Delete