Guides:Beyond average damage

From The Urban Dead Wiki
Jump to navigationJump to search

Suppose you're in the middle of combat. You're down to your last 10 AP, but you only need to do 2 HP damage to kill your opponent. How do you choose the right weapon for the job?

Concentrating on average damage is a good strategic approach - when choosing your skills, average damage per AP is a pretty good way to make that decision. But at the tactical level, it's not so reliable. As anybody who's played for long knows, in any given combat, you probably won't do average damage. This can be good (you get lucky and do more than average damage, taking out a difficult opponent with AP to spare), or it can be bad (you blast away at an easy opponent, watching your AP evaporate as you shoot the air).

This guide explains how to massage the odds towards the former, and away from the latter.

Example: Joe is an ex-survivor with no zombie skills. He has 86 XP, and he's fighting an opponent with only 4 HP left. If he can finish them off, he'll have enough points to buy a new skill... but he's only got 2 AP left to do it with. If he misses the chance, that juicy survivor will escape (or get killed by somebody else) and it could be a long time before he can find another victim. Should he use those 2 AP to bite (10% chance of 4 damage) or claw (20% chance of 2 damage)?

If Joe claws, he needs to get two hits from two attacks. Each attack has a 20% chance of hitting, so his total chance of success is 0.22 - just 4%. If he bites, he only needs one hit - the only way to fail is to miss on both attacks. His chance on missing on each attack is 90%, so the chance of missing both times is 0.92 = 0.81, leaving a 19% chance of success. Despite having the same average damage, the bite option is nearly five times more likely to succeed. As an added bonus, it has a chance of leaving him with an unused AP.

When you've got more than a couple of AP to spend, figuring out the exact odds is probably more trouble than it's worth. But if you just want to know which attack mode is better, you can get a long way with some simple rules of thumb and basic arithmetic.

Variance

The key concept here is variance. When looking at a random variable - say, the number of HP you do with ten fireaxe attacks - the variance measures how close it's likely to fall to the expected (average) value.

A small-variance attack mode is one that reliably does near-average damage over a series of attacks. A large-variance one is more likely to fall a long way from the average, either higher or lower. As a rule of thumb, if two weapons have a similar average damage-per-attack, the one with the higher damage-per-hit will have the higher variance. (More detailed calculations are provided at the end of this guide.)

So, is high variance good or bad? That depends on your situation. High variance increases the element of chance, making you more likely to win when the averages are against you, and less likely to win when they're in your favour.

If you're in Joe's situation, above, the average isn't good enough. He needs to do 4 HP damage, and his average damage on two attacks is just 0.8 HP - one-fifth of what he needs. No matter what he does, he's unlikely to succeed, but by picking a high-variance attack mode (the bite) he can make it more likely.

But sometimes, the average is good enough. What if Joe had 20 AP left? With twenty attacks, he can do an average of 8 HP, more than enough to take out his opponent. He just needs to make sure he does get close to that average damage; to do that, he should stick to claws. With twenty claw attacks, his chance of killing a 4 HP opponent is 93% (put another way, he has a 7% chance of failure); with twenty bite attacks, his chance of failure is 12%, almost double. His chances are good either way, but the low-variance mode is a safer bet.

Step 1: Identify your objective

Before you can apply this, you need to figure out what you're trying to achieve. Are you hoping to kill that enemy so they can't kill you? Kill them with AP to spare, so you can find shelter? Or just get the last handful of XP you need to buy the skill you've been waiting for?

Put simply: how many HP do you need to inflict, and how many AP have you got to do it in?

Step 2: Identify your options

This will be a choice between attack modes. (Or you could run away, but where's the fun in that?) Figure out the average damage per AP for each one - you can use the combat calculator, but don't forget to add in reload times if you don't have enough spare guns to finish the job.

Step 3: Is 'average' good enough?

Look at the options that give you the best and near-best average damage per AP (including reload times, if necessary). Is this good enough to achieve your objective within the available APs? If it is, then from those options choose the one that does the lowest damage per hit, because that's going to be the most reliable.

If the average isn't good enough, you need to shake things up: from those same options, choose the one with the highest damage per hit. This won't guarantee success - your chances will probably still be below fifty-fifty - but it'll give you better odds.

Step 4: Re-evaluate when odds change

Be prepared to change tactics if the odds change. If you're facing poor odds and start with high-variance attacks, you might get lucky and do heavy damage early in the fight; from there, it might make sense to shift to a low-variance mode, to hold onto the advantage you just got. And if you're using low-variance tactics in a favourable situation, but you miss attack after attack and the percentages shift against you, be prepared to resort to desperate measures.

Make this decision in exactly the same way as above, looking at your remaining resources and objectives. It doesn't matter how you got to that stage, only where you are now. For instance, in the example above, when Joe had 15 AP claws were his best option. But if he misses on his first six attacks, the odds are no longer in his favour; he needs to do more than average damage on the remaining nine, so he's better off shifting to bite.

Calculating variance

For those who want to calculate the exact numbers, the variance V of a single attack is given by:

V = D2*P*(1-P)

where D = damage per hit

where P = chance of hitting on any given attack

Example:
Flare Gun (Basic firearms training)
V = (15)2*(.15)*(1-.[15])
V = 225*.15*.85
V = 28.6875
V ≈ 29

Another way of calculating variance using average damage per attack:

V = A*(D-A)

where D = damage per hit

where A = average damage per attack

Example:
Flare Gun (Basic firearms training)
V = (2.25)*([15]-[2.25])
V = 2.25*12.75
V = 28.6875
V ≈ 29

To find the total variance of a multi-attack sequence, just add the individual attack variances together.

A useful rule of thumb

About two fights out of three, the damage you end up doing will be within sqrt(V) of the expected average. About nineteen out of twenty, it will be within twice sqrt(V). You can use this rule to get a better idea of your odds with any particular attack sequence.

Example: Sue, with Basic Firearms Training, carries four fully-loaded pistols and twenty flare guns. She needs to kill a 5 HP zombie (no flak jacket) and she has 20 APs to do it. Which weapon should she use?

The next day, with the same equipment, she needs to kill a 60 HP bodybuilder (again, no flak jacket). Once more, she has 20 APs. Which weapon should she use?

With pistols, she has a 30% chance to hit for 5 damage. The average damage per attack is 1.5 HP (so 30 HP for 20 attacks). The variance per attack is 5^2*0.3*0.7 = 5.25, so variance on 20 attacks is 105; square root of that is about 10.2, which we'll round off to 10.

By the rule of thumb given above, she has a 2/3 chance of doing somewhere between 20 and 40 HP, and a 95% chance of doing somewhere between 10 and 50 HP. That 5 HP zombie is dead meat (from a more precise calculation, her chance of killing it is actually about 99.9%) but she's not likely to drop the bodybuilder (only about 0.5% chance).

With flares, she has a 15% chance of hitting but does 15 points of damage per hit. Average damage is 2.25 HP per attack (45 for 20) and variance is 28.89/attack (574 for 20, sqrt(V) = 24).

Two-thirds of the time, her total damage will be somewhere between 21 and 69 points (of course, anything over 60 is overkill). 95% of the time it will be between -3 and 93 points. This makes her a serious threat to the bodybuilder (about a 35% chance of killing him), but she's not guaranteed to take out the 5 HP zombie (her chances are about 96%). Even though the average damage from the flare gun is 50% higher than the pistol, its greater variance makes it less reliable.

Weapon variances

Sorted in order, from highest to lowest:

Survivors

Weapon Hit chance Variance
Flare gun 15% 29
Shotgun 55% 25
Shotgun 65% 23
Shotgun 30% 21
Pistol 55% 6.2
Pistol 65% 5.7
Flare gun 2.5% 5.5
Pistol 30% 5.3
Shotgun 5% 4.8
Fire axe 40% 2.2
Fire axe 25% 1.7
Pistol 5% 1.2
Knife 50% 1.0
Fire axe 10% 0.81
Bat/pipe 25% 0.75
Knife 35% 0.7
Crowbar 20% 0.64
Knife 20% 0.4
Bat/pipe 10% 0.36
Crowbar 5% 0.19
Fist 25% 0.19
Fist 10% 0.09

If you're going to be reloading, especially shotguns, remember that these variances are added for each attack in the sequence, not each AP spent. This is unlikely to change your optimal weapon choice (shotguns are still going to give less variance than the 15% flare gun, more than anything else that has comparable average damage) but it can significantly affect the results of the "two-thirds/95%" rules of thumb given above.

Zombies

Attack Hit chance Variance
Bite 30% 3.4
Bite 20% 2.6
Claw + Rend Flesh 50% 2.3
Claw + Rend Flesh 30% 1.9
Bite 10% 1.4
Claw 50% 1.0
Claw 30% 0.84
Claw 20% 0.66

If you're a zombie, the bite is always going to be your higher-variance choice (since if you have Rend Flesh, your bite chance has to be at least 20% from Vigour Mortis).