# How to implement an experience system?

I'm currently writing a small game that is based on earning experience when killing enemies. As usual, each level requires more experience gain than the level before, and on higher levels, killing enemies awards more experience.

But I have a problem balancing this system. Are there any prebuilt algorithms that help to calculate how the experience curve required for each level should look like? And how much experience an average enemy on a specific level should provide?

You would want some kind of exponential curve, probably something like:

base_xp * (level_to_get ^ factor)


base_xp is a constant that decides how much xp you need to go up a level.
level_to_get is the level you are aiming for; at level 1, this will be level 2.
factor is another constant that decides how much of an increase of xp you need for each level.

Having a base_xp of 200 and a factor of, say, 2 gives something like this:

Whereas a base_xp of 50 and a factor of 2.6 gives:

The second has a much lower starting xp rate, but you need more xp very quickly.

As for monster xp, this is something you want to test. Try out various values. You want something that is not too high (you'll quickly become overpowered) yet not too low (players don't want to grind). Think about how many 'standard' enemies you would want the player to kill for level 10->11, for example.

• You might want a sharper curve than the ones here. RuneScape, for example, has a very steep curve, almost resembling a logarithmic curve (flipped/rotated of course); see it here. At least in my personal experience, it seems to work VERY well to give you lots of quick rewards in the beginning, and by the time you get to higher levels you are adjusted to longer playtimes until the last few levels take FOREVER but the player somehow tolerates it. 99s are fairly frequent, despite the STEEP!! curve to get there. – Ricket Feb 24 '11 at 14:58
• I would certainly say the curves here would be shallow. – The Communist Duck Feb 24 '11 at 15:43
• please no exp. curve =,( - leveling takes soooo long with it and even longer the closer you're to your goal, plssss no =.( – Dave O. Feb 25 '11 at 0:03
• A linear line wouldn't work. If you need 1000xp more per level, then as you get stronger you'll find it takes less and less time to level. – The Communist Duck Feb 25 '11 at 10:36
• The function shown ( base_xp * (level_to_get ^ factor) ) is actually a quadratic function since level_to_get is the x value and not the factor, and if I'm not mistaken, base_xp should be added and not multiplied, in order to translate the function up? Sorry if this is just me being picky about semantics, I just want to make sure of this because charting that function definitely doesn't give you any old exponential. – chockie Sep 28 '15 at 10:39

There is no right answer for the question of how much experience an enemy should give, or how steep the experience curve should be. It may help to think about the playing time required to level up for each level and then base the experience required per level, and average experience rewarded per enemy on this.