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

From: Judson Powers (powers@RJSONLINE.NET)
Date: 03/22/98


On Sun, Mar 8, 1998 11:23 PM, Tony Robbins <mailto:tonyr@NWPACLINK.COM>
wrote:
> The problem here is that the exp_needed function doesn't work that
> way--it just wants the experience total needed for that level.  So I
> used my equation above to get the experience needed
> level 0 to level 1 takes 1 exp
> level 1 to level 2 takes 1000 exp
> level 2 to level 3 takes 2101 exp
>
> Ok, so I figure that if you add the experience for the one you're at
> plus all those below it, you'll get the total experience needed for that
> level...
>
> level 1 takes 1 exp
> level 2 takes 1001 exp
> level 3 takes 3102 exp
>
> calling level x and experience y, when x is 1, y is 1.  When x is 2, y
> is 1001.  With these three points, I can get the equation for the curve,
> which, in theory, should come out with the difference between level 100
> and 99 as 500000 or so.  (Actually, the top equation is closer to
> 600,000, but that's fine)
>
> So I did the equation twice, and I came out with this:
>
> 550.5(level^2) + (-651.5)(level) + 102 = experience needed

The problem here is that you can't realistically sample a curve off the
three lowest points...  Not enough data and variance and such.  Anyways,
making another equation is possible, but not necessary.  The really really
fast way to do it (which is always best for a mud) is to make a 100-element
array that contains the total amount of xp needed to level.  Change the
xp-finding function into a simple lookup function xp_needed(x) = table[x],
and add a startup function that initializes the table.

table[0] = equation(0);               // here equation() is the original
eq.
for (n = 1; n < 100; n++) {
  table[n] = equation(n) + table[n - 1];
};

Judson Powers                 Morgaelin MUD
powers@rjsonline.net          telnet://mud.dwango.com:3000/

"Friends help you move... real friends help you move bodies."


     +------------------------------------------------------------+
     | 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