Re: [CODE][ALGEBRA] Formula for players experience

From: Invincibill (bill@LONGBOYZ.EROLS.COM)
Date: 03/09/98


why dont you write a little recursive function which passes level in as
an argument and that has tot_num_xp as a static lont int which uses the
first formula you have down there to calculate the number of xp you want.
( 51.22675737(level^2) + 845.3197279(level) + (-895.5464853) = experience)

this is quick and dirty and not sure if its what you are looking for

long int get_total_xp(int level) {

   long int total_xp_reqd=0;

   figure_out_xp_level(level);

   return(total_xp_reqd);
}

void figure_out_xp_level(int level) {
//the total_xp_reqd is still in scope.  the best way to do it would be to
//pass total_xp_reqd in as a variable also, but this is quick and dirty.
// :)

   if (level > 0) {
      total_xp_reqd +=
       ((51.22675737 * level * level) + (845.3197279*level) - (895.5464853));
      figure_out_xp_level(--level);
   }
   else
      total_xp_reqd += 1; //this will take care of that first 0th level
                          //which is different
}

this produced
The total amount of xp req from level 1 to level 100 is 21511832
if it was 500k for each level we'd be looking at 50 million total so this
is in the ball park.

also it could very easily be modified to take TWO args (high level and low
level) to figure out the number of xp required to get from low level to
high level.

hope this helps.


bill


Son of Ra, Brother of Poseidon

On Mon, 9 Mar 1998, Tony Robbins wrote:

> If you're not VERY good at math, don't bother reading
>
> Ok, using the basis that I want it to take 500000 exp to go from 99 to
> 100 and I want it to take 999 experience to go from level 1 to 2, I came
> out with this equation:
>
> 51.22675737(level^2) + 845.3197279(level) + (-895.5464853) = experience
> from level-l to level
> (it looks rough, but it's very very close)


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST