[crossfire] Items that evolve all the time
Mark Wedel
mwedel at sonic.net
Wed Apr 27 00:19:08 CDT 2005
A few notes:
Storing tick counts is not reliable. If the server resets, tick count
restarts at zero I believe, so that value won't do any good.
The last_ values, are I believe, used only when the object is in memory. This
is used to refine things like regeneration times (eg, you don't want a character
to get a hp back every tick they go, so last_heal is decremented each time the
player gets an action, and if zero, player gets a hp, and last_heal is set to
the regen rate).
Similar oddness is used for monster regeneration. However, monsters don't get
HP back when the map is swapped out. This has long been a known fact, and often
used by experienced player (if the time it takes you to heal is greater than map
swapout time, then it doesn't matter how long it takes you to heal).
The only way I can see for the object to survive map resets is to either store
it on the overlay map, like weather, or make it unique, so it gets stored on the
unique object maps.
So the next step is know how long since last activated - the best way is to
store the results of time() into the object. If the object is in memory, let
the normal speed processing do its logic. Add some flag so that when it is
saved, the time() value is automatically stored into some field. Then at load
time, you can at least know how long the object has been inactive. Probably
need to add something in ready_map_map() that processes these object
(fix_auto_apply is only called when a map is reset, not when swapped back in.)
In terms of processing, it'd make the processing more smart. Eg, if hte
object has been out of memory for 5000 seconds, instead of calling process
object that many times for that object, make it more clever - figure out what it
would have done in that time (eg, produced 30 apples, died off, whatever). That
will make processing then not very costly at load time.
If that isn't possible (because object may go through bunches of states), then
doing it more like weather code probably makes sense.
More information about the crossfire
mailing list