[MUD-Dev] Flow of messages
Brian Lindahl
lindahlb at hotmail.com
Thu May 8 11:05:28 CEST 2003
From: sanxion sanxion <sanxion2002 at yahoo.mom>
> I have been pondering upon the flow of messages that
> are handled on the server when something occurs. Lets
> say a player gives another player items. This
> generates a bunch of information for example:
...
> I have come to the understanding that most muds process messages
> in the same function/method. This seems fairly inflexible to
> me. Anyone agree or disagree? Is the model I'm using something to
> extend upon or are there better solutions? Perhaps someone could
> give me a breakdown of what they use and if I'm out hiking?
The model I use is one of a pipeline: brain <-> body <->
environment. Events are generated on both ends of the pipeline, some
by the environment, some by the brain. The events are then passed,
filtered and acted upon by the body. Any events that reach the brain
are used to generate responses. Any events that reach the
environment are passed through the bodies of those affected.
For instance, a particular NPC brain may take a 'damage' event and
generate a response event of 'cry'. This response is then passed to
the body. The body then attempts to cry, if successful, it passes
the event to the environment where it can be shuffled off to other
bodies. These bodies can either choose to accept or ignore the
event. For example, if you are inside a room, the body of a wall may
reject the 'cry' event from being passed through to the other side
of the wall because it was not loud enough to be heard from the
other side.
Another example: consider a user's brain. The user brain will take
an environment event passed to it from the body and generate a text
message to depict the event to the preferences of the user (color,
in the scope of attention, adding sound, etc.). The user will then
type a response to the event, which is pulled as a text message from
the user brain's socket. This text message then generates a brain
event which is passed to the body. The body then may choose to
accept or ignore the event. For example, if your brain is
controlling the body of an object (as opposed to a being), it may
reject a 'smell' event, since the object does not have a nose to
smell with.
This model allows for extreme flexibility in interpretation of
actions presented in the game world and lends itself well to
modularity and unique response patterns. Considering that I am using
this model in a object-oriented language (C++), I use virtual
functions to create the API necessary for event passage. It is then
up to the body, brain, and environment, itself, to use the events to
their own discretion.
Brian Lindahl
Development Director
The Cathyle Project
_______________________________________________
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