Event Handling

Nathan Yospe yospe at hawaii.edu
Fri Mar 28 14:40:29 CET 1997


Just rewrote my event model. This is a code free explanation of the new
version. Let me know what you think.

The Physmud++ event model functions as follows:

There are three sets of Queues:
Room Queue
Area Queue
Game Queue

Each Queue is executed by its respective local thread. Queues are, for
want of a better unused terminology, (I wish I could use "threads") 
laced with Chains, which can link together a number of Events, killing
the entire chain if one Link goes bad. Sometimes one Event is part of
more than one Chain, and each Event is linked to its constituents, 
killing itself and potentially its Chain if one of those constituents
goes out of scope. For example, most combat related Events are of Room
scope, and die when one member of the Event constituency goes out of
scope. I have been considering making command interpretation an 
interpret at time set, scheduling only one chain of related Events at a 
time on the basis of command interpretation.

Some example Event queues (1/10th second schedules):
 
  0.0 {
} 0.1 {
(Groo draws sword) (1)
(Bell tolls) (2)
} 0.2 {
(Groo hacks at Ungha) (1)
(Urgh runs off screaming) (3)
(Murgh starts muttering) (4)
(Bell tolls) (2)
} 0.3 {
(Groo slashes at Urgh) (1)
(Bell tolls) (2)
} 0.4 {
(Groo makes a flying leap in the direction of Murgh) (1) (5)
(Murgh casts wall of death) (4)
(Bell tolls) (2)
} 0.5 {
(Groo lops in the direction of Murgh's head) (1) (5)
(Murgh ducks) (5)
(Bell tolls) (2)
} 0.6 {
(Groo chops at Buhg) (1)
} 0.7 {
} 0.8 {
} ... {
} 4.9 {
(Load from 30 second queue)
}

Here, Groo could have interupted (1) and (5) when he saw the wall of
death, say, by... well, not much, unless he had a grappling hook. And a
really fast arm. But if he had a trick up his sleeve, he might have done
it. That would have killed the rest of that chain. Incidentaly, the
slash at Urgh was killed when Urgh ran off screaming.

   __    _   __  _   _   ,  ,  , ,  
  /_  / / ) /_  /_) / ) /| /| / /\            First Light of a Nova Dawn
 /   / / \ /_  /_) / \ /-|/ |/ /_/            Final Night of a World Gone
Nathan F. Yospe - University of Hawaii Dept of Physics - yospe at hawaii.edu




More information about the mud-dev-archive mailing list