-1

I am making an rpg game with specific leveling system I want when a level 1 player fights a level 25 monster to level up to level 20-25 then when he goes and fight the same monster he then levels slowly like level 30 then level 32, 35, 36 on his next 4 fights respectively meaning you must always fight a monster higher than your level else you will level up really slow

At the same time I want a level 1 player to fight a 20000 enemy and then gains like 10000 levels then on his next fight he gains like 50000 then he gains another 50000 meaning that if the player fights a really strong monster he levels up fast until he reaches the level of that monster then he level up real slowly, This system doesn't have to be perfect at all but you get the idea So any help on the equations, I searched really hard and found elementary functions like

Power function:

y = a * x^b + c

Or Linear functions:

y = mx + b

Also exp. functions and log functions but I cant seem to get the desired effect or even get any close to it, Any help or any tip on where I can find my answer is highly appreciated ty

Engineer
  • 29,455
  • 4
  • 72
  • 120
La3eb
  • 1
  • 1
  • 2
    Your two equations are both linear functions – Bálint Mar 25 '17 at 14:28
  • I am sorry I had 1 txt file and it was messed up all fixed now my bad – La3eb Mar 25 '17 at 14:41
  • 1
  • Philipp I have read your post long before I placed mine I don't see any resemblance between both questions your answer is basically saying how to make an MMORPG leveling system mine is very different if you read it carefully I don't care about the time it takes to gain each level and I don't care about the level ^ c algo. ( I tried it didn't work), What I simply ask is this when my level 1 player hits a level 20,000 monster he will gain exp to make him go just above 20,000 and stop gaining any meaningful levels after that now I do understand that (level ^ c) * (level ^ c) makes sense but – La3eb Mar 25 '17 at 17:11
  • It the player exp needed per level doesn't work at all in my case I am not looking for time needed for each level the only thing that I want is when a player fights a level 20 he goes to level 20 himself and when he fights level 20,000 he goes to level 20,000 and after that its all scrap so (time = c1 ^ (1 + Level / c2)). doesn't work with me at all, Not even 1 bit, And again I already tested your answer long long ago before I asked this question, Thanks for wanting to help tho XD – La3eb Mar 25 '17 at 17:13
  • I feel that both questions are rather similar, except for this questions specific requirement of tailoring the solution to the asker's obscure (and somewhat confusing) parameters for how they want the mechanic to work. In turn, I do not think this question has much practical usefulness, except for the original asker. Any useful answer could be better directed towards the question asked be @Philipp. – Gnemlock Mar 26 '17 at 04:55
  • Gnemlock, I don't wish anyone to tailor my answer I wish to be guided to the right path and I will do the research or the extra thinking I tried Philipp answer like 3 weeks ago along with more answers from various websites, I don't see the solution in philips answer its not even that close, My question is simple make the player level up real fast till he gets to the level of the monster then level up real slowly after that, Its more like a math question, And ofc this question usefulness is to discover more ways to level up characters like in my game when people reach level 2000 then go back – La3eb Mar 26 '17 at 09:05
  • To level 1, and I don't want any straight forward solution I just want the path and as stated by Theraot by elementary functions don't work here as well as philip answer I just want to go to the right path I have been trying to solve this problem in my free time in the past 3 weeks or so, No matter what equation I use I always slip when the level 1 player hits level 20,000 monster, The leveling becomes 2 slow and he needs alot of time to go to level 20k, Anyways thanks for your comment I will keep that in mind in any of my next questions – La3eb Mar 26 '17 at 09:08

1 Answers1

0

It will be a different solution for each game, for example, some games will only give, you experience if the enemy is on a similar level. You need to start by giving a hard look to your requirements.


First, we need to start by recognize that the experience gained shall never be negative. Furthermore, I am inferring from your description that when you fight monsters of lower level than you are, it will never result in zero experience, but in increasingly diminishing values instead.

Second, I suspect you want to fix the amount of experience the playing will gain by fighting a monster of the same level.

If we are looking for a function g, that given a difference of levels x (monster_level - player_level) with the description provided, it follows that:

  • Lim(g(x))_x->-∞ = 0: When the difference tends to negative infinity, the gained exprience tends to zero
  • g(0) = k: When the difference is zero, the gained experience is a constant value k
  • dg(x)/dx > 0: The gained experience is a growing function, the greater the difference of levels the greater the gained experience

We cannot represent this with a linear function. To speak is loose terms, a stright line that doesn't cross the origin, and meets the horizontal axis at negative infinity... is an horizontal line. So its slope would be zero. However, we need a slope greater than zero.

It cannot be a quadratic function, because they are not always growing. In fact, you will have a similar problem with higher order functions.

Trigonometric functions are periodic functions, so we can discard those too...

Logarithms are growing on the positive, but decreasing and with an imaginary part on the negative. So, do not base the function on that either...

Exponential functions fit the bill. For example take g(x) = 2^x:

  • Lim(2^x)_x->-∞ = 0
  • 2^0 = 1
  • d/dx {2^x} = log(2) * 2^x > 0

It is very easy to tweak by changing the cosntant 2 to a parameter, but whatever constant we put there, we will get 1 when x = 0. We could consider to add another term, but that would change the limit when x -> -∞. Therefore, what we do is mess with the exponent, in particular:

g(x) = k^(x+1)

With this function, you get g(x) = k when x = 0. The next thing you will want is to tweak how fast it grows, you can do that by adding a factor to x:

g(x) = k^(fx+1)

If I want to make sure that g(a) = b, I do this:

g(x) = k^(fx+1)
g(a) = b
=>
b = k^(fa+1)
=>
log(b) = log(k^(fa+1)
=>
log(b) = (fa+1)*log(k)
=>
log(b)/log(k) = fa+1
=>
log(b)/log(k) - 1 = fa
=>
log(b)/log(k) - 1
------------------ = f
        a

I can rewrite the function like this:

g(x) = k^((log(b)/log(k) - 1)*x/a + 1)
=>
g(x) = k*k^((log(b)/log(k) - 1)*x/a)
=>
g(x) = k*(b/k)^(x/a)

It will have the following properties:

  • Lim(g(x))_x->-∞ = 0
  • g(0) = k
  • g(a) = b
  • dg(x)/dx > 0 Where k, a and b. In addition, remember that x is monster_level - player_level.
Theraot
  • 26,532
  • 4
  • 50
  • 78