[MUD-Dev] Room-based vs. coordinate-based
malachai at iname.com
Thu Jun 5 12:44:21 New Zealand Standard Time 1997
clawrenc at cup.hp.com wrote:
> In <33943B87.41C67EA6 at iname.com>, on 06/03/97
> at 08:58 AM, Shawn Halpenny <malachai at iname.com> said:
> >Alex Oren wrote:
> >> (*) Area effects.
> >> How will I handle "Boffo arrives from the north" type of messages?
> >> Room-based (or, rather, "container-based") has an advantage here. A
> >> container may send messages to the objects it contains. In a
> >> coordinate-based system I will need to consult a "map" of object
> >> locations to determine message recipients. Or am I wrong?
> >Well, I have a mapping of locations to objects as well as each
> >objects existing in a container (i.e. the room it's in). To make
> >Boffo arrive from the north, I (roughly):
> > - set Boffo's coordinates to the new location
> > - check the location->object mapping to see if there is a real
> > room at that location
> > - if so, add Boffo to that container and generate a message
> > for its contents
> > - if not (the room is deterministically generated, so there
> > is no room container), from the mapping grab all objects at
> > Boffo's new location and tell them of Boffo's arrival.
> In which case how do you handle remote effects? This was discussed
> back when for the Sceptre and the Elven Forest:
[ Sceptre moving in/out of forest means magic fails/works in Castle Krak ]
This would likely be handled by putting a method on the Sceptre to notify
the rooms of Castle Krak whenever the Sceptre moved in and out of the
Forest. When the rooms receive notification of the Sceptre in the Forest,
the rooms would destroy any magical effect on any of their contents and
also temporarily redefine the method used to create magical effect objects
while within Castle Krak (note that Thrud's Sword of Doom wouldn't change
at all but anything it tries to do that requires creation of a magical
effect would fail--this should have the (intended) consequence of the Sword
essentially failing to work. You may argue that Thrud's Sword should
change in some further fashion, but I will disagree, since there is nothing
aside from the magical-effect-creation that makes the Sword inherently
magical--that is, you can't necessarily tell something is magical just by
looking at it...things are magical only if they create magical effects).
Once the Sceptre moves out of the forest, the rooms again receive
notification and the effect-creation method is redefined to its original
If a region surrounded by Castle Krak were deterministically
generated, this can still be done, but would have to be done by
notifying an object within Castle Krak of the sceptre's whereabouts.
This object would handle destroying effects in each real room of
Castle Krak as well as the deterministic, virtual region surrounded by
the Castle (since it can't receive any notifications on its own).
> Now, just to prevent you special casing the magic calls to go check we
> had the relics of the Great God GooGoo and the Magic Sack.
Hmm. Is the above special casing the magic calls? I suppose in a
sense it is, since any call to make magic will do a check to see if
the effect is being done in Castle Krak (the check is not on an
effect-by-effect basis, though). There would have to be a check done
_somewhere_ no matter your implementation, though, no? This seems
general enough...if you had a large number of Castle Krak's , however,
things could start to slow down as the conditional for each was
> Ohh, what
> the crap, I might as well post the entire scenario (it was what was
> used to develop and exercise my spoof and watcher models):
[ three relics of GGGG and description of their function ]
This can be done in similar (though more complex) fashion. Whenever
object A requires notification of a change in object B, B must have A
in its list of objects who are notified of a change in B. The
watchers must be correctly set up and the methods called by the
watchers must execute the correct actions, but I think it all can be done
with what I've got.
I've no explicit concept for spoofs. I would do that with variables
that would be conditionally set in the objects that are the spoofs. The
methods that care about whether or not they're working with a spoof or not
can then check that fact.
I had hashed out precisely this scenario (prompting a couple small
modifications to the way effects and magic worked) when you last
posted it to the list, so I know the remote effect handling works
"Tell a man there are 300 billion stars in the universe and he'll believe
you. Tell him a bench has wet paint on it and he'll have to touch
to be sure."
More information about the MUD-Dev