[Coldstuff] Environment list and recursive locations...
Brandon Gillespie
coldstuff@cold.org
Fri, 15 Feb 2002 16:20:27 -0700
Ok, I decided to tackle fixing some of the located location issues
(i.e. a location of a couch in a location of a room, etc). I thought
about this years ago (1995 or so) and cannot recall ANYTHING from back
then, so I'm starting over. I'd appreciate some input on how other
muds handle this, because frankly I can't even recall how MOO does it
anymore...
I have three variants, based on a little hacking I just did... All of
the timings come from the same room on the same hardware, and are
relative only to themselves...
1-- Current ColdCore configuration...
This configuration is very minimal... the environment has no concept
of located locations. It is just a list of anything you are holding
or which is in the room you are in (so you could address the couch in
the room you are in, but nobody on the couch in the room...).
This takes approximately 0.000086 to generate an environment list...
2-- Open-ended configuration
This allows for any object within the context of the environment to
add-to the list as it is being generated. This way a couch could also
inject everybody sitting on the couch, etc. It uses a dictionary to
avoid loops and replication. However, it is also very slow, time is
approximately 0.001234 in the same room.
3-- $located_locations only
This goes back to the original code and just hacks in a check for
located locations, and if the target object is a located location it
then injects that object's contens. It takes 0.000318 seconds.
So the issue is--stick with a non extensible mechanism like #3, but
which is faster, or go with an extensible mechanism like #2 and just
take the performance bump (is it really that big of a deal?). Nice
thing about #2 is it allows for things like an object to be able to
inject a detail into the environment, without having to either make it
be a real object or have it be a located_location. Of course, one
could argue against that, in that all addressable objects in the
environment should be $things, and all located locations should be
$located_locations, thus making it a non-issue...
Let me know which would be preferrable...
-Brandon