# Boots, Hammers, and Classic Math

From the invaluable comic Flintlocke’s Guide to Azeroth

Being a man subject to his vices, I’ve started up again on World of Warcraft. Not the new stuff, the “Classic” servers. “Is that what’s taking up your time?” I hear you all saying, “I had wondered why it was slightly less nerdy and pedantic around here.” Well, worry no more! For the joy and edification of the Ricochet audience, here I reproduce the work I did with the damage formulas. Because a simple post about Warcraft wouldn’t be nearly nerdy enough.

It all stemmed from a simple question; which is better, strength or agility? Strength adds damage, but agility adds some damage as well, and some critical hit chance too. So how do you compare them? You can’t categorically say that one is always better than the other. Well, you can, and people often do. But you can’t and still be right. In a broader sense, how do you decide between two items? Here, let’s go shoe shopping. Which pair of boots do you think goes better with my yellow damage?

Don’t Let the Shoes Fool You; It Gets Mathy in Here

Ignoring the enchant. And the fact that I don’t actually own these boots.

While I should have been doing useful things in college like homework, I was instead deriving an item selection algorithm for my druid. And for all of you nerds (let’s face it, the only people still reading now have a good shot at the title in the Dork Contest), here’s how it works:

You start by taking a swing at someone. (In game, @SamRhody. I haven’t been your brother this long without learning to duck.) You pull out your ax, wave it at a chump, what happens? Well, there are a couple of different possibilities. He could dodge. You could hit him. You could get a critical hit. You could miss entirely. Bottom line, though, your swing results in one of several options.

We’re talking about things we can change here. We can change misses into hits, and hits into critical hits. The other possibilities don’t change much. Our gear selection affects those outcomes, though. We’re going to ignore the other options and go with the following simplified equation:

(1) h + m + c = 1

That is, you chance to hit plus your chance to miss plus your chance to crit add up to 100%. It adds up to 100% because when you take your swing, something’s gotta happen. We’re dividing the universe up into those three possibilities.

That adding up to one makes it a stochastic system, by the way. “Stochastic.” There’s your vocabulary word for the day. “My you’re looking stochastic this evening, and your earrings are particularly monotonic.”

Now, we’re trying to maximize damage here, which means we’ve got to figure out how those numbers affect damage. Let’s assign capital letter damage to each probabilistic outcome. You can expect a critical hit to deal “C” damage. We’re weighting the probabilities with the damage we’re expecting from those outcomes. Over time that ought to work out to your average damage “D.”

(2) hH + mM + cC = D

When you swing, h percent of the time you’ll do one hit’s damage, which we represent as H, the other capital letters corresponding similarly. In fact, we can simplify this immediately, when we realized that “M” must necessarily be zero. If you’re doing more than zero damage you must have actually hit him, right?

(3) hH + cC = D

Okay, that’s easy enough. What else can we simplify? A critical hit is always going to do double damage. If we know that C = 2H, then we can substitute that in.

(4) hH + 2cH = D

(5) (h + 2c)H = D

Okay, one less letter. Anything else we can do for this? Well, look back at equation 1. Rearrange it like so:

(6) h = 1 – c – m

Oooh, there’s that pesky “m” sneaking back in. Substituting all that back into equation 5, we get

(7) (1 – c – m + 2c)H = D

Which boils down to

(8) (1 – m + c)H = D

From the companion webcomic, Flintlocke vs. the Horde

It Gets Worse

Alright? One more complication before things really go off the rails. Divide all that by time to get damage per second. The game already does that math for you, so we might as well stick with that number. Unfortunately, that change forces us to be a bit more specific about our topic. Up until now, everything’s been consistent with white and yellow damage. Here though, we’re restricting it to white damage only. That’s okay; white damage matters. Just note that dividing things by time gets more complicated quickly when you’re talking about voluntary character actions.

(9) (1 – m + c)H/t = dps

“Wait. What was that you said a moment ago about this going off the rails?” Well, up until now, this has been an exercise in probability and algebra. While I’m sure all y’all were just begging for one of those, it doesn’t tell us all that much that’s useful. Want to increase your dps? Up your crit chance, and add more weapon damage. We want to maximize the function; to choose items to optimally increase our damage. And math helpfully supplies us with a way to do that. We’re going to take the gradient!

The what now? Gradient. We’re jumping right past ordinary calculus into vector calculus. (Hey, even Weird Al does vector calculus just for fun.) The gradient takes a perfectly innocent function like the one we just derived, and it gives you a vector pointing in the direction of maximum increase. Okay, let me try and explain that.

Picture yourself in a field on the side of a gentle hill. Now, you’ve got three hundred and sixty degrees of options, choose an angle at random. Walking that way will either put you up higher on the slope or lower on the slope, or at the same height. One angle is going to point directly upslope, which is the one we’re interested in. If you had a function that described how the hill was arranged, you could take the gradient of that function and it’d give you that direction. Or the direction going directly downslope.* Fair enough?

To take a gradient, you take the partial derivative of your function with each variable in sequence and array them as a vector. It … it’s easier done than said, actually. Here, let’s just roll with it. An introduction to vector calc is beyond the scope of this post.

(10) grad(dps)(H,c,m,t) = < (1-m+c)/t , H/t , -H/t , -(1-m+c)/t^2 >

Those individual equations give you your damage vector. If you could increase your character stats in exactly that direction you’d be maximizing your damage.** We’ll be getting to what that means in a moment.

Which brings us way back ’round to our original question, maximizing your character’s damage. Recall the shoe shopping example from up above. Which pair of boots is better? Well, since we have that handy gradient vector, we just need to know which item aligns best with that gradient. How do we know which aligns best? We take the dot product with the item’s vector. That boils all our formulas down to one number per item. Biggest number wins.

“Slow down. What’s an item vector?” Boy am I glad you asked. If you hadn’t this post would have kind of tapered off awkwardly there. To get an item vector, you take the stats from an item and arrange them in a vector in the same order as your gradient. < 25 attack power , 0.24% crit chance , 0% hit chance, 0 change in attack speed*** > for example.

(Can you treat items as vectors? Is this all a load of hooey? That is an excellent question. I spent some time thinking about it, and it turns out that yes, you can. See my post on the zombie apocalypse for why.)

Lem’s the hairy-handed gent up top.

Okay, if you’re not going to click the link, you’ll have to take that statement on faith. Serves you right. “But you never explained what’s a dot product!” Fine. A dot product tells you how closely two vectors are aligned, in length and direction. (How? Go back to your vectors textbook. Again, explaining all that is beyond the scope of this post.) To take a dot product, you multiply each term of the vector with that term in the other vector, then add all those things together. Another thing that’s easier done than said.

Here’s Where We Get to the “Practical” Example

This is Lemuel. Lemuel is a level 60 druid. Lemuel need to decide between two big hammers for his cat form stats. Either the Impervious Giant or the Fist of Omokk. Before I go any further, these calculations are duplicated in a Google (yes, I know they’re evil) spreadsheet here.

Twice as Impervious as the Other!

Halt! The time of the hammer is upon us!

On with the show! We need to convert the raw stats on those items into item vectors. Easy enough:

(11) Impervious Giant: < 0 attack power change , 2% crit chance, 1% hit chance, no attack speed change >

(12) Fist of Omokk: < 29 strength, 0 crit chance change, 0 hit chance change, no attack speed change>

Reposting equation (10) from up above. We’re going to have to figure out what all those symbols actually are.

(13) grad(dps)(H,c,m,t) = < (1-m+c)/t , H/t , -H/t , -(1-m+c)/t^2 >

Okay, we’ve got a whole buncha symbols on the right we’ve got to define. “t” we can deal with right away; t = 1. It’s always 1 in cat form. “m” is another one; this isn’t listed anywhere on your character sheet. But I can tell you you’ve got a 5% chance to miss against a same-level monster, so we’ll go with m = 5% as a base. But Lemuel has +3% hit chance from other items he’s wearing, so m = 0.02.

That leaves us “H”, which is the damage you can expect on a single hit, and “c”, which is your critical hit chance. A look at the spellbook tells me my crit chance without any weapon equipped is 20.40%. A quick glance at the character sheet gives us a standard dps rate of 125.5. Wait. I know that strength translates into dps, but specifically what’s 29 strength mean in terms of dps?

Two quick identities, which are known World of Warcraft formulae, and verifiable on your character sheet.

(14) 14 attack power = 1 dps

(15) 1 point of str = 2 attack power for a cat druid; 2.4 after talents.

29*2.4/14 = 4.97 and change dps. Now we’re gettin’ someplace!

Let’s rewrite that gradient, only replacing the symbols with the appropriate numbers.

(16) grad(dps)(H,c,m,t) = < (1-0.02+0.2040)/1 , 125.5/1 , -125.5/1 , -(1-0.02+0.2040)/1^2 >

(17) grad(dps)(H,c,m,t) = < 1.178 , 125.5 , -125.5 , -1.178 >

Alright, then let’s rewrite the item vectors in terms of those same numbers;

(18) Impervious Giant: < 0 , 0.02 , -0.01 , 0 >

(19) Fist of Omokk: < 4.97, 0, 0, 0 >

Note that I changed +hit chance to -miss chance in equation 18; we want to make sure those negative symbols cancel out so we aren’t penalized for adding hit chance. Now, we need to take the dot product with each item:

(20) grad(dps)(H,c,m,t) (dot) Impervious Giant = 1.178 * 0 + 0.02 * 122.7 + (-0.01 * – 122.7) + -1.178*0

(21) grad(dps)(H,c,m,t) (dot) Fist of Omokk = 4.97 * 1.178 + a bunch of things times zero.

And all that is now is an exercise in arithmetic. Again, if you want to jump straight to the spreadsheet, I saved the calculation here. The dot product for the Giant works out to be 3.7 something. The dot product for the Fist works out to be 5.9 or so. Since the Fist of Omokk ended up with a bigger number, that tells me that Lemuel will deal more damage with that particular mace.

That’s the way it works. Of course, white damage isn’t the whole story. Which means the whole story is more complicated. You can work out yellow damage over time based on the skill rotation and

Problems: (Solutions to the even numbered problems will be provided in the back of the book)

1. Suppose Lemuel has that shoe-shopping decision mentioned up above. Without changing his gradient vector work out which pair of boots will help him deal more damage.
2. According to this derivation is hit chance or crit chance more important?
3. The commonly accepted wisdom is that maxing out your hit chance is better. What assumptions am I hiding that may explain that phenomena?
4. Okay, admit it. You’re not going to solve any of these other problems, are you?
5. Turn the idea around. Let’s say you’re looking to compare tanking equipment, and that you need to mitigate as much damage as you can. Write out a stochastic equation for the scenario where he’s swinging his axe at you, and derive an incoming damage formula that corresponds with equation (9).
6. If Lemuel is dealing out cat damage in a raid, he’s mostly going to be using the skill Shred. (48 energy, 225% normal damage + 160 to the target.) Assuming a steady state scenario where energy is only regenerating at the normal rate of 20 energy every two seconds, does adding shred into the damage equations change any conclusions?
7. Doyt is a warrior. Doyt would like to know if an iron counterweight or a +7 damage enchant would be better for his brainhacker. You may assume Doyt’s basic damage and crit chance are the same as Lemuel’s for the sake of argument.
8. After five shreds, generating one combo point each, Lemuel finishes off the combo with a Ferocious Bite, dealing 685 – 735 damage to the target. Does that change anything?
9. Lemuel has taken the talent Blood Frenzy, which grants him an additional combo point whenever he critically hits with shred. Given a crit chance of “c”, how many shreds can he expect to need to get to five combo points for a Ferocious Bite? Bear in mind that any combo points past #5 are wasted.
10. Write a new equation for damage that includes the yellow damage combo and the Blood Frenzy combo points. Take the gradient of that equation and write out a new character vector for Lemuel. Recalculate the Fist of Omokk versus Impervious Giant decision. Does the Fist still win?

*Since the gradient technically looks for maximum change, we could have a vector pointing in the exact opposite direction. In theory, that’s a concern. In practice, we won’t have to worry about that since we’ll be dealing exclusively with positive numbers. If your new hat gave you -1% crit chance, you wouldn’t expect it to increase you damage.

**There’s another complication here. “What about local minima? Or maxima? Or saddle points?” I hear all you Calc II grads asking. Yeah, right you are. I’m sure you did a lot of studying to get you through the hangover from the frat parties. But I might as well answer the objection.

Instead of a farmer out standing in his field, imagine a mountain climber. If he always goes upslope he’ll get to the mountain peak. Is that the highest he can get? What about that other mountain over there? Since he’s always going up he can’t go downslope to climb that mountain and check if it’s higher. So how do we know our item gradient doesn’t leave us stranded on a mediocre peak?

Here, the relative simplicity of the equation comes to the rescue. Excepting the time coordinate all the terms in the gradient are first order. You don’t get local maxima on a straight line.

*** As long as you’re working with straight dps you can take the dps number from weapons and generally ignore the time coordinate. It’s included solely to deal with questions like “would I rather have an Iron Counterweight or +7 damage enchantment on my weapon?”

Published in Science & Technology
This post was promoted to the Main Feed by a Ricochet Editor at the recommendation of Ricochet members. Like this post? Want to comment? Join Ricochet’s community of conservatives and be part of the conversation. Join Ricochet for Free.

1. Member
Arahant
@Arahant

Randy Webster (View Comment):
Yeah, but the computers they could stuff into a small rocket weren’t very sophisticated.

So now, they can make the rockets smaller and put them in clusters to ruin your whole day.

2. Inactive
cirby
@cirby

The original Diablo is on GOG.com for under \$12.00 including the Hellfire expansion pack. This is the game which pretty much started the entire RPG game type…

If you have a spare hour and would like to sink it into hearing about developing a game in the mid -90s:

The 90’s? We had computerized RPGs in at least the 80’s. Am I missing something in your statement?

Yeah, but the computers they could stuff into a small rocket weren’t very sophisticated.

The first Ultima game was in 1981, for the Apple ][.

3. Member
Arahant
@Arahant

cirby (View Comment):
The first Ultima game was in 1981, for the Apple ][.

Yep.

4. Inactive
cirby
@cirby

cirby (View Comment):
The first Ultima game was in 1981, for the Apple ][.

Yep.

Trivia:
I playtested Ultima, and ended up as a character in the game.

The people in the towns were all either named after friends of Richard Garriott, or named after their Society for Creative Anachronism personas.

5. Member
Arahant
@Arahant

cirby (View Comment):
The people in the towns were all either named after friends of Richard Garriott, or named after their Society for Creative Anachronism personas.

Which did you get?

6. Inactive
cirby
@cirby

cirby (View Comment):
The people in the towns were all either named after friends of Richard Garriott, or named after their Society for Creative Anachronism personas.

Which did you get?

7. Member
Arahant
@Arahant

cirby (View Comment):

Small claim to fame, but a very nifty one.

8. Coolidge
OccupantCDN
@OccupantCDN

The original Diablo is on GOG.com for under \$12.00 including the Hellfire expansion pack. This is the game which pretty much started the entire RPG game type…

If you have a spare hour and would like to sink it into hearing about developing a game in the mid -90s:

The 90’s? We had computerized RPGs in at least the 80’s. Am I missing something in your statement?

Yes, you’re missing that the game Diablo pretty much invented the player interface that all RPGs implimented after it. No more “Kill troll with nasty knife”

9. Member
Arahant
@Arahant

OccupantCDN (View Comment):
Yes, you’re missing that the game Diablo pretty much invented the player interface that all RPGs implimented after it. No more “Kill troll with nasty knife”

Right, but you did not say that. A new interface is different from creating the whole RPG genre. So, now we know what you meant.

10. Member
Boss Mongo
@BossMongo

Hank Rhody, Missing, Inaction: Being a man subject to his vices, I’ve started up again on World of Warcraft.

If World of Warcraft counts as a vice to you, you’re doing pretty good (math and all).

My vices can beat up your vices.

11. Member
Arahant
@Arahant

Boss Mongo (View Comment):
My vices can beat up your vices.

Laughing so hard, but also crying because it’s true.

12. Coolidge
MACHO GRANDE' (aka - Chris Cam…
@ChrisCampion

I spent many an hour with Warcraft 2. Love that game.

Which you can maybe still play via Battlenet.  Can’t believe it’s 20 years old now.

https://www.gog.com/game/warcraft_2_battlenet_edition

13. Coolidge
OccupantCDN
@OccupantCDN

OccupantCDN (View Comment):
Yes, you’re missing that the game Diablo pretty much invented the player interface that all RPGs implimented after it. No more “Kill troll with nasty knife”

Right, but you did not say that. A new interface is different from creating the whole RPG genre. So, now we know what you meant.

Right, I should’ve not used the word “Started”. I was well aware of the TSR “Video” games (which sucked) and the many others that came before Diablo. I should have used a word like “Defined”.

14. Coolidge
OccupantCDN
@OccupantCDN

I spent many an hour with Warcraft 2. Love that game.

Which you can maybe still play via Battlenet. Can’t believe it’s 20 years old now.

https://www.gog.com/game/warcraft_2_battlenet_edition

Starcraft ii – Broodwars is free from blizzard, Starcraft remastered:

https://starcraft.com/en-us/articles/20674424

Its another game that absorbed entire weekends for me.

15. Inactive
Belt
@Belt

OccupantCDN (View Comment):
Yes, you’re missing that the game Diablo pretty much invented the player interface that all RPGs implimented after it. No more “Kill troll with nasty knife”

Right, but you did not say that. A new interface is different from creating the whole RPG genre. So, now we know what you meant.

Right, I should’ve not used the word “Started”. I was well aware of the TSR “Video” games (which sucked) and the many others that came before Diablo. I should have used a word like “Defined”.

When you say ‘TSR video games’ the first thing that comes to mind is the Pool of Radiance series.  I thought they were awesome, but I’ll admit I’m not a gamer.

16. Coolidge
OccupantCDN
@OccupantCDN

OccupantCDN (View Comment):
Yes, you’re missing that the game Diablo pretty much invented the player interface that all RPGs implimented after it. No more “Kill troll with nasty knife”

Right, but you did not say that. A new interface is different from creating the whole RPG genre. So, now we know what you meant.

Right, I should’ve not used the word “Started”. I was well aware of the TSR “Video” games (which sucked) and the many others that came before Diablo. I should have used a word like “Defined”.

When you say ‘TSR video games’ the first thing that comes to mind is the Pool of Radiance series. I thought they were awesome, but I’ll admit I’m not a gamer.

I’ll admit I didnt play them in the 80s when they where at their peak – they just didnt translate into the dos/windows world. By the mid 90s they’d lost market share and bloom was definitely off the rose.

17. Member
Randy Webster
@RandyWebster

Belt (View Comment):
When you say ‘TSR video games’ the first thing that comes to mind is the Pool of Radiance series. I thought they were awesome, but I’ll admit I’m not a gamer.

I enjoyed them immensely, too.  I think they were generically known as the “gold box” games.

18. Member
Randy Webster
@RandyWebster

OccupantCDN (View Comment):
I’ll admit I didnt play them in the 80s when they where at their peak – they just didnt translate into the dos/windows world. By the mid 90s they’d lost market share and bloom was definitely off the rose.

I think SSI went out of business.

19. Thatcher
Percival
@Percival

OccupantCDN (View Comment):
Yes, you’re missing that the game Diablo pretty much invented the player interface that all RPGs implimented after it. No more “Kill troll with nasty knife”

Right, but you did not say that. A new interface is different from creating the whole RPG genre. So, now we know what you meant.

Right, I should’ve not used the word “Started”. I was well aware of the TSR “Video” games (which sucked) and the many others that came before Diablo. I should have used a word like “Defined”.

When you say ‘TSR video games’ the first thing that comes to mind is the Pool of Radiance series. I thought they were awesome, but I’ll admit I’m not a gamer.

I’ll admit I didnt play them in the 80s when they where at their peak – they just didnt translate into the dos/windows world. By the mid 90s they’d lost market share and bloom was definitely off the rose.

It was neat being able to run a solitaire nerd out without having to declare a Gathering of the Dweebs. (Can’t invite Vince and Hubert. Vince smokes like a chimney and Hubert’s asthma acts up if he so much as sees a Marlboro Man ad.)

20. Member
Matt Harris
@MattHarris

I didn’t play WOW the first time, but I started WOW Classic in late October.  Having a lot of fun.

21. Contributor
Hank Rhody, Missing, Inaction
@HankRhody

Hank Rhody, Missing, Inaction (View Comment):
(They’ve implemented the honor system but not battlegrounds yet)

Do you get negative honor for killing NPC’s?

Sorry, been pretending the internet doesn’t exist for a day or two. A bit thick when I’ve got to go wrap up the latest Dork contest.

Yeah, you get negative honor from killing NPCs, the ones that give quests, not the generic guards.

22. Contributor
@HankRhody

Hank Rhody, Badgeless Bandito: Turn the idea around. Let’s say you’re looking to compare tanking equipment, and that you need to mitigate as much damage as you can. Write out a stochastic equation for the scenario where he’s swinging his axe at you, and derive an incoming damage formula that corresponds with equation (9).

First of all, sorry to all y’all who are getting an alert on a resurrected thread. I got a hankering (see what I did there?) to solve some more of this math. With that in mind, he’re equation (9) for reference:

Hank Rhody, Badgeless Bandito: (9) (1 – m + c)H/t = dps

Alright, as a tank you get a couple options. You can dodge, block or parry. You can also take a hit and have it mitigated by your armor. Briefly,

(1a) o + b + p + m + c + r + h = 1

Where the letters are dodge, block, parry, miss, crit, crushing blow, and hit respectively. Crushing blows become important when tanking raids, but largely because I can’t be arsed to look up the formulas regarding them we’ll ignore that case, and assume r = 0. Jumping forward

(2a) oO+bB+pP+mM+cC = D

Where, again, you can ignore instances where no damage is dealt (dodge, parry, and miss)

(3a) bB+cC +hH= D

Here the analogy runs into a spot of trouble, block prevents some amount of damage B which isn’t all the damage (unless you’re up against a much weaker opponent), but still isn’t zero. Through some algebraic chicanery not legal in the state of Texas we can say that a shield with block value V will absorb B = (1-V/H)H  damage, which allows us to sprint on to

(5a) (b(1-V/H) + 2c +h)H = D

(6a) h = 1 – 0 – b – p – m – c

(7a) (b(1-V/H) + 2c + 1 – o – b – p – m – c)H = D

(8a) (0.95 +c -b(V/H) – 0 – p)H = d

and finally

(9) (1+c -b(V/H) – 0 – p – m)H/t = dps

Which, aside from that troublesome block term, is pretty similar to what we saw in the damage dealt case. To be useful here we’d also have to include the damage reduction that a change of armor value entails. Much like the crushing blow calculation, however, I can’t be bothered to look up the formula at the moment.

23. Member
Arahant
@Arahant

Hank Rhody, Badgeless Bandito (View Comment):
I got a hankering (see what I did there?)

I’m certain it can’t be helped, but there may be some mitigating medications.

24. Contributor
@HankRhody

Hank Rhody, Badgeless Bandito: If Lemuel is dealing out cat damage in a raid, he’s mostly going to be using the skill Shred. (48 energy, 225% normal damage + 160 to the target.) Assuming a steady state scenario where energy is only regenerating at the normal rate of 20 energy every two seconds, does adding shred into the damage equations change any conclusions?

Without going through the whole math again, the trick here is in the +160 damage. The 225% will scale with your normal damage and your crit chance, but the 160 will only scale with your crit chance. Uh, and the hit chance in both cases, only less so. What that means is  that +hit and +crit are going to be a little better than the model has yet shown. This shouldn’t be enough to shift the votes on the boots or the hammers.

Hank Rhody, Badgeless Bandito: After five shreds, generating one combo point each, Lemuel finishes off the combo with a Ferocious Bite, dealing 685 – 735 damage to the target. Does that change anything?

Same answer as to the previous question; this will scale with the hit chance and (to a lesser extent) the miss chance, not the straight up damage.

25. Contributor
Gary McVey
@GaryMcVey

First of all, sorry to all y’all who are getting an alert on a resurrected thread.

Hey, some of us practically live for getting alerts on resurrected threads, provided they’re good ones. This thread fills the bill.