[MUD-Dev] Room Searching - how about doors?
gavin at idealab.com
Thu Apr 5 09:28:33 New Zealand Standard Time 2001
> MANY FINE COMMENTS ABOUT GRAPH TRAVERSALS OMITTED
Just a quick diversion -- consider the concept of a "door". This may
not fit with your codebase, but I would consider an intermediate door
object that functions much like a many-many join record in a
relational database. Each door would hold references to two rooms,
and metadata about the relationship between them (i.e., it's locked on
the room A side, but the key is in the lock on the room B side). Each
room object holds a collection of doors.
Re-reading the original post it appears that this approach would
require a one-time traversal of the world graph to update the rooms
database to contain the doors. Your movement functions would then need
to contain logic that says "if there is a door I can go through in the
direction I want to go in, then set my new room to the object
referenced by the door"
You get some interesting extensibility via subclassing the door object
-- you can make them invisible, transparent to sounds from the
adjacent room, permeable only to members of certain classes, etc.
MUD-Dev mailing list
MUD-Dev at kanga.nu
More information about the MUD-Dev