I'm having trouble working out a formula using this experience curve to get the total exp after each level. I bet it's easy and I'm just overthinking it.

maxlvl = 10;
increment = 28;
baseexp = 100;
function calc(){
    for (i = 0;i<(maxlvl*increment);i+=increment){
        expperlvl = baseexp + i;
  • 1
    \$\begingroup\$ If you solved your problem, add an answer and accept it, don't edit your question. \$\endgroup\$ – MichaelHouse Jun 10 '12 at 16:57

If you're just trying to calculate the experience at maxlvl (10), and you want it so that each level requires increment (28) more experience than the last, you can just use this formula (without the loop):

var expperlvl = baseexp + ((maxlvl - 1) * increment);
//Note: I subtract 1 from max level so that level 1 = baseexp.

However, this is linear and not a "curve" so you'll have to be more specific about what you are trying to do.

  • \$\begingroup\$ @Drackir -- I figured out the formula. I edited my post with the solution. Sorry i wasnt more clear, but I was trying to calculate the total exp at maxlvl. Is there any simplification able to be done? \$\endgroup\$ – StealingMana Jun 10 '12 at 14:46

I figured it out. I decided to attempt to work out the formula on paper first and success.

function total(){

(made alteration to the formula, now its correct)

  • 3
    \$\begingroup\$ A better answer would include an explanation of what was wrong and how you fixed it, not just code. Thank you for posting this as an answer instead of editing your question though. Improving this answer may just net you some reputation and you can level up to more privileges. \$\endgroup\$ – MichaelHouse Jun 11 '12 at 5:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.