[MUD-Dev] TECH DGN: Re: a few mud server design questions (long)

Sean Kelly sean at ffwd.cx
Sun Jul 29 12:32:22 New Zealand Standard Time 2001

From: "Robert Zubek" <rob at cs.northwestern.edu>
> Sean K writes:

>> Depending on space restrictions, it seems to make sense to choose
>> a calendar size large enough to accept scheduling tasks well in
>> advance (to reduce the number of dummy tick events that are
>> called) while still staying within memory requirements.  Choosing
>> a game day would have made scheduling recurring events simple as
>> a task could set itself to go off at "7PM" then when it is
>> called, schedule itself again for 7PM (the next day) -- ie. no
>> calculations would have to be done to calculate how far in the
>> future 7PM is.

> as i read this, it occured to me that one could also implement
> this as an unbounded queue of scheduled events, sorted by
> time. thus, the next scheduled event would always be at the front
> of the queue, and addition of a new scheduled event would be an
> insertion into the sorted queue.

> then, at every tick the global clock pops all events from the
> front of the queue that have the right timestamp (in tick numbers,
> not RL time), and sends them off to the appropriate targets.

Yup.  Another entirely workable solution.  In this case, though,
scheduling an event would likely be an O(n) operation, as it would
have to be inserted into the sorted list (by scanning for the
insertion point from the front).  But processing of events would be


MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list