I'm making a online RPG game where I use this math formula (found online) to calc exp -> level.
$level = (25 + sqrt(625 + 100 * $exp)) / 50;
I have tried for days to make a script to reverse it. My goal is to make a function to calc the amount of exp required for a level.
Turns out it's possible to simplify even further to:
$exp = 25*($level*$level - $level);
Derivation:
l=(25 + sqrt(625 + 100e))/50
50l=25 + sqrt(625 + 100e)
50l-25=sqrt(625 + 100e)
(50l-25)^2=625 + 100e
(25*(2l-1))^2=625 + 100e
625*((2l-1))^2=625 + 100e
625*((2l-1))^2 - 625= 100e
625*((2l-1)^2 - 1) = 100e
625*((2l-1)^2 - 1)/100 = e
125*((2l-1)^2 - 1)/20 = e
25*((2l-1)^2 - 1)/4 = e
25*(4l^2-4l + 1- 1)/4 = e
25*(4l^2-4l)/4 = e
25*(l^2-l) = e
By rearrangement and a bit of factorisation,
$exp = 25 * $level * ($level - 1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With