jeudi 4 juin 2020

I need an algorithm that gives me the Level from EXP in C++

Visual explaining the experience points required to level up

As I mentioned in the picture, each level wants 2 times more experience points than the previous level. It is OK.

But I want an algorithm that gives me the level from EXP.

For example: When I give 1670 as an integer parameter to function, it must give me 6 as output.

I need this function in C ++ by the way.

I would be glad if you help.

These level values ​​have no limit. It is only shown as an example, the purpose of doing this function is that I want to make an infinite level system that getting harder without needing for a database or static data.

Aucun commentaire:

Enregistrer un commentaire