[MUD-Dev] World Event Model

Christoph Seifert seifert at ILP.Physik.Uni-Essen.DE
Fri Aug 4 11:05:30 New Zealand Standard Time 2000


I read through the ideas for making events and even downloaded the
example by Adam.

The mud I code on - The Realm of Magic (http://rom.mud.de) - uses a
system for
events as well, but with a different approach on priorities. Events in
are actions or something that goes over several rounds or for a longer
The scheduling is central, but akward still and not the interesting
point. The
code for this event system is written in C++ as much of the originally
Mud has been ported to.
The specification or rather how things work:
There is a base Event class, which defines priority handling and
interfaces -
all other events like kicking are derived from it. The data contained is
counter and flags specifying the type of event.
Every mob, item or room in the game has a list of events it is involved
in at the moment.
Whenever a new event is generated e.g. Kick(attacker,victim), the event
checks the circumstances for the event and calls the central (Priority)
check function
e.g. victim->Check(new_event) befores it installs itself - otherwise
mark itself
as finished.
The events are separated into activities like movement, see, mind or
and non-activities. If one of either old event(s) or new event is no
then all events can stay on character. If both activities have something
in common
e.g. involve both movement, the new event will override the old event in
both actors are the same e.g. the attacker. Thus a kick would stop
dancing, because
both are movement activities. For a non-activity, the old event will
only be
removed, if the new event has the same name (each class derived from the
event class redefines Name() member function).

There are several miscellaneous flags:
- nomix: activities cancel each other out, even if the active member is
different e.g.
         avoiding people dancing tango and waltz at the same time
- single: removes all other events e.g. the death event
- locked: protects against overwrite - new event is not installed and
single overrides
          if old event is not single itself
- finished: event is finished - used for proper deletion of Event object
- independent: will only be removed by "single" events and can be
installed anytime e.g.
   farting ;-)

Then a flag for each humanoid body part has been added to be used for
special events
like losing a limb or trying to start a certain event e.g. getting a leg
chopped off
while trying to kick stops kicking and not having two legs makes it kind
of impossible
to start a kick.
Once an event has been established and added itself to all involved
the Execute member function is called, which holds the main code of the
e.g. check wether the victim is still there and in the last round make
the hit on the target, if still there. The Execute function is called
regurlarly - in this case
for each combat round.

Some handling to avoid crashes:

Every mob, item or room calls the Remove member function of all Events
they are
involved in at the moment - the event has to take care of that
e.g. tmp_event->Remove(mob).
Whenever an event is finished, the CleanUp member function is called,
which calls
the appropriate member function e.g. mob->Remove(this_event) of all
involved objects
(yes, the event has to store information on all involved objects).

Other interfaces/member functions defined:
Damage: alter the damage e.g. stone_skin->Damage(amount) having a stone
skin halves
        the damage
CmdInterpreter: catch the command - very much like old Specials in
circle mud
   e.g. stop the event with stop dancing
Spell: return true, if spell has been handled e.g. vampires are immune
to poison spell
HasActive: return active mob
List: Give out information on the event for display

Anyway, I am not 100% satisfied with the priority handling, although I
didn't think it up
in one day.

I would appreciate any comment or discussion on it.


MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list