 # My take on the Progression SO

While the array lookup method of assigning stats is a decent method of managing stats, to me it has two drawbacks… 1) It’s rather tedious to have to do each of these entries for every character, and 2) Generally speaking, your progression is going to follow some sort of predictable pattern anyways.

My take was a little different. I still wanted something easily customized by a later designer (likely to be me) but I didn’t want to spend a lot of time calculating all those levels… so I created another class…

`````` [System.Serializable]
class ProgressionStatFormula
{
[Range(1,1000)]
[SerializeField] float startingValue=100;
[Range(0,1)]
[Range(0,1000)]

public float Calculate(int level)
{
if (level <= 1) return startingValue;
float c = Calculate(level - 1);
}
}
``````

The idea here is that you’ll start with the level one value. Then you calculate a new value for each level you wish to access. There are two modification paths which can be used separately or together (I considered making one modifier with a toggle for formula). At level 1, the formula will aways return the starting value. At subsequent levels, it will perform a recursive calculation to arrive at the new value by getting the value of the previous level, adding that value to itself times the multipler and adding the absolute addition. This leaves you tweaking only a very few parameters to get a virtually unlimited progression of stat values. If you want things to ramp up exponentially by level, you can use the multiplier (You’d be surprised how quickly a character can go from 100 to 1,000,000 using a percentageAdded value of 1!), if you want a slow consistent progression use the absolute added.

It wouldn’t be that hard to modify this into a hybrid system where you could type in an array of values but let the system fall back to the formula if the array is incomplete or missing.

9 Likes

I haven’t encountered recursion in any of the courses I’ve taken so far.

If you don’t mind elaborating what happens when Calculate() calls float c = Calculate(level - 1); ?

Wow, this is an oldie of mine from before I got hired on.

It might be best to point you to what I consider to be a pretty good explanation on recursion.

1 Like

That helped a lot thank you! Also thank you for always being so speedy and answering my questions. This course has been the first time I’m taking advantage of the discussions with my own questions and it’s helping a lot!

Thanks for this statformula class idea, this is much easier than manually entering. Will there be any pitfalls with this to look out for in future parts of the course if we got with your implementation?

Also, am I right in thinking that if we want to implement a curved power progression that tops off for a player (logarithmically such that a level 60 is much stronger than a level 20, but level 99 is not much stronger than a level 90) that we could modify the percentage added formula to use ln? Mainly trying to test my understanding that this would be the location to change.

Thanks for your help with Q&A.