# Negative exponential curve formula for stat leveling

This topic is 2237 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi all, I'm making a game where the character levels up and stats need to be increased. Now its a bit dull if every level got +1 for each stat so what I want is an exponential curve. The thing is I keep finding millions of things about making it start slow and get faster but can find sod all on the opposite, as in many rpg's you gain pace quite quickly and then at higher levels ease off. Now I'm not really an expert on this side of maths and have heard many terms such as negative exponential curve, logarithm etc.

What I want is to take a min and max value and curve between them over 100 levels. Say at level 1 I want attack to be 1 and at level 100 I want it to be 1000, but at level 50 I don't want it to be 500, rather more like 600. I'm sure you understand.

I've been trying formulas in wolfram alpha but not really getting anywhere. Could some one help me out.

Any help much appreciated.

##### Share on other sites
If you want to make formula out of values you could look into http://mathworld.wol...Polynomial.html

Here's example how to use it in Wolfram Alpha (based on what you want)
http://www.wolframal...600},{100,1000}

Edit: it seems Wolfram Alpha didn't plot function correctly. At x = 1 it looks like 300 or so, but if you find value manually for x=1 then it equals 100. Edited by Ripiz

##### Share on other sites
By negative exponential, do you mean you want a logarithmic curve?

http://www.wolframal...or x = 1 to 100

That doesn't quite fit the curve you wanted; 50 is at 800 not 600, but you can close with a squared logarithm:

http://www.wolframal...or x = 1 to 100

If you raise the log to power 3 instead of just squaring it you get very close to what you wanted:

http://www.wolframalpha.com/input/?i=plot++125*%28log10%28+x+%29%29+%5E+3+%2B1++for+x+%3D+1+to+100

level (x) =1 gives attack 1
level 50 = 614
level 100 = 1001

And if you let the game continue going past level 100, it will progressively get harder and harder to gain more attack power:

http://www.wolframal...r x = 1 to 1000

If you look at that last plot, to get 3 times the attack power of level 100, you need to be level 1000. So the longer everyone plays, the more 'fair' gameplay becomes, but amongst the most experienced players it is still an advantage to keep leveling.

edit: these wolfram links! Edited by DracoLacertae

##### Share on other sites
Logarithmic growth is good if you support unlimited growth, exponential growth is appropriate if you want to approach an absolute limit.
For example, if the stat S starts at S0 at level 0 and grows without exceeding Smax, the value at level L can be S(L) = Smax - (Smax-S0)*2^(-kL).
You can choose k by choosing the level Lh at which you have grown halfway, S(Lh) = (Smax-S0)/2 when 2^(-kLh)=0.5, i.e. k=1/Lh.

##### Share on other sites
Wow such a lot of info to take in at once and I hardly understand any of it. Away from the computer at the moment but will look into it as soon as I can. Also I believe your right about logaritic curves not being for me as I checked them out and I did notice it can't be influenced between a maximum and minimum.

##### Share on other sites
something exponential like

current_attack = MAX_ATTACK - (MAX_ATTACK - 1)*exp( lambda*level )

does kind of fit your requirements, but the MAX_ATTACK is only reached in the limit of level going to infinity (lambda would be a constant parameter).

if you have a fixed starting and end point you can actually fit in any monotonically increasing concave function to achieve what you want (e.g. the logarithm as someone mentioned). I guess a negative quadratic function would also be very convenient.

attack(level) = -alpha*(MAX_LEVEL - level)^2 + MAX_ATTACK

and choose a positive alpha such that attack(1) = 1

##### Share on other sites
Hi all, sorry I've been away so long. I just discovered something called Ken Perlin's bias that seems to suit my needs well and is adjustable on the growth.
I am having a problem trying to fit in the base stat though so if I could get some help that would be great.
This is what I have so far : stat(level) = (level/maxLeve)l^(log(curveAmount)/log(0.5)) * MaxStat
In the following example the stat is 0 at level 0 and 500 at level 100.
http://www.wolframal...)/log(0.5))*500

Now as I said I'm not sure where to be fitting the base stat into this equation to ensure it starts at say 50 but ends at 500.

Any help much appreciated.

Edit : actually could this be it?
stat(level) = ((level/maxLeve)l^(log(curveAmount)/log(0.5)) * (MaxStat - baseStat)) + baseStat Edited by EvilWeebl

##### Share on other sites

This is what I have so far : stat(level) = (level/maxLeve)l^(log(curveAmount)/log(0.5)) * MaxStat
In the following example the stat is 0 at level 0 and 500 at level 100.
http://www.wolframal...)/log(0.5))*500

Now as I said I'm not sure where to be fitting the base stat into this equation to ensure it starts at say 50 but ends at 500.

Unfortunately, if you use this formula there is no maximum level: beyond level 100 the curve grows beyond 500, as should be obvious by the fact that it grows proportionally to level raised to some constant positive power.
In the linked graph, the exponent is also greater than 1 (growth accelerates at higher levels, which is even more contrary to your requirements) but it need not be.

##### Share on other sites
But level 100 would be the maximum level, so whether it would continue to rise or not is not important as the character is capped at level 100. I realise that in my example to exponent is greater than 1, but changing the curve amount given a different exponent. a curve amount between 0 and 0.5 gives a positive curve and between 0.5 and 1 gives a negative curve. If anything this is a great help for defining growth rates of different characters.

Am I right?

Of all the googling I've done on rpg stat leveling formulae why haven't I come across anything like this? Makes me think I'm missing something.

1. 1
2. 2
Rutin
21
3. 3
4. 4
frob
17
5. 5

• 9
• 12
• 9
• 33
• 13
• ### Forum Statistics

• Total Topics
632593
• Total Posts
3007269

×