Sub topic 1
What a cost curve is for
Prerequisites
This chapter assumes you know basic game design terms: stats, resources, abilities, and tiers. You should be comfortable with multiplication and reading a simple graph. The code uses Python 3, so you should be able to read a short function.
What a cost curve is for
A cost curve is a function that maps the power of a game object to its cost. Power is a number you compute from what the object does. Cost is what a player pays in a resource such as gold, mana, or build points. The curve tells you what a unit with a given power should cost. If an archer and a knight have similar power but very different costs, the curve shows the mismatch.
The balance goal is simple: objects with similar power should cost similar amounts, and every option should be worth picking in some situation.
Putting everything in one currency
Game objects combine unlike things. A unit might have attack, health, and speed. An item might add mana regeneration. To compare them, convert every effect into one shared unit of value. Call that unit a power point. Once each stat has a value in power points, you can add them together.
How much is one point of attack worth?
Pick a value for each stat, then check those values against content you already trust. This table assigns a power value to each stat:
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())
print(raw_power({"attack": 4, "health": 10, "speed": 1}))The output is 16.0: 8 from attack, 5 from health, and 3 from speed.
The linear baseline
The simplest cost curve is linear: cost equals a scale factor times power. Doubling power doubles cost. Use a linear curve as your baseline, and bend it only when the data shows a reason to.
def linear_cost(power, scale=1.0):
return scale * power
for power in (10, 20, 40):
print(power, linear_cost(power))The output is 10 10.0, 20 20.0, and 40 40.0.
Exercise
A unit has 5 attack and 4 health. Using the STAT_VALUE table above, what is its raw power?
Show answer
5 times 2.0 is 10.0, and 4 times 0.5 is 2.0. The raw power is 12.0.