Re: EXP. Formula

From: Blaize (garath@fl.freei.net)
Date: 08/17/00


LordKaT wrote:
>Ive come to the realization that 2000 lines for exp. tables for each of our
>15 classes (plus modifiers for our 10 races) is just plain silly.
>
>So I thoguht (in all my geniousity) that I could write a simple little
>equasion to calculate how much exp. the character needs to get to the next
>level.
>
>I was wrong, I have no good formula, right now its "level * 10"
>
>Anyone have any suggestions?


This is actually the first thing I modified source code wise, back when I
knew
very little about coding.
At first I used 2^(GET_LEVEL(ch)-1) * 2000
resulting in
1:2000
2:4000
3:8000
4:16000
5:32000
...
30:214748364800 Incedently this is the maximum auction bid on a MUD called
Phidar (phidar.com 9000)

Realizing that 214 billion was a bit high, I made this code...
You can modify any of the numbers in the case statement to your own needs,
and expand them.
If you do not have races in your MUD, delete ", race" from the function's
arguments, and delete the
switch(race) statement.

so here it is (mailer code, might not work with your MUD  etc.):

int level_exp(int chclass, int level, int race)
{
  int modifier, exp;
  if (level > LVL_IMPL || level < 0) {
    log("SYSERR: Requesting exp for invalid level %d!", level);
    return 0;
  }
  if(level < 2)
 return level;

  if (level > LVL_IMMORT)
    return EXP_MAX - ((LVL_IMPL - level) * 1000);

  /* Exp required for normal mortals is below */

  switch (chclass) {
    case CLASS_MAGIC_USER:
   modifier = 2000;
   break;
    case CLASS_CLERIC:
      modifier = 1500;
   break;
    case CLASS_THIEF:
      modifier = 1000;
   break;
    case CLASS_WARRIOR:
      modifier = 1500;
   break;
 default:
   log("SYSERR: Requesting exp for invalid class at level_exp().");
   return 0;
  }

  switch(race){
    case RACE_HUMAN:
   modifier *= 0.95;
   break;
 case RACE_ELF:
   modifier *= 1.5;
   break;
 case RACE_DWARF:
   modifier *= 1.2;
   break;
 case RACE_HOBBIT:
   break;
 default:
   log("SYSERR: Requesting exp for invalid class at level_exp().");
   return 0;
  }

  modifier *= 1.5 ^ (level - 2); // not sure about portablility...so just
substitute ^ with whatever func does x to the y
  modifier += 1000 * level
  return modifier;
}

If you use this, just put Blaize in your credits, no need to putfor what,
just please put it.

If you would like the other code i did in class.c for saves, titles, and
thac0s...send me a message.

Thank you,

--Blaize


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