[MUD-Dev] [TECH] algorithm request

Lars Duening lars at bearnip.com
Thu Dec 20 07:28:37 New Zealand Daylight Time 2001


Malcolm Tester II wrote on Wednesday, December 19 2001, 16:58:28:

> Let's say there is a monster named Bob.  Bob has 10,000
> experience.  Player kills him.  The experience daemon receives a
> notice that Player killed Bob for 200 exp.  The experience daemon
> notes that Player has killed Bob 0 times before.  So the
> experience daemon gives 200 exp to Player.  Bob resets, Player
> kills him again.  200 exp is sent to the experience daemon again.
> Now, the exp daemon notes that Player has killed Bob 1 time
> before.  So the exp daemon gives the player some exp amount less
> than 200.  And so forth.  I've tried creating some algorithms
> myself, but they frankly stink.  My talents do not lie in math.
> So if anyone could offer help, it would be appreciated.  I also
> want to set a "minimum" level of experience too.  So the player
> never gets to 0, they always get at least a little.

A very simple formula would be

  max-exp / number-of-kills + 1

where number-of-kills includes the current monster. This will give
you a linear drop in the amount of exp given, proportional to the
number of kills, but always a minimum of 1 point. If you want a
faster drop, you can multiply the number-of-kills by something:

  max-exp / (3 * number-of-kills) + 1

If you don't like the linear drop, you can play with polynomials:

  max-exp / sqrt(number-of-kills) + 1

would implement a sharp drop in exp for the first kills, which later
tapers out. If you use higher order roots, the drop is less
sharp. Using log() instead of sqrt() would give you a similar
effect.

The best way of find a good formular would probably be to use
GNUplot to draw the behaviour of a given formula, and then play with
it.

Btw, to implement a generic exponentation 'a to the power of b' in
LDMud you can use exp(b * log(a)), ...I should really implement a
power-of efun...

> For other curious people out there, I intend to accomplish this
> with MySQL.  I think the mappings structure within the lib would
> be too overloaded for this type of functionality.

:-)

--
Lars Duening; lars at bearnip.com
PGP Key: http://www.bearnip.com/lars/pgp-lars.asc

_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev



More information about the MUD-Dev mailing list