How do we measure how a variable contributes to an output as its value increases, and how it relates to other input variables?

Let's say we're playing a video game, where you can buy items to augment your damage output.

If the character's damage/per second is calculated as:

$DPS = (50 + a) * (2*Min(1.0, c)) * Min(2.5, 1 + s)$


$a = 135, #bonus attack dmg c = 0.5, #critical hit chance bonus (percent) s = 0.2, #attack speed (per second) bonus$

and where 1 attack bonus costs 35 gold, and 1% critical hit chance costs 50 gold. (we can ignore attack speed to simplify the discussion).

Initially, it makes sense to spend your gold on attack damage, since it increases additively. To double your initial DPS of 50/s you could spend 1750 gold on attack damage, or 5000 gold on critical chance. But if you have reached 250 attack damage, it would cost 8750 gold to reach 500 DPS if you were to continue buying attack damage, or 5000 gold if you were to invest in critical hit chance. So, the utility of attack damage, in relation to other stats, decreases as more of it is accumulated.

How can we quantify the utility of $a, c, s$ over time, and as each changes, since they are dependant on each other? Is the partial derivative of each variable (gradient vector) good enough?

Here we have a contour plot of DPS based on gold spent. The green line is the path taken by a optimization function as it tries to find the locally optimal point at 10,000 gold spent, resulting in {ad -> 6600, crit -> 3400}.

dps contour

And a stream plot of the DPS function's gradient:

dps gradient stream

Finding the path of steepest ascent in the gradient (http://www.leadinglesson.com/problem-on-finding-the-path-of-steepest-ascent) we get:

$goldCrit = -5000 + Sqrt[(1800 + goldAD)^2]$ shown as the dashed red line below,

should give us the optimal amount of gold spent on crit, in relation to how much we've spent on attack.

dps contour ascent dps stream ascent

Visually the line seems to make sense.

Now, using this relationship we can graph the amount spent per stat, relative to the total amount of gold available.

gold spent

  • Dashed red line: crit.
  • Thick black line: attack.
  • Thin dotted line: max spendable gold.

Taking the derivative of each seems to gives us a working concept of the stat's level of utility:

enter image description here

Accordingly, all gold should be invested in Attack until 3200 is spent. After, gold should be evenly divided until critical hit chance maxes out at 100%. This seems to correspond with our earlier intuition.

Now the question is how can this be generalized to higher dimensions?

  • $\begingroup$ The issue with these sorts of things, in general, is how-long-term your view is. Ignoring your particular function for a second, it's usually the case that you can purchase an immediate benefit of low efficiency now, or save up for a more efficient benefit later. How do you want to judge things like this? $\endgroup$ – Mark S. Jan 8 '14 at 0:57
  • $\begingroup$ It falls on the user to describe what kind of power distribution makes sense strategically. If the user is playing against someone who is naturally stronger early game he would want to optimize for hit and run style tactics and disengage from any all-in confrontations. $\endgroup$ – Neal Alexander Jan 8 '14 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.