Theorycraft 101: How to Compute Uptime of a Proc-based Buff

Update: There is now a continuation of this post here, which gets into some more detail and trickier topics.

About a year ago I did a few posts in a series I called “Theorycraft 101″.  The basic point is to have post outlining basic computations/formulas I use in making spreadsheets and like, so other people who do these things don’t have to reinvent the wheel.  I think there’s often not a lot of communication across classes on these things, so I want to make non class-specific references for things that come up a lot.

For reference, here are the past ones:

Today’s Topic: Proc Uptime

Blizzard recently posted a description of a new system for procs, used for Windsong and presumably other similar new enchants.  We’re going get to the details of the new Windsong at the end.  For now, some short background.

Effect that have a % chance to proc on each attack/heal have one main issue.  Different classes have wildly varying amounts of combat events, so they are hard to balance cleanly.  There are two main types of solutions:

1) Put a long cooldown on the proc (such as the typical 45-60 seconds found on trinkets), and make the expected proc time very low.  That way even if it varies wildly (2 seconds for one class and 5 seconds for another), the actual average time between procs might 62 seconds for one person and 65 for another–close enough to avoid balance problems.

2) Use a system that scales the proc chance based on how often a class has attacks or other combat events.  This is where the “PPM” (procs per minute) concept comes from–procs whose actual % chance to fire varies based on attack speed.  But this is very hard do in practice since classes have so many mechanics other than autoattacks/nukes that weapon speed and/or cast time are not good estimates of how often you get a chance to proc.  This is where the new system comes into play.

I’ll address each in turn below.

ICD-Style Procs

These are very easy to work with if you’re making a spreadsheet.  Since the cooldown is dominated by a large constant (the ICD) all you have to do for a very good estimate is find that constant.  This is done quickly in one of two ways:

1) Check Wowhead since someone’s probably done it already (e.g. Zen Alchemist Stone–55 seconds)

2) Go to a target dummy, use /sw to open the stopwatch, and just check the time between procs a few times.  Remember, you don’t need a large data set and an average.  You just need to find the minimum time to within about 5 seconds, and a few trials usually makes it clear.

Then, your uptime is simply Duration/Cooldown.

For a slightly better estimate, add a short delay to the ICD representing the time it takes to get an actual proc.  You’ll need to find the proc chance (often the wowhead spell database entry for the actual buff effect will have it), and roughly estimate how often you attack.

PPM-Style Procs

The new system outlined in the blue post above is basically an attempt to normalize the proc rate of an ability no matter what the user’s distribution of attacks over time is.

The chance of an attack (or heal) to trigger the proc is equal to

PPM cdot H cdot T / 60
  • PPM is the buff’s built-in PPM constant.
  • H is your haste factor (1 + your average haste %)
  • T is the time since the last attack that gave a chance to proc.
  • D (used below) will be the duration of a buff

I’ve seen people misread this.  The system is not based on the time since your last actual proc (i.e. this is not a corrective effect that makes you more likely to get a proc if you haven’t had one recently).  It simply takes into account, every single time you attack/heal, how long it’s been since the last time you had a combat event that gave a chance to proc.

Here’s the concept they’re getting at.  You have 1 PPM proc and 0 haste.  If you attacked once per second exactly, each attack would have a 1/60 chance to proc.  But if your attacks are distributed irregularly over time, it does something fancier.  Say one second goes by without you attacking.  Then during that one second, you “bank” 1/60 chance to proc.  That chance will be “used” whenever you next attack.  So if another second goes by and then you attack, you’ll have 2/60 proc chance “stored” and that will be the proc chance on that hit.  Basically, proc chance accrues at the correct rate with each passing moment and every time you attack, the correct chance is assigned based on how much you’ve built up since the last time.

The end result of all this?  If you want a solid estimate that ignores the one little quirk of no-cooldown procs (the chance of an overlap), it’s perfectly simple, since the game accounts for all the variation already:

PPM cdot D cdot H / 60

(I didn’t discuss above why H is there, but basically, PPM-based procs are meant to improve if your haste increases.  Since otherwise, this system would completely cancel out the benefit of added haste as you attack more quickly, they build H right into the proc chance).

More Elaborate PPM: Overlaps and Poisson

Let’s say you want to elaborate a bit.  The only real problem with the above estimate is that a PPM-style proc can fire twice in a row and waste part of the first buff.  If the proc rate is relatively small, this won’t happen often enough to disturb the above approximation.  But, since the result is pretty interesting mathmatically, and easy enough to throw into a spreadsheet if you’re making one, I’ll outline it here.

The underlying assumption here is that the new PPM system turns procs into a Poisson process.  Poisson processes are events that happen at a certain average rate, with each event being independent of the last (an example is nuclear decays), and their statistics are well-understood.  This is a good model for WoW procs as long as the attack rate is very high compared to the time intervals being examined (see appendix for more on this).  So in the case of Resto Druids who spam out combat events constantly, it’s almost perfect, but even slow attack classes fire off a number of combat events during, for example, the 12 second duration of Windsong.

I’m not going to get into details here, just one key fact.  If a Poisson process occurs, on average, lambda  (lambda) times in a certain time interval, then the chance of having it happen zero times in that interval is

e^{-lambda}

(This is for all those of you who learned about e in high school trigonometry and wondered what you’d ever use it for)

But wait–that’s all we need.  At any time, the chance of Windsong being up is simply one minus the chance that it has not fired in the past 12 seconds.  But since we know that the mean procs per minute is PPM*H, the means procs in a 12 second interval is PPM*H*(12/60).  Therefore, Poisson gives us our uptime:

1 - e^{-lambda}
1 - e^{-PPM cdot H cdot D / 60}

Basically, in any spreadsheet or other model you’re doing for any class, as long as you know your haste, just drop in that formula for Windsong or any similar buff and you’re good to go.

P.S. Windsong itself has one unique quirk.  It’s actually 3 separate procs (crit, haste, or mastery).  So even though the post describes it as having PPM = 2, what you really want to model it as is 3 procs each with PPM = 2/3.  This will account for the fact that each of the 3 Windsong buffs can stack with each other, but only overwrite if you re-proc the same one.

Appendix

Here’s just one pretty interesting aside for the math-inclined.

Let’s say you did have a constant attack rate, or are modeling something like Flurry that lasts for a fixed number of hits rather than a fixed time.  Then, your logic might be that you have the buff unless none of your past N hits procced it (with proc chance P).  Therefore your uptime is

(1 - (1 - P)^N)

A formula that’s been used in various classes’ spreadsheets for a long time.

Let’s do something interesting.  Assume that your attack speed (x) changes, but with proc chance per hit and number of hits during the relevant duration adjusted accordingly.  Basically, vary the attack rate while holding constant the mean procs per second (p) and the time window of interest (t) Then we might have something that looks like

1 - (1 - px)^{frac{t}{x}}

Since the proc chance per hit is px, and the number of attacks in the time window is t/x.

Now what happens if your attack rate goes to infinity (i.e. time between attacks goes to 0). Well, if you remember your calculus, you may recall that:

lim_{x to infty} (1 + frac{y}{x})^x = e^y

So rearranging very slightly and applying to the above:

lim_{x to 0} (1 - px)^{frac{t}{x}} = e^{-tp}

But tp is the procs per second times the time window of interest, which is the expected number of procs in the time window, which is lambda .

So, as attack rate approaches infinity, our proc uptime is:

1 - e^{-tp}
1 - e^{-lambda}

Which is the same as what we got from the Poisson model above.  Pretty nifty.

Why More Spirit is not the Answer to your Healing Problems

[4/8/13: Six months later and I see this post getting quite a lot of attention on various forums. While I’m glad of that, I do want to make sure people finding their way to it just now also see the follow-up posts in the Healing Theory sequence. The first is here, and the third is particularly relevant to this discussion. Those posts are further developments of the ideas that first came to me while writing this one. While I still stand by the main ideas of this post, it was more of a reaction to certain discussions at the launch of the expansion, whereas the later sequence is meant to be a more general exploration of healing principles and conclusions. ~H]

When I recently made a post on EJ about how healers are, as they always do at the beginning of an expansion, overly obsessing about Spirit, the first reply I got explained it in the most simple and accurate way possible: “Fundamentally I’m pretty sure most healers are very, very bad theorycrafters. There’s always been a lot of magical thinking, faulty logic and poor contextual analysis.”

Based on my experiences theorycrafting and writing for a healing class for a few years now, I can’t deny that in any fashion.  When I quoted it on twitter someone told me, “you don’t have to be a theorycrafter to be a good healer.”  Well, that’s partially true.  You don’t have to be an “active” theorycrafter to be good at any class.  You don’t have to be the one making the spreadsheet–after all, there’s only one of him.  But you have to have enough of an understanding of the numbers underlying the class to interpret what that person tells you and reflect it in your play.  This is well-accepted for DPS, but for healing, people have difficulty thinking the same way.  Just because your task varies more with context, you’re not going to be a good player by just going and doing whatever you feel like without regard to the same kinds of tools.

Mana Regen

I’m just going to pick out one piece of it today, one that arises regularly at the beginning of each expansion.  Everyone goes nuts for more mana regen.  Picking Spirit items and gemming Spirit is one thing, but talk about using Spirit flasks and Spirit food is very common.  In fact in most communities the common wisdom is that that makes more sense than using Int food/flasks.  Now, for the spoiler version: that’s wrong.  Use Int food and flasks.  But you can read below for more on both the right and wrong thought processes here.

Spirit is in no way a bad stat (for Druids at least–I can’t comment in detail on other classes but the qualitative results below will be the same).  But most people’s understanding of why they should choose it goes about this far:

“I’ve been running out of mana so far this expansion. I should get more Spirit than I already have.”

Literally–that’s it.  I’m not actually aware of a single post or bit of analysis, for Druids at least, that takes it further than this.  Now, even if we imagine for the moment that the second sentence follows from the first (and I will explain below that it emphatically does not), the first point is that this is a hopeless mode of analysis.  It has no numbers in it and no limit or conclusion.  It’s a blind guess at how to play WoW correctly.  On any DPS forum (well, on EJ), a post like that would get tossed from the thread.

 The Basic Tradeoff

Fundamentally what this is about is the strength of your heals vs. the total amount of mana you can spend over the course of a fight.  Which stat is exactly best for the strength of your heals may vary by class, but the basic framework has been made vary homogeneous–Int increases all heals by a standard amount, secondary stats tend to improve throughput by around half as much as Int, and Spirit regens the same amount for everyone (specifically, each Spi adds 0.564 MP5 during combat, on top of the 6000 base MP5 you have).  The only real class-based variance will come from the occasional ability that scales extremely strongly with Spirit (Mana Tide is perhaps the only remaining one, and even then only in a 25-man) (edit: Chris notes in the comments that the new Spirit-based Rapture may be another).

How do we evaluate how much benefit this extra mana gets us?  That’s the key question.  And the point I’m going to keep coming back to is that if all you say is “well I’m picking Spirit because I think need more mana” or “with poor gear early in the expansion, I need to build my regen,” you’re not answering it.  In fact, you’re not answering anything.  Spirit is a stat like any other–you have to measure what it gets you and compare to other stats.  We’re going to get into that below, but first, the most common stumbling block for people:

“I’m running out of mana. I have to get enough Spirit to get through the fight, and then I can worry about other stats”

If the only thing you get from this post is why this doesn’t make sense, you’ll be on your way to being a better healer.

Just a Few Numbers (nothing scary)

Every class has their “core” spells–the strong, efficient spells, usually with some kind of cooldown so they’re not they only spells you use.  For example, for Druids, it’s Wild Growth, Lifebloom, and Swiftmend.  Circle of Healing, Riptide, etc. are similar.  You want to use these spells a lot and you generally use them regularly through the whole fight.  Most importantly, they are very inelastic with respect to mana: you want to use them when you need them.  Your mana resources will determine how much is left after all the “core” spells you cast, the amount you can spend on “filler” spells.  Filler spells aren’t necessary bad–they’re key parts of your skillset (Rejuvenation, Divine Light, etc.), but it’s important to realize that spamming them heavily tends to result in inefficient healing.

Most importantly this informs how to think about Spirit.  What it buys you is more casts of filler spells over the course of the fight.  Let’s work an example: as a Druid, let’s say I used a Spirit flask, 1000 Spirit.  Over the course of, let’s say, 3 minutes of healing, that 1000 Spirit will get me just over 20000 mana.  Or, roughly enough to cast 2 Rejuvenations.  So that’s the first step.  In my head, I’ve relabeled Flask of Falling Leaves as “Flask of 2 Rejuvs.”  Suddenly it does not seem very compelling.  Depending on your class, you probably feel the same way about the “Flask of 1 extra Greater Heal” or whatever it may be.

What about an Int flask?  Well, in my pre-raid gear I have well under 10000 Int (remember that armor specialization and other % bonuses from talents should not be included here).  So 1000 Int increases all of my healing by around 10% (edit: Erdluf points out in comments that 5% is a better napkin estimate here, but as he says, the conclusions are unchanged).  Including those Wild Growths and other core spells that didn’t benefit one whit from added Spirit.  There is no world in which I’d take the Flask of 2 Rejuvs over that.

Most importantly, definitely not the “new expansion, undergeared” world.  That’s when you should be most concerned about heal strength, not regen.  When everyone else is going “I’m undergeared, I really need regen,” I want you to train yourself to think, “I’m undergeared, I really need to get my heals up to a decent size.”  Because you know what will happen?  Your core spells will start to work like they’re supposed to.  They’ll keep people up more easily and you won’t have to try to spam Rejuv or Greater Heal just to keep everything from falling apart.

Conclusion

If you’re running short of mana, you can either 1) devote your resources to getting more, 2) make your key heals stronger while using the inefficient ones less.  Now, which is likely to better is a question of math.  If Spirit were far, far stronger than it is now, option 1 might be clearly superior.  But it’s not, and in any case, if you haven’t tried to do any math, you really have nothing to contribute on which option is more likely to be more useful.

I think there’s one big thing causing people to be so biased towards option 1.  Option 2 ask you to change what you’re doing.  Not only to relearn your habits slightly to cut back on inefficient spells, but also in some psychological way, if you believe me that option 2 is correct, it makes running out mana “your fault.”  It’s much, much easier to believe that you ran of mana and the group wiped because you didn’t have enough mana (if only you’d had that extra 1000 Spirit, those two Rejuvs would have saved everything, right?).  But if I’m telling you that healing can be done successfully without stacking Spirit out the wazoo, and you wiped because you ran out of mana, you have to come to grips with that toughest of all realizations: you could have played better.

So if you can’t let go of the notion that your healing problems are your gear’s fault, there’s nothing I can do for you.  You’ll stack more regen and learn to get through the content (little secret: you still probably eventually succeeded due to further practice, not due to the one extra Greater Healing Wave you got to cast).  But if you’re interested in getting better, let this post break you away from the common wisdom surrounding all of this.  It’s not the size of your mana pool that matters.  It’s how you use it.

Stop Cooking That Food

If you are looking to improve your character for Mists of Pandaria raids, going out and getting a stack of +300 food is generally not where to start. Yet in these early few weeks of the expansion, there is an irrational emphasis on cooking. Spending hours to acquire an extra +25 of a stat is the weakest way you can enhance your character–and it also takes the most amount of time. It’s the wrong set of priorities. However, players should be rewarded for choosing to farm top-end consumables, which I’ll address too.

I’m not saying you shouldn’t cook this food under any circumstance, but to put it in perspective–have you done the following?

  • Run enough random dungeons to get a significant amount of VP?
  • Run specific dungeons to get all possible ilvl 463 drops?
  • PvPed to fill in any unlucky drops/well-itemized armor?
  • Done daily quests to unlock epic rewards at Honored and make a dent towards Revered?
  • Gotten top gems, enchants, potions, flasks etc?
  • Poured gold for a Darkmoon Faire deck/BMAH epic?
  • Poured more gold into any other 476 BoE?
  • Read up on a boss fight, since you didn’t get to test them out since they were open on beta when you were at work?
  • Sit at a target dummy for an hour practicing your new rotation?

If so (and you have the time leftover), grats! Farming up those +300 foods is now your next priority. If you haven’t, doing any of these things on the list will increase your output more so than cooking. (A point could be made that Pandaren get +50 from top-level food instead of +25, but that’s still less than the overall benefit of buying a 476 BoE that would at least last until LFR.)

There’s a disproportionate spotlight on needing to max out cooking. There hasn’t been the same general outcry that people feel pressured or stressed that they need to complete epics like a Darkmoon Deck, which has a much larger impact than a stack of food. (There are exceptions–my guild has a long Darkmoon Faire forum thread.) Also, there’s been a general outcry that people “wasted several hours” farming food, but quite frankly, not everyone has that many hours of free time to waste in the first place. Either because you’re busy to the point where your overall login time is hampered (in which case, various forms of raiding may not be for you), or because you don’t have extra time left after the hours spent on more sensible raid prep. Someone prioritizing food over anything else on this list is choosing to buff their character a minimal amount requiring a large timesink. (I realize the time argument is a slippery slope, with “I don’t have time to learn dungeons, give me LFR” at the bottom of the hill, but cooking +300 stat food right now is at the other extreme.)

Cooking is a deceptively-familiar angle for raiders to harp on. We’re used to the pre-MoP model, where Raid Leaders dropped relatively-cheap feasts and you were considered very lazy for not having an extra stack of your own buff food. A lack of having every consumable was considered to demonstrate a poor attitude. Cooking takes much more time now and there are other factors besides a bad attitude that could lead to +275 food, but raiders are trained to point fingers at people in a raid group who seemingly do less, sometimes missing the larger picture of fixing positioning or a raid strat. And nobody needs to feel guilty mid-raid that they ran out of time to fish up an extra stack of food, which then in turn will probably lead to a bad mood or lack of focus. If you are lucky enough to have a lot of time/gold and raid very seriously, then sure, farm max-level food over say, archaeology. However, one should not be considered an unskilled raider because they don’t have enough hours in the day to farm up some extra +25 stat food but are otherwise prepared–especially if your guild does not have top aspirations.

This last bit has focused on perceptions within the raiding community, but we also need to address the the recipes themselves.

Cooking had a lot of changes in MoP–specializations, ingredient turnins, TIller farms for vegetables. These all appear to be beneficial changes: you don’t need to learn useless recipes, you can turn miscellaneous mats into useful ones, and you can get some of your supplies for free. However, the materials needed to complete the best recipes are both difficult to farm and do not reward an appropriately-strong stat gain.

One could argue that these high-end recipes are intended only for cooking aficionados. It’s true that there are aspects of Cooking that appeal to a narrow audience–learning additional Ways for achievements. One could also make parallels between the difficulty of Nat Pagle’s friendship grind and the time needed to acquire many +300 stat foods. However, Nat Pagle’s rewards are fishing/vanity related–where else would you use food besides competitive content? Cooking does have a system in place for people that like to farm up ingredients–the “Tradition of Cooking” series with the ApronRolling Pin, and Frying Pan, as well as the Cooking School Bell and the Flippable Table. I don’t think these foods are meant to be a similar elusive reward though. They’re things to eat in raids, not something you can periodically summon for a vanity screenshot.

A bottleneck for many players are the Ironpaw Tokens. These tokens are turned into vendors for things like Black Pepper and Rice–you can’t farm these on your own. These are only acquired from introductory Tillers quests, one daily quest, and by turning in stacks of other ingredients into grocery bundles. Players are both out there in the world farming meat and fish for dishes (a time-consuming process on its own), as well as to convert into tokens. It’s a time-consuming process and the tiny stat gain is discouraging. As players gear up more and their to-do list shortens, they’ll have more time each day to devote to cooking–which coincides with more and more raids unlocking hardmodes. However, having to maintain such a high time commitment for such a small consumable is something that hasn’t been seen for a few expansions.

There is nothing wrong about wanting to enhance your character as much as possible. Throughout WoW’s history, there have been fights where using consumables with annoying farming requirements have been justified. Greater Shadow Protection Potions for Loaetheb, Elixir of Demonslaying for Sunwell demons. This continues in MoP with Challenge Modes benefitting from odd consumables like Invisibility Potions. However, the +300 foods are both annoying to farm and have a very small reward.

Black Pepper Ribs and Shrimp (+300 Strength). 5 servings:

Eternal Blossom Fish (+275 Strength).

To have a fair comparison, 5x Eternal Blossom Fish would take 5 Jade Lungfish and 25 Striped Melon. You don’t need to farm up a token and additional meat when making +275 food.

For good measure, let’s throw in the Pandaren Banquet, which offers +275 stats to all, regardless of specialization.

Pandaren Banquet (serves 10, 5 charges):

So for twice the effort of making a +300 stat food for one person, you can make +275 stat food for 10 people (with the same number of charges).

One part of the solution is to have max-level food be both easier to farm (reduce the requirements, change the mechanisms behind acquiring Ironpaw Tokens) and to buff the stat gain. However, the other part of the solution is not to assume someone is a lazy player or waste of a raid spot because they prioritized enhancing their character in other ways besides max-level cooking. (We all know it’s much easier to change some stats around than it is to tell people not to goad each other into being hysterical, though.) Striving to perfect your toon within reason is a healthy goal players should strive for, but the current Cooking system narrows the range of players who can justify farming up stacks of +300 food without neglecting larger upgrades or blowing off real-life time commitments.

————–

Hamlet:

A few comments.  Firstly, your main thrust here is exactly right.  People are making a big deal about this food, because it’s there, when it’s really simply not something they should bother with.  Any sensible raid leader is telling their people right now that expected preparation for everyone in the group is a flask and +275 food (really, the guild should be organizing feasts anyway).  Just to attach a few numbers to what you point out–going from 1 green gem to 1 blue gem gets you +40 of your main stat.  That costs a few gold and is permanent.  Upgrading one item by one tier (13 ilvls) should get you about 100.  But anyway, you’ve made that point already.

What I really want to get into is that this reveals something interesting: people don’t really understand min/maxing.  I see a lot of people making a lot of noise about how they feel compelled to get this food–as though if they don’t, they’re failing as a player, letting down their teammates, compromising their goals.  To me, these people don’t sound like serious high-level players who are trying to min/max their characters to the highest degree.  They sound like they’re going through the motions, imitating an certain image they’ve seen of top-level players, without understanding why they do what they do.  To put it bluntly: posturing about how you’re the kind of player who needs to farm this food because you pursue every possible avenue of optimization does not impress anybody.  It makes you look clueless.

Actual serious high-level raiders understand why they’re doing what they’re doing and how much benefit it gives.  The way you would show a better understanding of the game is by showing that you can compare all the various ways to advance your character and prioritize the more useful ones.  This has come up a lot in situations other than food/consumables.  For example, it’s always been a big red flag for me when evaluating guild applicants if someone enchants DPS stats on their boots instead of run speed.  Some of them would argue vehemently about their commitment to min/maxing their character, but in fact it just revealed a lack of perspective on the big picture of what was important in the game.  This is similar.  If you claim to be someone who takes every possible DPS increase, you’re revealing that you’re not even bothering to actually optimize your play–you’re just pretending to do so.

People have long made a big deal about ensuring that their raiders are always impeccably gemmed/enchanted, brought consumables, and similar.  What I think a lot of people gloss over is that much of the value of that is signaling.  A guild applicant with perfect gemming is showing off that he knows his class very well–in fact it’s one of the best ways to show it.  Similarly a guild app who brings the raid preparations that everyone’s expected to bring is showing that he’s someone who cares enough to do so.  A person who doesn’t do all those things perfectly isn’t going to wipe you due to the miniscule loss of DPS, but they show you that they might be not be as likely to be the sort of dedicated player you want.  In this case of cooking, no properly-informed raid leader should conclude that from a player using 275 food.  Honestly, even if I were in the sort high-level guild that I used to raid in, if I saw an app using 300 food for every generic pull, I’d ask, “why?”

P.S. One topic neither of us has gotten into at all is that it still is a bad idea for this food to exist in the first place.  I don’t understand why they put it in.  I just wanted to at least note that, even though the main point of the post is that players are being irrationally affected by it.