[MUD-Dev] C&C and Event Rescheduling

clawrenc at cup.hp.com clawrenc at cup.hp.com
Mon Aug 11 14:47:25 New Zealand Standard Time 1997


In <33E0F714.41C67EA6 at iname.com>, on 07/31/97 
   at 07:18 PM, Shawn Halpenny <malachai at iname.com> said:

>Chris Gray wrote:
>> 
>> [Shawn H:]

>> :For the record, object methods appear the same to the DB as object
>> :attributes.  This makes changing a method the same as changing an
>> :attribute--the C&C mechanism will take care of the contention where
>> :Bubba is opening a door and Boffo is changing the code for opening
>> :the door.  Only the VM cares if the contents of an attribute actually
>> :represent an attribute or a method.  None of this is gospel in my
>> :design yet, so I fully expect you to blast some holes in it :>
>> 
>> Is it really necessary to be this careful with code changes? To me, the
>> are outside of the scenario, in that they are not directly visible to
>> players, or to NPC's, etc. So, it doesn't really matter when code
>> changes actually take place. 

>Actually, I plan to not be careful with code changes at all.  They'll
>compete for a clean run-through with that door just like the rest of
>the events.  The thing that nags at me is that door-opening events
>that have already begun executing, but can't commit yet, because
>Bubba's changing the door code, are restarted.  That's all good and
>fine, but I wonder if they should have executed with the old door
>code since that was the expectation when they ripened.  Otherwise, it
>comes out such that changing the code while doors are being opened
>results in those doors who have already tried to open (but couldn't
>because the code change caused their death and reschedule), now
>opening differently (i.e. different functionality in the code).

>I suppose it should probably be looked at from the perspective of the
>player opening the door.  She has no idea that that door-open event
>is being killed and rescheduled, so the code change effectively looks
>like it took place before she opened the door since she'll have no
>indication of what is going on until the event dumps some output back
>to her.  This seems the correct behavior to me, but I'm wondering if
>it should be that way for all cases?  If not, is the worst thing that
>could happen something "logically interesting" like that chest
>example a few posts back?

A grievously long quote for a minor addition:

  In the general case any player, or any event can have no idea that
other events have or have not been submitted or C&C'd prior to their
own execution.  This fact gives the safety in the effectively random
order of execution of rescheduled events.

There are exceptions:

  Please enters the following very rapidly:

    N, S, E, W.

  If they are all submitted as synchronous events, compeating for
compleation, there is no telling where the player may end up.  The S
could CC& first, then the S, then W, and finally N.  Big problem.  As
such you need to have the concept of certain events only being able to
C&C when other (specified) events have successfully C&C'ed.  

>> For the record, when a wizard edits a piece of code in AmigaMUD, as
>> soon as the edited code is accepted by the server it becomes the one
>> official copy of that code, and further uses will use it. I've made
>> no provisions for delaying that switchover. Then again, my server is
>> single-threaded, but all the discussion of multi-threaded execution
>> didn't trigger any thoughts about protecting code changes.

>There is only ever one piece of executable code in place for the
>methods being changed.  All object updates are atomic, and all
>methods execute with their own little VM in their own thread, so
>there's no ugly stack magic going on.  The DB should just merrily
>commit things when they're ready and everyone will be happy,
>regardless of what's being changed when or where.

Consider the following ugly case:

  Movement is implemented as two events, one to remove the player from
the current room, and another to place him in the next room.  (I know
the problems with the model, but it provides a good example of the
problem).  

  Bubba is in room A.

  Boffo is editing the movement code for room A.

  Boffo commits the changes to room A.

  Bubba enters "E", to go east to room B.  

  Event #1 executed and C&C's to move Bubba out of room A.  Event #2
is logged to now move Bubba into room B.

  Boffo is now working on room B's movement code to make it
cooperative with his cahnges to room A.  He's not done yet however.

  Event #2 now tries to execute and fails as it can't find the proper
code to execute.  It continues failing all the way up into
single-tasking mode.  The result is that Bubba is stuck in limbo.

  Boffo now finishes his changes to room B and C&C's them.

  Bubba is still in limbo.

While rooms are an odd example to chose here, try any other command
which launches a sequence of operations where each operation is
dependant on the one before.

--
J C Lawrence                           Internet: claw at null.net
(Contractor)                           Internet: coder at ibm.net
---------------(*)               Internet: clawrenc at cup.hp.com
...Honorary Member Clan McFUD -- Teamer's Avenging Monolith...




More information about the MUD-Dev mailing list