[MUD-Dev] C&C and Event Rescheduling

Adam Wiggins nightfall at user1.inficad.com
Fri Aug 15 22:41:59 CEST 1997


[Chris L:]
> >:  Please enters the following very rapidly:
> >:
> >:    N, S, E, W.
> 
> >It seems to me that, even if they are all on the same input line,
> >they are separate commands from the user. 
> 
> As a general rule, yes.  There are exceptions.  Consider the case:
> 
>   > dig panama canal
>   You begin digging.
>   ...many hours later...
>   You are still digging.
>   You are attacked by the Orcs!
>   > kill orcs
>   Sorry, you'll have to wait till you're done digging.
>   > oops
> 
> A silly implementation to be sure, but it illustrates.  Another:
> 
>   > n,n,n,n,n,n,n,n,n,e,e,e,e,e,e
>   You go north
>   ...
>   There an incredibly valuable diamond here.
>   You go north.
>   You go east.
>   You go east.
>   ...
>   > Go back!  Go back!
>   ...
>   > l
>   There is nothing here.
> 
> The summary we arrived at last time was that by default user commands
> should be executed strictly sequentially.  This was to be done via
> sequence number dependancies.  However, we also saw a use in commands
> which were to be explicity executed in parrallel with other user
> commands.  One of the primary uses for such was an interrupt command
> which more or less said, "kill the entire command queue NOW!".

Absolutely.  We have such a command, called 'stop' - it can also take an
argument, such as 'stop climbing' or 'stop eating'.  More importantly,
all events are rated by priority.  The very top level events (PRIORITY_MUST)
cannot be interrupted, so if you're wincing in pain, typing 'stop wincing'
isn't too effective.  Everything below that can be interrupted, and will
be interrupted by higher priority commands.  The most obvious case is
combat events, most of which have PRIORITY_LIFE_OR_DEATH.  Thus if you're
digging (PRIORITY_MENIAL) and you get attacked, or you type 'kill orc',
you'll interrupt your digging.  If you're fighting an orc and you type
'dig cannal', it will be pushed down the priority queue until you
get into a situation where you can safely do so.  This is possibly
my favorite part about our system so far; it works incredibly well, and
the total code that controls it all is about 200 lines.  All that is required
is rating each event's priority.  So far we've yet to encounter any
event that doesn't fit very cleanly into this model.

> >I'd say that an input
> >command from a user cannot even be ready for execution until all
> >previous commands from that user have C&C'd. 
> 
> In the general case yes.  An explicit exception should be made for
> interrupt commands.

We analyze each command immediately.  Commands flagged as SYSTEM (such
as accessing account functions, setting config options, checking your
basic character info (also known as 'score'), and most immort commands)
excute immediately.  All others get pushed onto the priority queue in
the proper place, and then when the pulse rolls around the oldest event
with the highest priority continues execution.




More information about the mud-dev-archive mailing list