Sunday, October 25, 2015

mathematics - RPG Logarithmic leveling formula?


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 :)



Answer



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?


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...