Home Game Development mathematics – How to compute XP thresholds when scaling changes for each level range?

mathematics – How to compute XP thresholds when scaling changes for each level range?

0
mathematics – How to compute XP thresholds when scaling changes for each level range?

[ad_1]

I am developing mobile game and I am stuck on an issue regarding proper player stats scaling based on level.

As a parameters for the computation we have:

  • base XP value
  • multiple increment values (for example one increment for levels 1-5, another one for 6-10 and so on…)

We are using this formula:
current level XP = previous Level XP + (previous level XP ^ increment).

Let’s break it down on an example:
We want to get the XP threshold to graduate from level 3. The base XP value is 100, increment for levels 1-5 is 0.5.

To get the needed XP, we first need to get the value for level 2:

level2Value = 100 + 100^0.5

Now we have stat value for level 2 and we are able to get level3Value like this:

level3Value = level2Value + level2Value^0.5.

If we had to calculate values for some high levels, this seems like a rather inefficient way to do things, as values for all previous levels must be computed prior, and in addition we are changing the increment value based on level – we cannot simple have one line of formula which gets us the number that we wan; all is dependent on previous values.

Of course we can compute all previous values, cache it on the server and then do the lookup to the data, but we would like to avoid it if possible – still I have a feeling that there must be better way to deal with this problem.

My question is the following:

Can you suggest some other (similar) formulas or ways to compute this? Ideally just one line of code should do the trick (something like `level X XP = X * baseXp * increment|, but more complex which allows usage of different increment values)

[ad_2]

Previous article Warhammer 40,000: Rogue Trader Review (PS5)
Next article Avatar: Frontiers Of Pandora’s First Hours: Pretty, But Empty
Hello there! My name is YoleeTeam, and I am thrilled to welcome you to AmazonianGames.com. As the premier destination for all things related to Amazon Games' universe, we are dedicated to providing you with the most exciting and immersive gaming experiences out there. From captivating visuals to exhilarating gameplay, our website is packed with comprehensive insights, updates, and reviews to keep you ahead of the game. Whether you're a seasoned gamer or new to the scene, I am here to guide you through this virtual frontier. If you have any questions or suggestions, feel free to reach out to me at john@yoleesolutions.com. Embark on your Amazon gaming journey today with AmazonianGames.com and let the adventure begin!