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

Robert Zubek rob at cs.northwestern.edu
Sat Jul 28 02:58:26 CEST 2001


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.

on the down side, the truly recurrent events would have to be
responsible for enqueueing themselves back onto the schedule
manually, before their handling is finished. on the up side,
enqueueing/dequeueing should be cheap, and the schedule size is
unbounded...

rob


--
Robert Zubek 
rob at cs.northwestern.edu
_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev



More information about the mud-dev-archive mailing list