Thursday, February 25, 2010

Average damage.

We will examine the average amount of damage when a player attacks a target (ie. monster).

The easiest way to look at average damage, is to examine the expectation value of the damage rolled.

We start off with a probability p of hitting a target, and rolling D amount of damage for a hit. (D is just a placeholder to represent dice damage, such as 1d6+2).

As a concrete example, let's look at an example where the damage is 1d4 and the probability of hitting is p. (We will ignore critical success and failures).

With probability p of hitting, the possible damage from rolling 1d4 is: 1, 2, 3, and 4 for which each of these damage values have a probability of 1/4. So mathematically, the expectation value of the damage is:

p[1(1/4) + 2 (1/4) + 3(1/4) + 4(1/4)] + (1-p)(0)

which after simplifying is: p[avg(1d4)] = p 2.5

The first term is when the attack hits, while the second term (1-p)(0) is when the attack misses.

Recall that the average value of a single d4 die is avg(1d4) = [1(1/4)+2(1/4)+3(1/4)+4(1/4)] = 2.5. In general, the average value of a single fair die dX is avg(dX) = (X+1)/2. (ie. A single fair die dX has X sides, with numbers 1, 2, ..., X on them, with a probability of 1/X of rolling any number from 1 to X).

To bring this example one step up, let's examine the previous concrete example for two attacks. The probability of hitting a target is still p, and the damage is still 1d4.

The expectation value of the damage of these two attacks is:

p^2 [avg(1d4 +1 d4)] + p(1-p)[avg(1d4)] + (1-p)p[avg(1d4)] + (1-p)^2 (0)

The first term is when both attacks hit, while the second and third terms is when one attacks hits while the other misses. The fourth term is when both attacks miss.

Doing some algebra and noticing that since the 1d4's are independently rolled, avg(1d4+1d4) = avg(1d4) + avg(1d4), we get: 2p avg(1d4) for the average damage done by two attacks.

(In more detail, the values of the total damage done by 1d4 in the first attack and another 1d4 in the second attack: are 2, 3, 4, 5, 6, 7, 8 with probabilities

1/16 for 2 damage
2/16 for 3 damage
3/16 for 4 damage
4/16 for 5 damage
3/16 for 6 damage
2/16 for 7 damage
1/16 for 8 damage.

The average total damage value of two d4 rolls is:

2(1/16) + 3(2/16) + 4(3/16) + 5(4/16) + 6(3/16) + 7 (2/16) + 8(1/16)

which gives: 5 = 2.5 + 2.5

One can do a similar exercise and show that for doing three d4 rolls for damage, the average total damage will be 7.5 = 2.5 + 2.5 + 2.5).

If one has the patience, once can show that for three attacks the average damage done by the three attacks is: 3p avg(1d4).

More generally, if individual attacks have different to-hit probabilities of p1, p2, ..., pN and their respective damage dice rolls are D1, D2, ..., DN, one can show using mathematical induction that the average damage done by these N attacks in sequential order from 1 to N is:

p1 avg(D1) + p2 avg(D2) + ... + pN avg(DN)

(To show this, one uses avg(D1 + D2 + ... + DN) = avg(D1) + avg(D2) + ... + avg(DN) since the damage dice rolls are independent of one another).