Re: Item Decay

From: Deidril (
Date: 03/20/02

There is alway an use for timer on item or everything. The smart idea is to
use ONE timer
per items, mobs, etc for all events and create a ladder of events.

For example, let's say we have two events, EVENT_DECAY and

EVENT_DECAY < EVENT_STOP_WORKING so as long as long as there is a such
STOP_WORKING timer on the item, i won't
start a timer of decaying because it means something is going to happens.
Whatever it is
a long time or not, we choose to not interfere with such event, except if
the new event has a better priority.
( For example, we would erase a DECAY timer with a STOP_WORKING timer )

Basically, the data you need to add to your item is :

struct timer_data {

   short int timecount ;
   char timer_type ;
   char index_callback_function_to_be_used ;

} ;

You decrease your timer every obj_activity call or every ticks. These time
are long enough to
cover a LONG time with a short int ( 10 s x 32K = roughly 90 hours ) and is
enough to cover this kind of dynamic

Using a ladder of situation isn't something new in circle. Think about
remind you something ?

Let's say you create iron item and you create a timer EVENT_RUSTED. You
would make him ahving a worse priority than

About memory, i think this is not the kind of thing you should take care if
you want to limit memory.
Loading items only at a mob death or loading zones when a player enter it
and unload it if nobody is in
while a time > zone_respawn_time is real memory management in my opinion.

I do have about 10k items loaded any time on ensimud without having any such
memory reduce optimisation. Timer use 4 bytes
per items. Compute it yourself and you saw it's mostly costless.

Iria of Ensimud.

PS: I put the decay timer to 1 hour.
PPS : don't forget to remove event_decay when item is taken from the floor
PPPS : we added a EVENT_DONATIONROOM_DECAY of 3 days to limit the amount of
stuff in the donation room.
       having 10000 items doesn't help newbies to learn the mud and 1 hour
isn't enough to have a collection.

-----Message d'origine-----
De : Circle Discussion List []De la part de
Ronald Fenner
Envoyé : mercredi 20 mars 2002 16:45
À :
Objet : [CIRCLE] Item Decay

Was thinking that Items should have decay timer set on them so that
after a period of time if no one has picked it up out of the room then
it gets extracted and no longer takes up memory.
This of course would only apply to items put in the room by players or
from a corpse decaying. The timer would be reset any time the object is
picked up. While there are janitor and scavenger procs the mobs that
they are set on may not be in every zone and may not hit every room.

Yeah I suppose memory use really isn't much of a problem on small muds
but large muds it would probably be more of an issue. Anyways wouldn't
be all that hard to add as i've already done a quick hack to do it (but
not the best way to do it) and would make a nice memory friendly
addition to the code base.


   | FAQ: |
   | Archives: |
   | Newbie List:   |

   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT