Sub topic 2
Beyond Linear: Superlinear and Diminishing Returns
This chapter assumes you can run short Python scripts, read a simple power formula, and convert stats such as attack and health into one score. A cost curve maps a power score to a cost. Each section below adds one piece to that mapping.
Superlinear and diminishing returns
A linear curve charges the same cost for each point of power. A superlinear curve (exponent above 1.0) makes strong content cost more per point. A diminishing-returns curve (exponent below 1.0) makes each extra point cheaper at the top end. Choose superlinear curves to keep top-tier power rare, and diminishing-returns curves when extra investment should still pay off.
def cost_from_power(power, scale=1.0, exponent=1.3):
return scale * power ** exponentCombining stats and checking for outliers
Convert each stat to a common value, add the results into a power score, and compare each unit's power-to-cost ratio with the average. Units far from the average are outliers.
STAT_VALUE = {"attack": 2.0, "health": 0.5, "speed": 3.0}
def raw_power(stats):
return sum(STAT_VALUE[name] * amount for name, amount in stats.items())
def flag_outliers(units, tolerance=0.15):
ratios = {name: power / cost for name, (power, cost) in units.items()}
mean = sum(ratios.values()) / len(ratios)
relative = {name: ratio / mean for name, ratio in ratios.items()}
return {name: round(r, 2) for name, r in relative.items() if abs(r - 1) > tolerance}
units = {
"Archer": (raw_power({"attack": 8, "health": 6, "speed": 1}), 15),
"Knight": (raw_power({"attack": 5, "health": 20, "speed": 0}), 20),
"Mage": (raw_power({"attack": 10, "health": 4, "speed": 2}), 30),
}
print(flag_outliers(units)) # {'Archer': 1.29, 'Mage': 0.82}Pricing abilities with expected value
An ability is worth its effect multiplied by how often it triggers and how long it stays active. Subtract the value of any drawback.
def ability_power(effect_value, chance=1.0, uptime=1.0, drawback=0.0):
return effect_value * chance * uptime - drawback
print(ability_power(10, chance=0.5, drawback=1)) # 4.0Watch for abilities whose value depends on context. A cost curve prices averages, so it cannot capture a counter that only works against one enemy type.
Exercise
An ability has an effect of 12, a 0.25 chance to trigger, 0.8 uptime, and a drawback of 0.5. What is its expected power?
Show answer
12 × 0.25 × 0.8 = 2.4, then 2.4 − 0.5 = 1.9.