Re: Peditor.

From: Patrick J. Dughi (dughi@IMAXX.NET)
Date: 03/23/98


> Use an event system for paths.  One which orders the events by
> increasing time to run.  Store paths as a circular list.  Each mob has a
> pointer into their path.  When an item goes off it advances the pointer
> and adds the next command into the list.  The event system we use keeps
> track of the events to the second so it works pretty well.  Just need to
> come up with a func that transforms the 75SEC RL into 1HR MUD time.
> 1.25RLseconds /mud minute.  You would also have to alter read_mobile or
> the function calling it to add the first command to the list.  --Angus
>

        Actually, my original system worked like that - barring that I
used the definitions SEC_PER_MUD_HOUR (75 RL_SECS) etc...  It would run
through a queue every 10 seconds, and if anything was in there, it would
be executed.  Every 10 seconds, it would check for any paths to be
executed in that next 10 second block.  So, usually there would be a
10second lag as the event would be executed on the down stroke of the
loop.  However, this had the following problems:

        1) every 10 seconds, I had to scan through EVERY entry in the
character list to see if they had a path. If so, enqueue it.
        2) When the path was to run, all I had was a vnum (this was bad
thinking on my part), so I had to run through the list again to make sure
every mob with that vnum would execute that path.

        This sucked, and I'm curious as to how you could run any sort of
timed system without some sort of constant polling.

        Maybe if you made an array representing all the possible
times..say in a day (0-1399), and you populate it with both the events,
and when to update each event... then you won't have to poll, but once
when you boot, and thereafter, only when you add new mobs via medit, or
"load", or zone reset?.. wait.. zone reset uses load_mobile?  That would
be a neat workaround...Hmm. look for it in revision 3 - for now, we're
working on actual usablity (unlike the beta I sent out, which went for
no-crash and minimalist functionality). Gosh. I should mail people more
often - I come up with the best ideas.

        For now, I'm taking Georges suggestion to make a seperate
character list of only those with paths. It should be shorter and quicker
- I can stand maybe 300-400 chars being checked per second  - muds with
moderate usage run through the char_list of 6.5 K entries more often than
that.

        To those who have requested a release, I'll send a better version
out say, by the weekened - hopefully. For reasons that are now obsolete,
paths will not queue unless they're set for uhm, minutes ending with :00,
and not all of them (it had some counting problems - thought that it
should only cycle minutes based on 100 seconds per minute..) I had wrote a
function "do_test" which simply enqueued all paths of mob "x". - ie..test
puff.  etc..

 Have a full schedule and work on code is based on if there's something on
tv to keep me awake and if people I know online don't bug me, but I try.

                                        PjD


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST