[MUD-Dev] [TECH] algorithm request
bobbymartin at hotmail.com
Thu Dec 20 16:43:28 New Zealand Daylight Time 2001
> From: Malcolm Tester II <malcolm.tester at planetcad.com>
> I could use a little help with some math, if someone would be so
> inclined. I need a good way to shell out experience for combat,
> and I'm having a little difficulty coming up with a good way.
Any time you want to have some maximum value, some minimum value,
and a range in between, frequently what you want is an exponential.
Here's my suggestion:
xp = (max xp - min xp) * pow(N, number_of_times_previously_killed)
+ min xp
pow(N, number_of_times_previously_killed) means take N to the
power of number_of_times_previously_killed (multiply N by itself
that many times, also refered to as exponentiation).
N should be some number between 1 and 0, usually close to 1. I
recommend .85 as a starting value.
What this function will do (assuming I haven't made some screwup) is
give the guy 15% less experience than the difference between the
amount he got last time and the minimum. So, if the max xp is 200
and the min is 100 (chosen to be easy values to work with), the
first time, he'll get 200 xp. The second time, he'll get (200 -
100)*.85 + 100 = 185 xp. The next time, he'll get (185 - 100)*.85 +
100 =~ 172 xp. It will gradually reduce almost to 100. (Actually,
due to rounding, it will eventually reduce to 100).
Is this what you're looking for?
Cosm Development Team
secure email: bobbymartin at hushmail.com
MUD-Dev mailing list
MUD-Dev at kanga.nu
More information about the MUD-Dev