ID:161077
 
I need a formula for leveling up so that you don't gain as much each level up. It seems that every one I have tried it ends up with you gaining more each level up.

Things to make a formula with:
mob/var
powerlevel
maxpowerlevel
health
maxhealth
strength
maxstrength
defense
maxdefense
speed
maxspeed



//PL Gains
var/top = round(powerlevel*maxpowerlevel)/20
var/bottom = round(powerlevel*maxpowerlevel)/30
src.maxpowerlevel += rand(bottom,top)


I've tried things like this, but you gain more each level up...
Obviously, if you use something that increases with each level in your equation, it's gonna make more each level.
In response to Darkmag1c1an11
I've figured it out! :P

On the /20 and /30 I just start them off with a low number, then have those numbers get higher slowly. :P
I think you need to ask yourself what kind of formula you want. There are multiple kinds of formulas but the ones you'll run across most are exponential, linear, power, or logarithmic. There are also some formulas that are asymptotic, meaning they follow some kind of curve but as they progress they become more linear.

In a typical RPG, the user's level for a certain amount of experience is logarithmic, but most stat gains associated with the level boost are linear compared to the level.

Assuming you're worried about stats per level, typically the best formula is linear, low-power or logarithmic. A linear formula involves adding the same amount (or close to it) to the stat each time, like maxHP+=8, or if you calculate it fresh for each level it'd be something like maxHP=8*(level-1)+baseHP.

A logarithmic formula would be something like log(level)/log(2), where every time your level doubles (hence the log(2)) you gain +1 to the stat.

A power formula is of the form stat=base*(level-1)**power. If power>1 then this is a steep curve that gets steeper as you go along, and power=1 is linear, so for stats your best bet is a power less than 1. 0.5 is a square root, so stat=round(sqrt(level),1) is one example of this kind of curve. This is a little more forgiving than a logarithmic curve in terms of how quickly it ups your stats. You can of course also use a power like 0.6 or 0.8 if you want something a little less than linear that still gives you good gains in the beginning.

An asymptotic curve approaches a line, so usually the way to handle this is to setup that line and then use a remainder to describe the rest of the formula. For example, say you want the stat boost to start out quickly but then level off to something just about linear? Let's say that stat=level*3+10 is the ideal choice, but you want stat=0 at level 1, then a gradual ramping up after that. The remainder should be of the form k/level or something like that. In this case that gives you stat=level*3+10-13/level, which is 9.5 (you can round either way) at level 2. This seems a bit steep, so maybe k/(level+1) or k/(level+2) is the way to go because that makes the remainder curve a little shallower to start out. In k/(level+1), k=26, which means at level 2 you'd have a stat of about 7.33, which is still a decent gain. For k/(level+2), k=39, and then at level 2 you'd have stat=6.25. Remember that as you level later on, your stat increase is about +3 each time, so +6 to start is pretty good. The final formula would be, then: stat=round(level*3+10-39/(level+2),1)

Lummox JR