# [MUD-Dev] [TECH] algorithm request

Thu Dec 20 12:43:23 New Zealand Daylight Time 2001

```From: "Malcolm Tester II" <malcolm.tester at planetcad.com>

> So, you set a monster's exp.  this amount is divided by a constant
> upon death.  I.e.  1000/50 as in the old lp mud style.

> This amount is sent to an experience daemon that does things like
> wizlist, static stats information, and decides how much actual
> experience to give the player.  So, here's the twist.  I track how
> many monsters a player has killed total.  I track how many times
> they've slayed a particular monster (not 100% foolproof).  The
> grand total doesn't matter, that's just for them.  However, the
> more times they kill "Harry" for example, the less experience they
> get for it.  And that's where I am having trouble.

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

Sounds like you probably want an exponential decay function, or
similar - i.e. each time you kill a monster, the decrease in the
amount of experience earned goes *down* - e.g.:

Number of times monster killed / experience earned / reduction

1/200/-30
2/170/-20
3/150/-15
4/135/-12
5/123/-11
6/112/-10
...

An easy to implement general formula for this is:

EXP = amount of experience awarded LAST time
M = amount to decrease experience by (sort of)
NEXT = the amount of experience to award NEXT time

NEXT = EXP*(1-M)

(unless EXP is below a certain threshold, in which case just
award that much experience)

Initial value for EXP is:

(amount of experience you want to award first time monster is
killed) / (1-M)

The very best way of fiddling with this is to make a spreadsheet,
set up in the following way (assuming you have XL, I have limited

1. Make three columns (titled "Num kills", "Exp awarded", "M"

2. First row should have values: "0", [amount of exp for a

3. Second row should have values: "=[cell-above]+1",
"=[cell-above]*[cell to the right]", "=[cell above]"

4. Now copy those formulae downwards using the copy-down controls.

5. Select the first two columns, and hit the "ChartWizard" button,
and generate a "scatter graph" (or similar) that will draw a graph
of values in col1 plotted at values of col2.

6. This should produce a sloping graph from top left down to
bottom right.

7. Change the value of M in the first row only, and the steepness
of the graph will change; keep fiddling until the
experience-reduction looks good (0.75 looks like a fairly good
value to me, but it entirely depends how soon you want to
discourage people from killing the same monster again and again)
_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev

```