Im making a browser based PHP game and in my database for the players it has a record of that players total EXP or experience.
What i need is a formula to translate
I take it what you're looking for is the amount of experience to decide what level they are on? Such as: Level 1: 50exp Level 2: 100exp Level 3: 150exp ?
if that's the case you could use a loop something like:
$currentExp = x;
$currentLevel;
$i; // initialLevel
for($i=1; $i < 100; $i *= 3)
{
if( ($i*50 > $currentExp) && ($i < ($i+1)*$currentExp)){
$currentLevel = $i/3;
break;
}
}
This is as simple as I can make an algorithm for levels, I haven't tested it so there could be errors.
Let me know if you do use this, cool to think an algorithm I wrote could be in a game!