Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

One of the struggles I've always had in game development is deciding how to implement experience points attributed to gaining a level. There doesn't seem to be a pattern to gaining a level in many of the games I've played, so I assume they have a static dictionary table which contains experience points vs. the level. e.g.

Experience   Level
0            1
100          2
175          3
280          4
800          5

...There isn't a rhyme or reason why 280 points is equal to level 4, it just is.

I'm not sure how those levels are decided, but it certainly wouldn't be dynamic. I've also thought about the possibility of exponential levels, as not to have to keep a separate lookup table, e.g.

Experience   Level
0            1
100          2
200          3
400          4
800          5
1600         6
3200         7
6400         8

...but that seems like it would grow out of control rather quickly, as towards the upper levels, the enemies in the game would have to provide a whopping amount of experience to level -- and that would be to difficult to control. Leveling would become an impossible task.

Does anyone have any pointers, or methods they use to decide how to level a character based on experience? I want to be fair in leveling and I want to stay ahead of the players as not to worry about constantly adding new experience/level lookups.

share|improve this question
    
@Stephen Thanks, updated. –  George Jun 14 '11 at 17:30
4  
No, it's just a slower exponential (multiplying by 10 every ~3.3 levels, or 100 every ~6.6 levels, instead of every level). Geometric would be like 1[00], 4, 9, 25, 36, etc. Even 1100 1210 1331 1464 is an exponential series, multiplying by 1.1. –  Random832 Jun 14 '11 at 17:31
1  
en.wikipedia.org/wiki/Exponential_growth Should clear things up. –  eBusiness Jun 14 '11 at 20:03
1  
@Stephen: @Random832 is correct, both "exponential" and "geometric" growth refer to having a constant ratio between successive/equidistant terms (which means the rate of growth is proportional to the current value - in calculus this is stated by saying an exponential function has f'(x) = c*f(x)). The term "geometric" is used when the domain (input) is discrete (eg. integer). The formula for @George's example, above level 1, is Experience = 100 * 2^(Level-2), which is exponential. The formula for your progression, above level 1, is Experience = 100^(Level-1), also exponential. –  BlueRaja - Danny Pflughoeft Jun 14 '11 at 20:58
    
@BlueRaja Comment retracted, thanks. –  Stephen Jun 15 '11 at 12:58

6 Answers 6

up vote 21 down vote accepted

It's quite common to use a square relation.

level = constant * sqrt(XP)

Or the approximate equivalent of a linearly rising level gap.

Level   XP      Difference
1       0       -
2       100     100
3       300     200
4       600     300
5       1000    400

These systems work pretty well when the XP gain is approximately linear. If a high level character can earn XP faster than a low level character then this is not the right system.

share|improve this answer
2  
For Achiever-type players, I suspect there is a strong expectation of greater XP gain as their character progresses. I find your solution interesting, and I'd probably tweak it only slightly to produce differences like 107-214-321-428, thus preventing the player from seeing only round numbers and also in the hopes that this could add to making the game feel just a little bit more "organic" (I'm trying to come up with a better word than this, but "organic" is all I've got at the moment). –  Randolf Richardson Jun 15 '11 at 6:05
1  
+1 this is exactly what I've done in the past, works great –  BlueRaja - Danny Pflughoeft Jun 15 '11 at 16:08
1  
Equations for the linearly rising level gap. level = (sqrt(100(2experience+25))+50)/100 and experience =(level^2+level)/2*100-(level*100) –  Calum Jan 27 at 18:56
    
Great answer and I like the curve this produces. I ended up using a constant of 0.04. For those wondering, the reverse of this formula to calculate for XP is: XP = level^2 / constant. –  BradH Jun 24 at 22:00

You'll probably find logarithmic functions helpful as they can be used to slow down the increase as more experience points are gained. Here are two web pages that explain how these work:

  Graphs of Logarithmic Functions
  http://www.analyzemath.com/Graphing/GraphLogarithmicFunction.html

  Introduction to Graphing Logarithmic Functions
  http://www.purplemath.com/modules/graphlog.htm

Here's what it looks like on a graph, which will hopefully meet your needs:

enter image description here

share|improve this answer
1  
@George By playing around with the co-efficients you can easily use a logarithmic function to scale your player's levelling. +1 for using math –  Stephen Jun 14 '11 at 17:27
2  
Note that this is an implementation of exponential XP requirement. level = log(XP) <=> XP = e^level. The requirement may turn out a bit steep for the last levels, but it will work ok with a suitable growth in XP accumulation. –  eBusiness Jun 14 '11 at 19:57
    
@eBusiness: Good point, but this may not be a problem since higher level characters tend to earn more points more easily and in a shorter duration of time (e.g., by attacking/killing more powerful monsters with a faster hit speed). This is one reason why I think this math could be well-suited to video games (especially in an MMORPG context). –  Randolf Richardson Jun 14 '11 at 23:21
1  
I just find it a bit odd that OP specifically worry about exponential growth and then accept an answer that just describe the same thing in another way. But I guess that is his problem. –  eBusiness Jun 15 '11 at 10:20
1  
@eBusiness: Perhaps my answer clarified something about exponential growth that wasn't previously clear? There are many different ways to apply mathematics, and I'm not sure that even the best math teacher could know them all (well, maybe the second-best math teacher anyway). –  Randolf Richardson Jun 15 '11 at 16:22

I think it depends how how easy the player can get the experience. If the player can get 200 xp at lvl 1 in 20 minutes and then get 200 xp at lvl 2 in 2 minutes, then you need to scale your xp exponentially.

However if gaining a level only makes it marginally easier to gain xp, then you should do a more level xp function. (Maybe linear with some coefficient > 1)

share|improve this answer

these are some ways i've used so far they are sorted by grow rate (just multiplied every equation by a constant value):

  1. exp = level (this one may seem odd but for some games that reward exp changes according to player level like borderlands this one may fit to)

  2. exp = level + log(level)

    1   0
    2   0.6
    3   1.4
    4   2.4
    5   3.5
    6   4.6
    
  3. exp = level^const_value : for my example i set const value to 3/2

    1   1
    2   2.8
    3   5.1
    4   8
    5   11.2
    6   27
    
share|improve this answer

Often the points needed to gain a level is based on a curve. In a lot of RPGs were there are also a lot of other characteristics and attributes of your character that increase with your level, they will also be on there own curves.

Take a look at RPGMaker to see how they do things. Specifically look at the parameter curves in the screenshots of the "Add Some Uniqueness to by Customizing Starting Equipment" section of the Creating a Main Character document.

Basically you might have a curve for how much XP is needed to levelup, then different curves for how much HP, MP, stamina, strength etc is gained each level.

enter image description here

share|improve this answer

Or maybe just use flat leveling system ?

Each level would require exactly the same amount of XP.

share|improve this answer
1  
Answers should be a bit more fleshed out than just a simple suggestion. Try relating some of the benefits of this strategy over having a dynamic system like the one asked for. –  Byte56 Oct 31 '13 at 19:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.