Re: [CODE][ROLEMASTER] Anyone interested in discussing how circle could be made to use RM rules?

From: Peter Ajamian (peter@pajamian.dhs.org)
Date: 11/06/00


Craig Cooney wrote:
>
> >Interesting note:  This can be calculated in such a way as to avoid
> >having to complete experience tables for all the levels...
> >
> >int get_exp(char level)
> >{
> >  if (level <= 0)
> >    return 0;
> >
> >  return (get_exp(level - 1) + ((level + 4) / 5) * 10000);
> >}
>
>   If I'm doing it correctly in my head then a
> level 2 would need 10001 exp to his next level instead of 10000?  And a lvl 27 would need 60026 exp to his next level, whereas the max should be 50000.

Hrmmm, well, I didn't account for a max of 50k per level, what it does
is simply increase it by 10k every 5 levels, but that can be done simply
by  putting the max in like this...

return (get_exp(level - 1) + MIN(((level + 4) / 5) * 10000, 50000));

The ((level + 4) / 5) * 10000 part is the full extent of the calculation
used to determine the increase in experience from the previous level.
To get the total experience required for the level that is added to the
experience required for the previous level (hence this becomes a
recursive function).  The way the formula works is this...

When you divide two integers in C the fractional part is truncated, so
if you want to do any rounding you have to add a ceartain number to
compensate for where you want the rounding to occur, this is why 4 is
added to the level, in this way levels 1 - 5 become 5 - 9,  when you
divide any of those by 5 you get 1, 1 * 10000 = 10000.

For levels 6 - 9 adding 4 to them makes them 10 - 14 which divided by 5
= 2.  2 * 10000 = 20000 which is the increase for those levels.

This formula continues to work for any level adding another 10k for each
5 levels (if you use the MIN then it will max out at 50k).

Regards, Peter


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



This archive was generated by hypermail 2b30 : 04/11/01 PDT