[MUD-Dev] TECH DGN: Re: a few mud server design questions (long)
Sean Kelly
sean at ffwd.cx
Sun Jul 29 12:29:12 CEST 2001
From: <SeronisROTv3 at aol.com>
> In a message dated 7/27/01 2:21:19 AM Pacific Daylight Time,
> sean at hoth.ffwd.cx writes:
>> Here's are 2 simple examples. Say the calendar size in both is
>> 100 ticks and in each case I want to schedule 4 events 250, 300,
>> 150, and 10 ticks in the future, respectively:
>> (a) non-randomizing example
>> (b) randomizing example
> I had totally misunderstood what you meant by a tick calendar.. I
> had assumed you meant something like a linked list of tick
> objects.. each tick object would have a time stamp of when to go
> off and a pointer to which item needs the tick.. at each game
> loop (( or however often you wished )) you could just cycle
> through the tick list and any with a time stamp equal to or older
> than 'now' would get processed and the object would the reschedule
> its next tick.
My goal was to reduce processing time as much as possible at the
expense of space. My calendar was intended to be more of a vector
or array of linked lists, where each vector/array index represented
an actual tick and each list item represented a function object or
function pointer to a tick event. This allows not only for
efficient tick processing but for making scheduling events an O(1)
operation.
What you suggest is entirely workable, but every tick would have to
traverse the entire list of scheduled events to find events that
needed to be run. So your example would have O(1) scheduling (by
adding to the back of the list) but O(n) processing of that list per
tick. It goes the other route by trading time efficiency for space
efficiency.
Sean
_______________________________________________
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