Effects of Defense

NOTE: After I wrote this, some excellent follow-up tests[1] performed by Kalaina-Elderfall have pretty much ruled out exponential defense; I now believe that defense is flat. This invalidates most of the "Take-Home Lessons" listed in the paper below, but I'm preserving it for posterity. Hopefully I can do an updated write-up of our understanding of defense at some point.

Abstract

The defense bars shown in armor tooltips are analyzed visually, and the damage received when wearing varying amounts of armor is tested empirically. Results are consistent with either flat or exponential damage reduction, but exponential is judged more probable for a combination of reasons. The expected effects of various armor combinations are extrapolated.

If you don't care about methodology and just want the take-home lessons, you may want to jump directly to Conclusions.

Tooltip Analysis

The stat bars shown on gear in Spiral Knights are widely considered to be, at best, poorly representative. The most famous example is the attack speed bar on the Faust, which is obviously much longer than that of the Sealed Sword or Avenger, and yet the weapon has only a tiny speed advantage, if any at all. [2]

However, attack speed is perhaps not the best place to look, since it's difficult to even define when weapons have varying attack patterns. While the stat bars on weapons might well be pre-baked images, for all we can tell, the stat bars on armor and shields seem more promising; we see them incrementally extended when equipment possesses a unique variant, and a gear summary tooltip at the bottom of the character window shows some kind of combined defense total. In short, the user interface does math on the defense bars.

There's no inherent reason the game couldn't include fake "UI" numbers for all defense stats and do math on the fake numbers, but it would be simpler and more convenient to just use the real ones, so I decided to begin with the assumption that the defense bars, at least, are basically accurate. If this assumption proves false, then every piece of gear in the game would need to be individually tested to determine its defensive effects, but if it is true, then we can develop a comprehensive theory for predicting defensive value based on the displayed bars.

The gear summary tooltip shows bars that look very much like the individual helmet and armor bars when the helmet and armor bars are the same, but some sort of compromise between them when they differ. It seems logical to assume this shows a knight's "average" defense, or total defense divided by two.

By comparing the gear summary when two defensive items are equipped, we can determine their "sum". By comparing this to the gear summary when each item is equipped alone, we can determine how much of the bar is "real", and how much is just for show.

So, screenshots were taken and pixels were counted. To the right, you can see the gear summary bar for elemental defense when a Vog Cub Coat is equipped. Beneath it is the gear summary bar when a Radiant Crystal Pin is added, with the new length highlighted in green. If you compare that to the summary bar when only the pin is equipped, you can see that an equal-sized green section only extends back to the first dark "segment" line in the defense bar. I therefore conclude that this line is "zero", and everything to the left of it is simply part of the label.

I confirmed by looking at the tooltip for the Radiant Crystal Pin itself, and found that the bar to the right of the first segment line is exactly twice as long as it is in the gear summary--consistent with our intuition that the gear summary is a "half sum" bar.

Measuring Bars

This implies that the length of the gear summary bar, at least, can be predicted based on gears' individual defense bars. For the rest of this document, defenses will be measured in "pixels", meaning pixels to the right of (and including) the first vertical bar, in the item's tooltip (not the shorter gear summary), at standard game resolution (1024x768). One "segment" of the defense bar is 17 pixels, and a full bar is a nice round 150 pixels.

The defense bars of armors with various UVs were measured and compared to armor of the same type with no UVs to determine how much length the UVs added. Because the same UV produces bars of varying length depending upon the star rating of the equipment, only five-star, max-heat items were used. Based on this comparison, it appears that a "low" UV adds 12 pixels, a "medium" UV adds 23 pixels, a "high" UV adds 35 pixels, and a "maximum" UV adds 46 pixels.

Defense Tests

Conditions

I decided to test elemental defense, because my current five-star equipment allows more different defense totals for elemental than other defense types. I tested with:

(0 pixels)Vitasuit Deluxe and Virulisk Mask (UV poison medium) as controls (no elemental defense). These are 4-star and weren't at max heat, but since the point was that they didn't have any elemental defense at all, that was deemed unimportant.

Note that the Volcanic Demo Helm and a Vog Cub Coat would have equal-length defense bars in the absence of UVs.

I selected a Venom Fang Arena - Wrench Warfare at depth 19 in the Dark Tower gate for testing, to minimize the money I'd lose performing tests. I'm not completely sure whether five-star gear is fully effective at depth 19, but all the elemental gear I tested is five-star, so if it was scaled down, at least the scaling should be consistent. Tier 3 was selected to minimize the chance of scaling anomalies, maximize the size of the numbers involved (and thus minimize loss due to rounding), and because everything does at least partially normal damage on lower tiers.

I selected an Isotrode's beam attack as a damage source to compare against, because that beam attack is one of the few sources of pure elemental damage in the game (Gun Puppies, Mecha Knights, and Lumbers all do partially normal damage), and Retrodes appear fairly reliably in gremlin and construct arenas. The Isotrode also causes poison, so I would have preferred a regular Retrode, but there wasn't a convenient and reliable source of them available. I waited for poison to wear off between damage tests to be on the safe side.

All tests were performed on November 17, 2011 with no other knights in the party.

Methods

The selected level was played repeatedly using various equipment combinations.

When an Isotrode appeared during an arena fight, it was deliberately kept alive until all other monsters were slain. It was then provoked into using its beam attack, and the knight's health before and after the attack were compared. This was repeated if possible; the number of trials varied depending upon available healing and the number of times in the level that Isotrodes appeared.

Since potentially-fatal damage is known to be reduced in some cases to leave knights alive with 1 bar of health, results were only considered valid if the knight had at least 1.5 bars of health remaining after the attack.

Two different damage values were observed with each equipment set-up, always differing by one half-bar. It is assumed that the game tracks health in smaller increments than are displayed in the user interface, and the true damage dealt is strictly between the two observed values, with the apparent damage rounded up or down depending on the precise amount of health before the attack. Therefore, the true damage is known to within a half-bar interval for each test.

In one case, the knight was accidentally hit by an Isotrode beam attack before the poison from the previous attack had worn off; this resulted in a damage amount that was higher than the others observed with the same equipment set (4.5 bars vs. 3.5-4 bars, when testing Vog+Demo with no Pin). This suggests that poison may actually increase damage knights receive (contrary to prior belief), but also suggests that it only amplifies damage of subsequent attacks, not the attack that initially inflicts poison, and so the rest of the test results should be unaffected. The damage sustained while poisoned was ignored in analyzing the results of the tests.

Data

Gear

Defense

Damage

(Control)

0 px

6.5 - 7

Radiant Crystal Pin

28 px

6 - 6.5

Vog Cub Coat

110 px

5 - 5.5

Volcanic Demo Helm (UV med)

133 px

5 - 5.5

Vog Cub + Pin

138 px

5 - 5.5

Demo Helm + Pin

161 px

4.5 - 5

Demo Helm + Vog Cub

243 px

3.5 - 4

Demo Helm + Vog Cub + Pin

271 px

3.5 - 4

As you can see, not all equipment combinations produced a measurable change in damage taken, but at least five distinct damage values can be seen. Additionally, all tested modifiers do seem to be contributing; while the medium UV on the Volcanic Demo Helm seems to give no advantage over the Vog Cub Coat when they are tested individually, a difference is observed when both are combined with the Radiant Crystal Pin.

No difference was observed between the medium UV and the Radiant Crystal Pin, but it is assumed that this difference (5 pixels) was simply too small to measure under these conditions.

Analysis

Three different models of damage reduction were considered:

Flat Reduction, in which defense is subtracted from the damage received

Health Multiplication, in which damage received is divided by defense, multiplying the user's effective health

Exponential Reduction, in which damage received falls off exponentially as defense increases

Flat Reduction

Under the flat reduction model, the amount of damage blocked during each attack is proportional to defense, regardless of the amount of damage received at one time. For example, if you have 3 "points" of defense, then an attack that normally does 10 damage will inflict 7, while an attack that normally inflicts 100 damage will still inflict 97.

The mathematics of this model are very easy to compute, but it doesn't scale well; if you have enough defense to put a dent in large attacks, you will be completely immune to small attacks. As such, it is common in board games, where the math must be as easy as possible for the players, but not very common in computer games, where math is cheap.

My experimental results are CONSISTENT with a flat reduction model where the true damage of the Isotrode's beam attack is 6.75 bars and each segment of the defense bar reduces damage by 0.2 bars.

Health Multiplication

Under the health multiplication model, defense is like a percentage bonus to your health. If it takes X defense to reduce all damage to 1/2 of normal, then 2X defense will reduce damage to 1/3, 3X defense will reduce damage to 1/4, 4X defense will reduce damage to 1/5, etc.

This enforces a rule of diminishing returns on defense, which often makes it easier to balance games with a high degree of stat customization. For example, this is how defense works in League of Legends.

My experimental results are NOT CONSISTENT with a health multiplication model with any coefficients I can find. I can get the numbers pretty close, so it's conceivable that this model is basically correct but there's some additional layer of complication fudging the numbers; however, unless further evidence comes to light in support of this model, I'm ruling it out.

Exponential Reduction

Under the exponential reduction model, getting +X points of defense will always take off the same percentage of incoming damage, no matter how much or how little defense you previously had. If you have no other defense and an item reduces your damage taken from 100 to 90, then when you have defense out the wazoo and are only taking 10 damage, that same item will reduce it to 9.

This means the damage curve looks the same no matter where you sit; items can be balanced largely independently of each other, and small bonuses remain relevant at all levels. This is useful when you want to offer the same relative trade-offs at a wide range of power levels. For example, this is how defense works in Guild Wars.

My experimental results are CONSISTENT with an exponential reduction model where the true damage of the Isotrode's beam attack is 6.9 bars and a full defense bar in your gear summary (the equivalent of 300 pixels) offers 50% protection.

Conclusions

Predictions

The following table shows the predicted defense offered by various equipment according to the exponential reduction model (Exp) and flat reduction model (Flat). The graph at the right shows the predicted defense values at various points on the gear summary bar, assuming exponential reduction.

Note: Ancient Plate displays a full defense bar in the item tooltip, but a equipping a single piece makes the gear summary bar more than half full, so it really gives more than that; the above measurements were taken by equipping an Ancient Plate Helm and a Drake Scale Mail (no normal defense) and extrapolating. It is untested whether defense continues to be effective beyond the maximum shown in the gear summary bar (e.g. in full Ancient Plate).

Damage Model

While both the flat and exponential reduction models are consistent with my data, I think the exponential reduction is more likely for a number of reasons.

First, it means that the largest displayable defense value is a very obvious and round number (50%), which seems unlikely to be a coincidence.

Secondly, Tantarian's resistance tests[3] appear to be much closer to an exponential damage reduction than a flat one (though the numbers don't quite seem to work either way), and it would seem bizarre to use a more complex reduction algorithm for status resistance than the more central and important game mechanic of basic damage.

But mostly, exponential reduction just makes much more sense for Spiral Knights from a design perspective. It's a computer game with a wide variety of power levels, sophisticated down-scaling of over-geared players, and a user interface that says they don't want the game to be about number-crunching (yes, irony, I know). Exponential just seems like a much better choice.

Take-Home Lessons

Defense likely gives exponential damage reduction

A full defense bar in the gear summary pane equals 50% defense

A maximum defensive UV is worth four lows and is predicted to reduce damage by roughly 10%

A 5* trinket reduces damage around 6.3%

When facing split damage types, it is better to have some defense against each than full defense against only one

Therefore, since almost everything does split normal (even on tier 3), you want at least some normal defense in almost all levels

Suggestions for Further Research

Anyone who is interested is encouraged to conduct their own tests and compare results. Science should be repeatable! Here are some suggestions for possible improvements:

Dueling Models

It should be possible to distinguish between the flat and exponential models by testing something with very large numbers; perhaps Ancient Plate versus a Trojan attack. Additional precision would also help (see below). However, keep in mind that if the game uses the flat model, there is almost certainly a defense cap somewhere (they're not going to let us take negative damage, for example).

Precision

Health is only displayed to within half a bar, but the little colored damage boxes that appear when you take damage each represent a quarter bar (we think). By taking a high-framerate video of damage tests and counting boxes, the amount of damage taken could probably be determined more exactly.

Tests with more powerful attackers at lower depths might also improve precision. This is potentially more expensive, both in terms of time and energy, though the new elevator passes could help mitigate that cost.

Scaling

It is currently unknown what protection five-star gear gives in lower tiers, or what protection lower-star gear gives anywhere.

I would conjecture that the bars show how much defense you have on tier 3, and armor scales such that three-star items give about the same protection on tier 2 that their five-star upgrades give on tier 3. But that's just a wild guess! We'll never know unless someone tests it.

Poison

It would be nice to repeat these tests against regular Retrodes, to eliminate status effects as a possible variable.