[MUD-Dev] Re: atomic functions
Adam Wiggins
adam at angel.com
Tue May 5 18:46:58 CEST 1998
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?
> 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!
Adam
--
MUD-Dev: Advancing an unrealised future.
More information about the mud-dev-archive
mailing list