[MUD-Dev] Re: atomic functions

Shawn Halpenny malachai at iname.com
Thu May 7 10:07:39 New Zealand Standard Time 1998


On Tue, May 05, 1998 at 06:46:58PM -0700, Adam Wiggins wrote:
> On Tue, 5 May 1998, Shawn Halpenny wrote:
> > I want a method to do this without having to write the code in a
> > special way, though:  I don't want the scriptor to have to think
> > about breaking his "add 10 to the max_damage of every adamantine
> > sword whose name begins with the letter 'Q'" event into a chain of
> > events (one per sword, by the time all is said and done), just to
> > make sure that an update of that breadth will commit in timely
> > fashion.  Roughly, I want the scriptor to be able to write
> > something like:  
> > 
> > function foo()
> > {
> > 	foreach obj (obj_in_world.type == "admantine sword")
> > 	{
> > 		... some stuff ...
> > 
> > 		obj.max_damage += 10;
> > 
> > 		... more stuff ...
> > 	}
> > }
> > 
> > and not have the server handle foo() single-threadedly.
> 
> Hrm - perhaps everything between ANY set of braces should be considered
> a function?

And by that you mean scheduled as its own event?  I was thinking about that
too.  Currently, that event will not be scheduled to run until the event
that called foo() successfully C&C's, so there isn't a gain in putting the
loop guts into its own event (in fact, if post-loop processing were done in the
foo() event that depended on something that happened within the loop,
object state would be inconsistent based on the order of events).

> > Is breaking that loop into an event chain as simple as scheduling
> > an event to execute the guts of the loop on each iteration?  I
> > think you'd still end up with a lot of failed C&C's as those new
> > events ripened, since the foo() event hasn't completed looping yet.
> >  
> > 
> > Would the effect be less drastic if the attributes were stored as
> > distinct objects in the DB, rather than considering mud objects as
> > the base storage unit?  That way, the only time C&C would fail is
> > if some other event had touched the exact same attribute, as
> > opposed to just touching the object.  (I'm particularly hoping
> > someone (like JCL!) will have tried something like that and can
> > feedback here).  
> 
> Do an archive search for C&C.  You'll pull up a ton of stuff, probably
> most of it from JCL.  Then if you have questions/things to add you can do
> a followup.  We love resurrecting ancient threads here!

Aye (I had resurrected it that time).  The thread petered out
eventually after a few of us had tossed about methods for object
comparison at C&C time, event sequencing, and breaking objects into
their component attributes for storage.  Above, I'd mentioned JCL
explicitly since back then he had dropped that he might try such an
object breakdown and see how it performed.  I suppose we'll have to
forgive him his day job and wait until he catches up to this message.  

--
Shawn Halpenny

I know that you believe you understand what you think I said, but,
I am not sure you realize that what you heard is not what I meant.  

--
MUD-Dev: Advancing an unrealised future.



More information about the MUD-Dev mailing list