Sign in to follow this  

Negative exponential curve formula for stat leveling

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
If you want to make formula out of values you could look into [url="http://mathworld.wolfram.com/LagrangeInterpolatingPolynomial.html"]http://mathworld.wol...Polynomial.html[/url]

Here's example how to use it in Wolfram Alpha (based on what you want)
[url="http://www.wolframalpha.com/input/?i=interpolating+polynomial+{1%2C100}%2C{50%2C600}%2C{100%2C1000}"]http://www.wolframal...600},{100,1000}[/url]

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 this post


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

[url="http://www.wolframalpha.com/input/?i=plot++500+*+log10%28+x+%29+for+x+%3D+1+to+100"]http://www.wolframal...or x = 1 to 100[/url]

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

[url="http://www.wolframalpha.com/input/?i=plot++250*%28log10%28+x+%29%29+%5E+2+for+x+%3D+1+to+100"]http://www.wolframal...or x = 1 to 100[/url]

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:

[url="http://www.wolframalpha.com/input/?i=plot+++%28125*%28log10%28+x+%29%29+%5E+3%29+%2B1+for+x+%3D+1+to+1000"]http://www.wolframal...r x = 1 to 1000[/url]

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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.
[url="http://www.wolframalpha.com/input/?i=plot+x%3D+0+to+x%3D100+%28x%2F100%29%5E%28log%280.2%29%2Flog%280.5%29%29*500"]http://www.wolframal...)/log(0.5))*500[/url]

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 this post


Link to post
Share on other sites
[quote name='EvilWeebl' timestamp='1344185800' post='4966397']
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.
[/quote]
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this