# Growth Rate Table
If there is one task that you will ABSOLUTELY spend your day thinking about, it is growth rate.
Growth Rate: How quickly a certain value grows in your system. A common example would be the function that controls how much XP the player needs every level.
Whether you need to figure out the amount of XP required to level up, or how much money the player should get for completing a quest, or the number of enemies to spawn in an encounter, it will most likely involve some increase in a number over time.
This is such a common task, that I have a short little cheat sheet that I use to bootstrap my systems. It is very simple, and it look like this:
There are four components of this bootstrapping system:
- Four types of basic Expressions
- All built on the same four Terms
- All in a table that allows for easy comparison
- With some simple helper output and cleaning up.
# Common Terms
There are four terms that are shared between all four expressions. Three of them are input by the user (C, Base, and Index), the other is not. The fourth term, N, is a derived value.
- C, the Constant that is added to the expression.
- Base, most often this acts as the Coefficient of the expression. I call it the Base as it is usually the number you want to "start" with, and then things go up from there.
- Index, this is usually the exponent of the function.
- N, this is the "level" or the "rank" of the growth formula.
# The Expressions
I support four basic expressions, which in my experience covers basically every use case I ever have when it comes to growth formulas.
Linear = C + Base * Index * N
Polynomial = C + Base * N ^ Index
Exponential = C + Index * Base ^ N
Explosive = C + Base ^ (Index * N)
# A Live Example
Let's see this in a live example. Try playing around with the different values, and study the difference between the four types of expressions. They each grow at a different rate, and they each accomplish very different types of problems that you might need to solve.
Type | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
---|---|---|---|---|---|---|---|---|---|---|
Linear | 15 | 30 | 45 | 60 | 75 | 90 | 105 | 120 | 135 | 150 |
Polynomial | 10 | 28 | 52 | 80 | 112 | 147 | 185 | 226 | 270 | 316 |
Exponential | 15 | 150 | 1500 | 15000 | 1.5e+5 | 1.5e+6 | 1.5e+7 | 1.5e+8 | 1.5e+9 | 1.5e+10 |
Explosive | 10 | 316 | 10000 | 3.2e+5 | 1.0e+7 | 3.2e+8 | 1.0e+10 | 3.2e+11 | 1.0e+13 | 3.2e+14 |