Sub topic 5
Probability and Expected Value for Crits, Misses and Drops
This chapter assumes you can use cell references, fill-down and basic functions in Excel or Google Sheets. It also assumes you are comfortable with percentages and exponents, and that you have a workbook with a Params sheet like the one from the earlier chapter on workbook structure. You will learn to turn chances such as "15% crit" or "2% drop" into numbers a spreadsheet can check.
Why chance needs its own math
Games hide randomness behind percentages. A sword hits 90% of the time. A hit crits 10% of the time. A boss drops a rare item 2% of the time. Designers need to answer two questions about each of these:
- On average, what does it do? This is the expected value.
- How bad can bad luck get? This is the spread around the average.
Expected value (EV) is the average result of a random event if you repeated it many times. You get it by multiplying each outcome by its probability and adding the results. A probability is a number from 0 to 1 (or 0% to 100%) that says how often an outcome happens.
A coin flip that pays 10 gold on heads and 0 on tails has EV = 0.5 × 10 + 0.5 × 0 = 5 gold per flip. No single flip pays 5. The EV describes the long-run average.
Expected damage per attack
An attack has three random layers. It can miss. If it hits, it can crit. A crit multiplies damage. Put each layer into a parameter cell so you can change it without editing formulas.
| Cell | Meaning | Example |
|---|---|---|
| B2 | Damage on a normal hit | 50 |
| C2 | Hit chance | 0.90 |
| D2 | Crit chance (given a hit) | 0.20 |
| E2 | Crit multiplier | 2.0 |
The expected damage per attack is:
=B2 * C2 * (1 + D2 * (E2 - 1))Here is why this works. Given a hit, the average multiplier is (1 - D2) * 1 + D2 * E2. That simplifies to 1 + D2 * (E2 - 1). The crit only adds the extra part, E2 - 1, on the fraction D2 of hits. Multiplying by C2 and B2 applies the miss chance and the base damage.
With the example values: 50 × 0.90 × (1 + 0.20 × 1) = 50 × 0.90 × 1.2 = 54 expected damage per attack.
You can check the formula by hand from the tree: 0.10 × 0 + 0.90 × (0.80 × 50 + 0.20 × 100) = 0.90 × 60 = 54. The two methods agree, which is a good habit to build. Compute the same number two ways before you trust a formula.
Crit chance stacking
Players often gain crit chance from several sources. Adding percentages works while the total stays at or below 100%. Cap it so a stack of bonuses cannot produce an impossible chance:
=MIN(1, Params!$B$6 + Params!$B$7 + Params!$B$8)Without the cap, a total of 130% would feed the damage formula and give an expected multiplier higher than the crit multiplier. That is a silent error. The sheet shows a number, and the number is wrong.
Probability of at least one drop
Drops are different. A drop has a chance p on each attempt, such as a kill or a chest. Attempts are independent, meaning one result does not change the next. A common mistake is to think a 2% drop is "guaranteed" after 50 attempts. It is not.
The chance of no drop in n attempts is (1 - p)^n. So the chance of at least one drop is the complement:
=1 - (1 - B2) ^ C2Here B2 is the drop chance and C2 is the number of attempts. Try a 2% drop (B2 = 0.02):
| Attempts (C2) | Chance of at least one drop |
|---|---|
| 10 | 18.3% |
| 35 | 50.7% |
| 50 | 63.6% |
| 100 | 86.7% |
| 150 | 95.2% |
The expected number of attempts is 1 / p. For 2%, that is 50 attempts. But after 50 attempts, a player has only a 63.6% chance of having the drop. About 36% of players are still empty-handed. This gap between the average and the typical experience is the main lesson of this section.
To find how many attempts a player needs for a target confidence, invert the formula. For 90% confidence:
=ROUNDUP(LN(1 - 0.9) / LN(1 - B2), 0)For B2 = 0.02 this gives 114 attempts. Put the confidence level in a parameter cell instead of typing 0.9 in the formula.
Reading the drop table as a design tool
Use the table to set the target. If you want most players to see the item within about two hours, and a player gets 30 kills per hour, then 60 attempts should give a high chance. Solve for p instead of n:
=1 - (1 - 0.9) ^ (1 / C2)With C2 = 60 and 90% confidence, this gives about 3.8%. That is the drop chance that gives a 90% chance of at least one drop in 60 attempts. Again, keep 0.9 in a parameter cell.
Seeing the spread with a simulation
The formulas above give averages and thresholds. To see how individual players vary, simulate. Each row below is one imagined player. The formula returns how many attempts that player needed:
=MAX(1, ROUNDUP(LN(1 - RAND()) / LN(1 - $B$2), 0))RAND() returns a random number between 0 and 1. The logarithm ratio converts it into a number of attempts that follows the geometric distribution, which is the standard model for "attempts until the first success."
Fill this formula down 500 rows, then summarize:
=AVERAGE(D2:D501)=PERCENTILE(D2:D501, 0.9)With a 2% drop, the average lands near 50, and the 90th percentile lands near 114. Some rows will show 200 or more. Those rows are the players who write angry forum posts.
Common errors
- Treating EV as the experience. An average of 50 attempts does not mean 50 attempts is typical. Report a percentile as well.
- Adding probabilities of repeated attempts. Ten tries at 2% is not 20%. It is 18.3%. Adding overcounts because it double-counts cases with several drops.
- Multiplying instead of complementing. To get "at least one," subtract the "none" case from 1. Do not multiply
pbyn. - Mixing percent and fraction formats. If a cell holds
15in one place and0.15in another, results are off by a factor of 100. Pick one format and format cells as percent. - Uncapped chances. Hit, crit and drop chances must stay between 0 and 1. Use
MINandMAX. - Hidden rules. Pity timers, guaranteed drops and bad-luck protection change the math. A formula for independent attempts no longer applies, so model them separately.
- Too few simulation rows. Small samples swing widely. Increase the row count before concluding anything.
Putting it into the workbook
Follow the structure from earlier chapters. Keep all chances on the Params sheet, put the formulas on a calculation sheet, and send results to an output sheet. A reasonable layout is:
Params: hit chance, crit chance, crit multiplier, drop chance, confidence level.Calc: expected damage per attack, attempts for the target confidence, and the simulation column.Outputs: a small table with expected damage, the 50th and 90th percentile of attempts, and a check cell comparing the simulated average with1 / p.
The check cell is worth adding. If the simulated average strays far from 1/p with 500 rows, you probably have a typo in the simulation formula.
Exercise
An attack deals 80 damage, hits 75% of the time, crits on 25% of hits, and a crit does 1.8 times damage. (a) What is the expected damage per attack? (b) A rare drop has a 4% chance per kill. What is the chance of at least one drop in 30 kills, and what is the expected number of kills?
Show answer
(a) 80 × 0.75 × (1 + 0.25 × (1.8 − 1)) = 60 × 1.2 = 72 expected damage per attack. (b) The chance of at least one drop is 1 − (1 − 0.04)^30 = 1 − 0.96^30, which is about 1 − 0.294 = 70.6%. The expected number of kills is 1 / 0.04 = 25. Even so, about 29% of players will not have the drop after 30 kills.
Exercise
Your design goal is that 95% of players get a boss drop within 40 attempts. Which spreadsheet formula gives the drop chance you need, and roughly what value does it return?
Show answer
Use =1 - (1 - 0.95) ^ (1 / 40), with 0.95 and 40 stored in parameter cells. This returns about 0.072, so a drop chance of about 7.2% per attempt.