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.

I'm working on a RPG game, however, I am not the amazing person at math that I wish I was, although someone suggested a logarithmic equation would work well. My current idea is for this:

You start off getting levels relatively quickly (lower xp amounts), then once you get higher up like 20-30 maybe it starts to take longer and longer to level, ending somewhere around 10-15 million experience for level 100. Can anyone offer me an equation or suggestions on how to do this? Thanks :)

share|improve this question
3  
    
That will not work well for me, mostly because A. This is java, B. I'm trying to make it so it works with only the xp, and you don't need to save the levels. –  VoidWhisperer May 7 '13 at 19:55
2  
Java or C the math is the same. And you don't need to save the levels, that example just had the levels to show, it was still a formula to generate it. –  Rangoric May 7 '13 at 20:03
3  
A.) The link Roberts provided is not exactly language specific, don't ignore it the second you see a little bit of c++. B.) There were no levels being saved, that was just the output to help you visualize what was happening. (Read the Accepted Answer) –  Fizzik May 7 '13 at 20:04
1  
The answer should give you the basic formula you need. If you want to compute your current level based off the amount of xp you have then you would simply run the algorithm while keeping a sum of (new_xp - old_xp) until the next levels xp requirement is greater than the xp that you have. Translating the function should be pretty easy and take only a few minutes (I'd do it for you but this question is going to be closed as a duplicate soon enough). That being said you should consider keeping track of levels and xp for the next level to simplify your math. –  Benjamin Danger Johnson May 7 '13 at 20:54
add comment

1 Answer 1

If you want a logarithmic levelling formula that would simply be:

Level = Math.max( Math.floor( constA * Math.log( XP + constC ) + constB ), 1 )

For ~10 million XP at level 100 you should choose something like constA = 8.7, constB = -40 and constC = 111.

If the level gap rises too fast for your taste increase constA, decrease constB if you want the inital level gap to be higher, and finally set constC ~= exp((1-constB)/constA), in order to properly start at level 1.

Note that the appropriateness of any levelling formula depend completely on how fast players can gain XP at any given level.

See also: Algorithm for dynamically calculating a level based on experience points?

share|improve this answer
add comment

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.