[MUD-Dev] Ticks?

Sasha Hart Sasha.Hart at directory.reed.edu
Sat Jun 8 12:57:24 New Zealand Standard Time 2002

[David Anderson]

> What have other people done for regenning?  I'm just doing my best
> to have it make a bit more sense.

Old trick for dealing with the everyone-ticks-at-once problem: queue
healings for each mob to happen independently at a variable time. If
mobs A,B,C usually tick at the same time, you can get around it if
mob A goes at t + .59, mob B at t + .034, and mob C at t + .01.

Odd idea I tried a long time ago to deal with the CPU use issues
you're dealing with: each time the player's health needs to be
determined concretely, record the time. The next time it needs to be
done, take the difference between the current time and the saved
time to see how many updates "should have" been done; multiply it by
some small number and add those just before returning the new
value. This probably isn't the best idea unless you need A) really
fine granularity in health and B) no continuous updating.  also if
C) time calls don't take ages or D) there isn't such a vast amount
of fighting that C really starts to matter. I don't remember how
fast this is, I assume it's not so bad.

On the monster side, you can make similar simplifying assumptions -
for example, only update monster's HP when it gets
hit. (Conceivably, when someone monitors its status too). The same
timer trick could apply. If you want to avoid that you could always
make monsters stateless with regard to the chance they'll die - in
other words, do it probabilistically. If a monster has a raw 1/20
chance of dying it will almost always take multiple rounds to kill
him. (I'm sure someone would notice, however).
MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list