1998Q1/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Event handling (was: request for comments) -->
<!--X-From-R13: f001tzhNabin.jevtug.rqh -->
<!--X-Date: Mon, 12 Jan 1998 22:12:30 +0000 -->
<!--X-Message-Id: Pine.PMDF.3.95.980112162534.543197222A&#45;100000#nova,wright.edu -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 199801112043.MAA04583#under,Eng.Sun.COM -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Event handling (was: request for comments)</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:s001gmu#nova,wright.edu">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00219.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00221.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00210.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00169.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00220">Author</A>
&nbsp;|&nbsp;<A HREF="#00220">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00220">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Event handling (was: request for comments)</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A></LI>
<LI><em>Subject</em>: Event handling (was: request for comments)</LI>
<LI><em>From</em>: <A HREF="mailto:s001gmu#nova,wright.edu">s001gmu#nova,wright.edu</A></LI>
<LI><em>Date</em>: Mon, 12 Jan 1998 17:13:01 -0500 (EST)</LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>

On Sun, 11 Jan 1998, JC Lawrence wrote:

&gt; On Fri, 9 Jan 1998 13:51:24 PST8PDT 
&gt; s001gmu &lt;s001gmu#nova,wright.edu&gt; wrote:
 
&lt;old, and somewhat confusing attributions removed.  everything in here is
 mine, from my last post, JC's response, or my most recent response&gt;
 
&gt; &gt; mmm.. I dunno that that is really a valid concern... I am leaning
&gt; &gt; more and more towards JC's Spoof/Watcher model, which allows for
&gt; &gt; such things nicely (definately planning on spoofs.. still thinking
&gt; &gt; about watchers..  
&gt; 
&gt; Spoofs and watchers have different function, altho their capabilities
&gt; can cross.  The intent of a watcher is purely to tragger on sate
&gt; changes.  This allows objects to react to changes in other objects:

*nod* And together with an event driven system, they make a very powerful
system.  

&lt;watchers explination and examples removed&gt; 
 
&gt; I wanted a general solutionw hich could elegantly handle all of these
&gt; without special casing.or requiring bizarre design or coding rituals.
&gt; 
&gt; &gt; dunno if my design goals necessarily coincide with
&gt; &gt; the ones you chose that lead to spoofs/watchers, JC).  
&gt; 
&gt; I presume this means that requirement that any feature must be able to
&gt; be programmed without requiring source access to any objects other
&gt; than the ones embodying the featuer?

*nod*  I'm still debating that.  I like a lot of the power that shortcuts
provide, and I'm debating wether the cost of the shortcut (restricted
further developement) is worth the benefit.
 
&gt; &gt; W/O using
&gt; &gt; watchers (to watch the phase of the moon), I would schedule an event
&gt; &gt; to go off at the beginning of the time the lycanthrop should morph,
&gt; &gt; to trigger the morph, and then one to go off at the end of the time,
&gt; &gt; to morph the poor bastich back.  
&gt; 
&gt; What happens if Bubba manages to delay or accellerate moon-rise/set?

hadn't planned on letting ppl make changes of that scope, but it does
bring up the issue for less admin controlled situations (Castle Crack and
the Bucket... ;)

&gt; What if this was thru administrative errors (Admin reset the time and
&gt; forgot some details)?  You are creating an indepedant system which
&gt; does not rely on or react to the data which it pretends to be
&gt; dependant on.

Aye.  There  obviously has to be some form of information passing.  Which
leads to...  :

&gt; There are two base approaches: watchers and messages.
&gt; 
&gt;   In the watcher case all lycanthropes merely matain a watcher on the
&gt; relevant moon object and respond accordingly.  The moon
&gt; sets/rises/whatever, the watcher is triggered and they have a chance
&gt; to react appropritately.
&gt; 
&gt;   In the message passing case the moon state-changes and realises that
&gt; other objects may be dependant on that state change, and thus sends a
&gt; message to them, or directly invokes their methods to make the changes
&gt; itself (ugly).
&gt; 
&gt; There really is very little difference here from the watcher model
&gt; except that it is now the object itself determining that the state
&gt; change is relevant, and the object itself also now needs to maintain
&gt; its lists of who to send the state-change messages.  Watchers just
&gt; virtualise this model by having external generic non-invasive objects
&gt; do all the work of triggering and sending the messages.  
&gt; 
&gt; The programmer for the mood doesn't need to know a thing about
&gt; lycanthropy or wolves howling, he just needs to account for the moon.
&gt; Similarly the programmer for the were-wolves doesn't need to hack the
&gt; source for the moon, he just has his were-wolf objects put a watcher
&gt; on the moon (a very standard, on-line command), and then writes a
&gt; couple lines of code to look for the state-changes he is interested
&gt; in.  

&lt;stream-of-consciousness&gt;
given an event driven system, it becomes a problem of action-reaction.
each event has an unknown number of objects which are interested in the
event, IE: should react to it.
Some of those objects may have to interrupt pending events...
given the unknown number of interested parties, it makes sense to have
some centralized list, each party expressing what kinds of events it is
interested in (event masks? :)
Problem: potentially every object in the game (even those dumped in
cold-storage) could be on that list... in fact, should be.
Proximity to the event (range determined by perception method/ abitilies)
allows for most normal events to be 'broadcast' to the correct subset of
all objects... but what about non-proximate parties?
... hmmmm...
&lt;/stream-of-consciousness&gt; 

I think I need to sit down some place quiet and think about this a lot.
:)  Part of me balks at adopting another's technique w/o first analyzing
it to death...  :)  I may go quiet for a few days as I sort things out...

&gt; &gt; No real worries about multiple
&gt; &gt; events targeting the same data at the same time, as the events would
&gt; &gt; occure once a month!  :)
&gt; 
&gt; Until Superman gets that moon spinning faster in a lower-orbit.

*nod*  see above thoughts, etc. :)

[switching topcis] 
&gt; &gt; I'm thinking the best solution might be to fall back on DB
&gt; &gt; backups...  every &lt;so often&gt; the program dumps a 'current state' of
&gt; &gt; the pc to the DB.  if a crash occurs, the last 'current state' is
&gt; &gt; loaded.  Current states would include enough info to reconstruct the
&gt; &gt; events for the character in question.  Some events would have to be
&gt; &gt; handled seperately... combat type events, etc.  mmm.. definately
&gt; &gt; requires some thought.  Mayhaps I shall go dig up my concurant
&gt; &gt; software design notes, and DB notes on rollback techniques.
&gt; 
&gt; One of my early design had the DB do periodic saves to backups.  The
&gt; problem as you note was maintaining logical consistancy for changes to
&gt; the DB __during__ the backup procedure without requiring the entire
&gt; game to halt during the backup.
&gt; 
&gt; It can be done.  The solution consists of two parts:
&gt; 
&gt;   1) for object in DB, write object to backup DB.
&gt; 
&gt;   2) for object change during backup where object has been written to
&gt; backup DB, flag object in backup as deleted, write changed object to
&gt; current running DB __and__ backup DB, and update indexes appropriately.

hmm.. don't think I quite communicated our model correctly.  we plan on
having active parts of the game loaded into memory, and less active parts
stored in the DB.  The active parts will be changed frequently, w/o writes
to the DB.  the backups I spoke of were updates to the db.  Poor choice of
words on my part.  We planned on having the 'db writes' for active objects
occure at some regular interval, starting from the time the object became
active.  For PCs, this means when they logged in, NPCs and objects, etc,
from the time a player walked into the area (or whatever grain we go with
to pull a chunk out of cold storage).  Due to the staggered times for all
of this, each player/npc/etc will be 'saved' at different times, creating
ALL SORTS of fun.  :)

 
&gt; &gt; Bubba and Boffo are fighting.  Bubba and Boffo are on different
&gt; &gt; clocks for their 'db backup' events.  Combat is interrupted by a
&gt; &gt; crash / termination / reboot / whatever.  If all events are stored
&gt; &gt; in the db backup, Bubba and Boffo will have different pending combat
&gt; &gt; events, based on the different times at which their last backup was
&gt; &gt; made.
&gt; 
&gt; True.

A thought I just had.. what if events not generated by an automated
process (IE: combat, etc) are the only ones stored?  mmm... no... healing
events are auto-generated.  But then, I 'spose we could patch that at
login...

 if (hp &lt; max_hp)
   generate_event("HEAL", &amp;char-name);

hmmm.. we'd have to work up a fairly generic system to allow for future
expansion.. a way to store enough info to re-start the event chain
mid-way, for events that affect only the charater in question...
More fodder for thought experiements.  :P
 
&gt; &gt; Easy solution, put everyone on the same clock.  problem: large db
&gt; &gt; writes, all at once.  slams system pretty good with a lot of ppl on.
&gt; 
&gt; See above.  You can make the backup thread quite low priority.
&gt; 
&gt; &gt; definately a DB rollback issue.
&gt;  
&gt; Nooo.  A consistancy issue.

how to maintain DB consistency in case of an unexpected shutdown?  sounds
like Rollback to me...
 
&gt; &gt; Any comments from the peanut gallery?  :)
&gt; 
&gt; More salt please.

heh... 's always nice to start a monday morning with a little humor.
Granted, I didn't get around to replying to this part of the message until
evening, but hey.  :)

-Greg


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00195" HREF="msg00195.html">Re: [MUD-Dev] Event handling (was: request for comments)</A></STRONG>
<UL><LI><EM>From:</EM> JC Lawrence &lt;claw#under,Eng.Sun.COM&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00219.html">Re: [MUD-Dev] Commercial value of RP</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00221.html">Re: [MUD-Dev] Clients</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00210.html">Event handling (was: request for comments)</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00169.html">Re: [MUD-Dev] Event handling (was: request for comments)</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00220"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00220"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>Event handling (was: request for comments)</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<LI><strong><A NAME="00246" HREF="msg00246.html">Event handling (was: request for comments)</A></strong>, 
s001gmu <a href="mailto:s001gmu#nova,wright.edu">s001gmu#nova,wright.edu</a>, Fri 16 Jan 1998, 15:35 GMT
</LI>
</ul>
<LI><strong><A NAME="00195" HREF="msg00195.html">Re: [MUD-Dev] Event handling (was: request for comments)</A></strong>, 
JC Lawrence <a href="mailto:claw#under,Eng.Sun.COM">claw#under,Eng.Sun.COM</a>, Sun 11 Jan 1998, 20:44 GMT
<UL>
<LI><strong><A NAME="00207" HREF="msg00207.html">Re: [MUD-Dev] Event handling (was: request for comments)</A></strong>, 
Matt Chatterley <a href="mailto:root#mpc,dyn.ml.org">root#mpc,dyn.ml.org</a>, Mon 12 Jan 1998, 10:02 GMT
</LI>
<LI><strong><A NAME="00210" HREF="msg00210.html">Event handling (was: request for comments)</A></strong>, 
s001gmu <a href="mailto:s001gmu#nova,wright.edu">s001gmu#nova,wright.edu</a>, Mon 12 Jan 1998, 15:13 GMT
</LI>
<LI><strong><A NAME="00220" HREF="msg00220.html">Event handling (was: request for comments)</A></strong>, 
s001gmu <a href="mailto:s001gmu#nova,wright.edu">s001gmu#nova,wright.edu</a>, Mon 12 Jan 1998, 22:12 GMT
</LI>
</UL>
</LI>
</ul>
</ul>
</ul>
<LI><strong><A NAME="00169" HREF="msg00169.html">Re: [MUD-Dev] Event handling (was: request for comments)</A></strong>, 
JC Lawrence <a href="mailto:claw#under,Eng.Sun.COM">claw#under,Eng.Sun.COM</a>, Sat 10 Jan 1998, 03:53 GMT
<UL>
<LI><strong><A NAME="00214" HREF="msg00214.html">Re: [MUD-Dev] Event handling (was: request for comments)</A></strong>, 
Vadim Tkachenko <a href="mailto:vadimt#4cs,com">vadimt#4cs,com</a>, Mon 12 Jan 1998, 17:54 GMT
</LI>
</UL>
</LI>
</ul>
<LI><strong><A NAME="00167" HREF="msg00167.html">Re: [MUD-Dev] request for comments (was: Mud-Dev FAQ)</A></strong>, 
JC Lawrence <a href="mailto:claw#under,Eng.Sun.COM">claw#under,Eng.Sun.COM</a>, Sat 10 Jan 1998, 03:38 GMT
<UL>
<LI><strong><A NAME="00211" HREF="msg00211.html">Re: [MUD-Dev] request for comments (was: Mud-Dev FAQ)</A></strong>, 
Vadim Tkachenko <a href="mailto:vadimt#4cs,com">vadimt#4cs,com</a>, Mon 12 Jan 1998, 16:30 GMT
</LI>
</UL>
</LI>
</ul>
</ul>
</ul>
</ul>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>