30 April, 2010

Calculus & FFXI II -- Haste vs Enmity

I was browing around the forums, when I came across this Allakhazam post, where the OP poses the following question:
For a long time now, I have been using a full enmity set for casting Flash to maximize as much hate as I can get out of flash. However, I am curious, over the course of an extended fighting session, say HNM/God/Ground king/Omega etc, would it be mathematically better to use Haste when Flashing?
Judging from the responses, the general consensus is to emphasize Haste over Emnity. This would probably be true based on observation.

We would like to give mathematical support to verify this claim.

But before we start, we need to establish how Enmity works, and how +Enmity and +Haste affect your overall enmity gain.

Once again, if the equations don't display properly, your browser is probably blocking the HTML or Java script that takes the code and turns it into equations.

Enmity 101
In late 2007, Kaeko (of Odin) began a series of tests to break down and analyze exactly how Enmity (also commonly referred to as just "hate") works. I won't go over the whole series, but to briefly summarize the basics,

Enmity has two components:-
  • Cumulative Enmity (CE)-- Enmity that does not decay over time, but instead decays when you take damage.
  • Volatile Enmity (VE)-- Enmity that naturally decays over time, and is not reduced through taking damage.
The sum of a person's CE and VE is that person's Total Enmity (TE), and the one with the highest TE value "has hate" (i.e. the mob goes after that person).

Both CE and VE share the same base unit of measurement (E), defined as "the enmity generated by casting Cure 1 for 0HP," and each is capped at 10,000E. Therefore, there is an overall "hate cap" at 20,000E.

The goal would be to reach this hate cap as fast as possible, and once you have reached the cap, maintain it.

Constructing the model
For any particular action, be it Flash, Provoke, Dispel, or what-have-you, the Total Enmity, $E$ that you gain as a result of performing that action can be thought of as a function of one variable, that variable being the total +Enmity from your gear and merits ($e$) that modifies the base enmity gain ($e_0$). Notice that I said a function of one variable, even though $e$ and $e_0$ both appear in the equation, but because I am talking about a specific action here, $e_0$ is really a constant.

+Enmity is a straight percentage increase over the base enmity gain, so

\[E(e)=e_0(1+\frac{e}{100})=\frac{e_0 (100+e)}{100}\]
(As documented by Kaeko, here.)

Similarly, your recast, $R$, can be thought of as a function of haste ($h$) that acts upon the base recast time, $r_0$:

\[R(h)=r_0(1-\frac{h}{100})=\frac{r_0 (100-h)}{100}\]
(As documented by Kirschy, here.)

Now that we've got some quantities, it's important to be clear what exactly we want to model. Since one of a tank's main goals is to maximize the amount of Enmity they have, you could just model the current amount of Enmity a tank currently has as a function of time, and maximize that. However, there are several complications in doing so, including taking enmity decay into account, not to mention that such a function is not even continuous.

We can accomodate for all that with the appropriate substitutions, but the question is whether all that is actually relevant to our problem.

Sure, we'd like to maximize the amount of Enmity that we have, but we don't consider Enmity's rate of decay when choosing what gear to wear. Instead, we load up on +Enmity and +Haste gear, and aim to generate as much enmity as we can, with as low a recast as possible.

That is to say, the quantity that we really want to maximize is not the actual amount of enmity we have, but rather the enmity generated per unit time, or the rate at which we generate enmity.

This is thankfully much simpler to model, and is the classic "rise over run" function:

\[f(e,h)=\frac{E(e)}{R(h)}=\frac{e_0 (100+e)}{r_0 (100-h)}\]
Now that we have the quantity we want to maximize, it's time to use calculus.

In order to answer the OP's question, we want to see how the rate at which we generate enmity, $f(e,h)$ changes as we change either $e$ or $h$. We can then analyze the resulting quantities to hopefully establish a relationship between the two.

So, in order to approximate how the rate changes as I change one of the input variables, I first compute the partial derivaties:

First, the partial with respect to $e$:
\[\frac{\partial f}{\partial e}=\frac{e_0}{r_0 (100-h)}\]
Then the partial with respect to $h$ (this one uses the product rule):
\[\frac{\partial f}{\partial h}=\frac{e_0 (100+e)}{r_0 (100-h)^2}\]
Notice then, that
\[\frac{\partial f}{\partial h}=\frac{100+e}{100-h}\frac{e_0}{r_0 (100-h)}\]
\[\frac{\partial f}{\partial h}=\frac{100+e}{100-h}\frac{\partial f}{\partial e}\]

Recall that the two partial derivatives approximate the incremental gain in the rate of enmity generation as we increase either +Enmity or +Haste.

Thus, if $(100+e)/(100-h)>1$, that means that $\partial f/\partial h > \partial f/\partial e$, so +Haste has more impact than +Enmity on the rate of enmity generation.

Conversely, if $(100+e)/(100-h)<1$, then $\partial f/\partial h < \partial f/\partial e$, so +Enmity will have more impact than +Haste on the rate of enmity generation.

Clearly, that fraction acts as a boundary of sorts that separates the two cases, and in order to get an idea of what this boundary looks like, we set the two partial derivatives to be equal. So,

This is thankfully simple, although you might expect such a simple relationship, since both +Enmity and +Haste act on the base enmity and recast time in a similar way. In any case, the relationship can be illustrated using a graph as follows:

Thus, we get the following conclusion:

If the sum of your +Enmity and +Haste is greater than 0, you will gain more by increasing +Haste over +Enmity.
Otherwise, if the sum of your +Enmity and +Haste is less than 0, you will gain more by increasing +Enmity over +Haste.

Since the vast majority of Paladins out there (hopefully) have a positive sum of +Enmity and +haste, this analysis shows that you will benefit from increasing +Haste over +Enmity the vast majority of the time.
 (Q.E.D. ^^)

Further questions and limitations
While the simple analysis above illustrates that +Haste should generally be prioritized over +Enmity, it only tells us that the gains from +Haste is more than +Enmity. What it doesn't tell us is how much better +Haste is over +Enmity, under given conditions.

So while we can say +Haste is generally better than +Enmity, the only way we have right now to compare two pieces of gear against each other would be to plug the values into $f(e,h)$ and see what numbers come out.

Since the function is simple enough to compute numerically, I won't go down that line for now, and is not a typically asked question, anyway. But if you wanted to, you can simply repeat the analysis I did on INT vs MAB to better understand the relationsihp between +Enmity and +Haste.

More importantly, understand that this model only captures a small part of tanking mechanics-- the first part where the goal is to generate as much Enmity as you can, as quick as you can. This would be fine if there weren't a cap to the amount of CE and VE a player can have, but there is, and this analysis does not directly apply to the latter part of tanking, which focuses on maintaining the hate cap after it has been established.

Fortunately, that analysis is also simple, since any extra Enmity over the cap is effectively wasted, your focus now shifts to just trying to use your actions with as high a frequency as possible, so stack +Haste all the way.

More importantly, this analysis does not actually tell you how to tank. For example, a new RDM tank may misinterpret this analysis and believe that all they need to do is stack up on +Enmity and +Haste and spam Blind until the cows come home, not realising that Blind does not have a CE component-- thus once that RDM's VE is capped, all Blind does is re-establish the VE cap, but does nothing for CE!

In other words, the mathematics and formula in this case are used to manipulate known data to illustrate and verify a claim that we've already known. It will not make you a better player, not will it make you a better tank.

All it is is solid verification, a proof per se, and to some the proof is really what it's all about.

1 comment:

Strawberrie said...

Ok that hurt my brain to read. But on September 30th, you're gonna have to figure out a whole new formula for the Haste!!

... and we better be on the same server!