Sub topic 7
Combining Several Stats into One Power Score
This chapter assumes you have read the earlier chapters on common currency, stat valuation, and the linear cost baseline. You should know that each stat has a price in a shared currency. You should also be able to read short Python functions. Here you learn how to turn a unit with many stats into one number that a cost curve can price.
Why one number
A cost curve takes a single input: power. A unit has several stats, such as attack, health, and speed. Before you can price the unit, you must collapse those stats into one power score.
The choice of collapsing rule is a design decision. It decides which unit shapes the game rewards. A rule that favors stat totals will favor extreme units. A rule that favors stat products will favor balanced ones. You should pick the rule on purpose.
The additive model
The simplest rule is the weighted sum. Each stat has a value in the common currency, and power is the total.
STAT_VALUE = {"attack": 2.0, "health": 0.5, "speed": 3.0}
def raw_power(stats):
unknown = set(stats) - set(STAT_VALUE)
if unknown:
raise KeyError(f"No value for stats: {sorted(unknown)}")
return sum(STAT_VALUE[name] * amount for name, amount in stats.items())
print(raw_power({"attack": 4, "health": 10, "speed": 1})) # 8 + 5 + 3 = 16.0The function rejects stats that have no value. A silent default of zero would make a new stat free, and nobody would notice until a unit with that stat was too cheap.
The additive model has three properties you can rely on:
- Each stat contributes independently, so you can price a stat change without looking at the rest of the unit.
- Trades are linear. Giving up 4 health to gain 1 attack is always an even trade, since 4 × 0.5 = 1 × 2.0.
- It is easy to explain to designers and to debug.
Seeing where the power comes from
When a unit looks wrong, ask which stat is carrying its score. A breakdown function answers that.
def breakdown(stats):
total = raw_power(stats)
return {name: round(STAT_VALUE[name] * amount / total, 2)
for name, amount in stats.items()}
print(breakdown({"attack": 4, "health": 10, "speed": 1}))
# {'attack': 0.5, 'health': 0.31, 'speed': 0.19}Half of this unit's power comes from attack. If you intended an archer to be a speed unit, this output shows you that the numbers disagree with the design.
Where the additive model breaks
The additive model assumes that a stat is worth the same no matter what the other stats are. In many games that is false.
Consider attack and health in a duel. A unit's useful output is roughly how much damage it deals before it dies. That depends on attack multiplied by health, not attack plus health. Doubling attack on a unit with 1 health does little, because the unit dies at once. Doubling attack on a unit with 100 health does much more.
The multiplicative alternative
For stats that multiply in play, use a product. The raw product grows with the square of any uniform scaling, so take a square root to keep power on a scale comparable to the additive one. This is a geometric mean.
import math
def additive(stats):
return stats["attack"] * 2.0 + stats["health"] * 0.5
def geometric(stats):
return math.sqrt(stats["attack"] * stats["health"])
units = {
"Tank": {"attack": 2, "health": 30},
"Glass": {"attack": 10, "health": 4},
"Balanced": {"attack": 5, "health": 14},
}
for name, stats in units.items():
print(name, round(additive(stats), 1), round(geometric(stats), 1))
# Tank 19.0 7.7
# Glass 22.0 6.3
# Balanced 17.0 8.4The two models rank the units in opposite orders. The additive model calls the Glass unit the strongest and the Balanced unit the weakest. The geometric model ranks Balanced first and Glass last. Neither is wrong in the abstract. Which one is right depends on how the game plays.
| Property | Additive | Geometric (product) |
|---|---|---|
| Interaction between stats | None | Strong |
| Rewards | Extreme specialization | Balanced stats |
| Easy to price a single stat change | Yes | No, depends on the other stats |
| Fits stats that | Work independently | Multiply in combat |
| Typical failure | Glass cannons and walls are overpriced or underpriced | Balanced units dominate every build |
Choosing a model
Use these questions to decide.
- Do the stats multiply in the game's core loop? Damage and survivability usually do. Movement speed and carrying capacity often do not.
- Can a unit with a near-zero stat still be useful? If a unit with 1 health is useless however high its attack, the product is a better fit. If it can still contribute, the sum is a better fit.
- Do you need designers to edit stats by hand? Additive power is easier to reason about on a spreadsheet.
Many games use a hybrid. They group stats that multiply (attack and health) into one geometric term, then add independent stats (speed, range, carry weight) on top. Keep the groups small, and document each one.
Common errors
Double counting derived stats
Suppose a unit has attack 4 and an attack interval that gives speed 2 attacks per second. Its damage per second (DPS) is 8. If your stat table includes attack, speed, and DPS, you count the same capability three times.
Choose one set of stats and keep it. Either price the base stats (attack, speed) with a model that captures their interaction, or price the derived stat (DPS) and treat the base stats as ways to reach it. Do not do both.
Mixing scales
Health in the hundreds and attack in the single digits are fine if your weights account for them. They are not fine if you have normalized one stat and not the other. A simple check: for each stat, compute the value of a typical change, such as one step in your usual content. If one stat's typical step is worth ten times another's, something is off.
Hiding a nonlinear stat in a linear weight
Some stats have diminishing returns. A cooldown reduction from 10 seconds to 5 seconds is a bigger gain than from 5 to 0.5 in real terms, because the gains per second shrink as the cooldown shrinks. If you weight "cooldown seconds" linearly, you misprice both ends. Convert such a stat into a rate (uses per minute) before weighting it.
Weights that were never tested against play
A weight such as "speed is worth 3.0" is a claim about the game. If it came from a guess, the whole score inherits that guess. The later chapters on fitting and playtesting cover how to check the weights. For now, record the source of each weight (guess, derived, or fitted) so you know which ones to doubt.
Feeding the score into a cost curve
Once you have a power score, pass it to a cost function from the previous chapters.
def cost_from_power(power, scale=1.0, exponent=1.3):
return scale * power ** exponent
archer = {"attack": 4, "health": 10, "speed": 1}
print(round(cost_from_power(raw_power(archer)), 1)) # 16 ** 1.3, about 36.8The combining rule and the curve work together. An additive score with a superlinear curve makes extreme units expensive twice over: once because their total is high, and again because the curve charges more for high totals. A geometric score has already compressed extreme units, so a gentler exponent may be enough. When you change one, re-check the other.
A short checklist
Before you trust a power score, check the following.
- Every stat in the content has a weight, and missing stats raise an error.
- No capability is counted twice through a derived stat.
- You have decided, and written down, which stats multiply and which add.
- You can print a breakdown for any unit and explain it in one sentence.
- Weights have a recorded source, such as guess, derived, or fitted.
Exercise
Using the additive weights attack 2.0, health 0.5, and speed 3.0, compute the power of a unit with attack 6, health 8, and speed 2. Then compute the geometric power sqrt(attack * health) of the same unit using only attack and health. Which stat contributes the largest share in the additive model?
Show answer
Additive power is 6 2.0 + 8 0.5 + 2 3.0 = 12 + 4 + 6 = 22.0. Geometric power is sqrt(6 8) = sqrt(48), about 6.9. In the additive model, attack contributes the largest share: 12 / 22, about 0.55.
Exercise
A designer adds a "damage per second" stat to your stat table and keeps attack and speed as well. All three get additive weights. Explain what goes wrong, and give two ways to fix it.
Show answer
Damage per second is attack multiplied by attack rate, so it restates what attack and speed already say. The additive score counts that capability three times and overprices fast, hard-hitting units relative to units that gain strength in other ways. Fix 1: remove DPS and price the base stats, using a model that captures how they interact. Fix 2: keep DPS as the priced stat and drop the base stats from the sum, or give them weights of zero. Either way, each capability is counted once.