[MUD-Dev] Room-based vs. coordinate-based
malachai at iname.com
Tue Jun 3 11:43:03 New Zealand Standard Time 1997
Alex Oren wrote:
> I have some questions regarding a room-based vs. a coordinate-based
> MUD issues.
> (*) Ease of coding and efficiency.
> Room-based seems much more efficient and easier to code.
> Coordinate-based will require proximity calculations on almost any
> activity or command (in room-based I can just assume that objects
> inside a "room" container are close to each other). Motion,
> visibility, etc. becomes more complex.
I admit to copping out here, since I'm adopting a scheme where I have
a room-based system mapped onto a coordinate-based system. This gives
me an obscene number of possible "rooms", though most of them will, of
course, be empty. The remainder (those that make up the really
interesting parts of the world) are actually created by someone. The
upshot is that a room exists at a single 3-space coordinate (there's
the cop out :-) ), which rather consistently violates a number of
geometrical sensibilities. However, it does obviate the implicit
requirement (a requirement in my mind, anyway) that I have to do what
would amount to elementary ray-tracing for simple things like showing
a character what's in the room she's standing in. It's not as slick
as a completely coordinate-based approach, but it means less
headaches, particularly where object visibility is concerned. It is
much easier to just let objects exist in a room and not worry about
precisely where they are.
Arguably, it could be said that this is a coordinate system only, since
there is no reason the descriptions at each 3-space location must represent
an entire room instead of just a portion...
> (*) Combat.
> Coordinate-based makes ranged attacks, closing-in, retreats, etc.
> simpler to implement (any ideas how to handle this in a room-based
With the above implementation, things like this are possible, though
only relative to rooms (or portions of rooms), not individual objects.
The granularity of the coordinates and the objects sitting on them is
such that precise control is not possible: there's no meaning to
taking a step back from Bubba as he swings at you, since where does
that step take you? It can't always take you to another coordinate
(since that means taking you to another room, or portion thereof--the
granularity of which depends on how the set of rooms in that region
was built). If you're in a room, you are at the same location as
everything else in that room. This does not preclude ranged combat,
but does preclude precise control over close-quarters combat.
> (*) 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
- if so, add Boffo to that container and generate a message for its
- 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.
> (*) Movement.
> What will be the difference between "north" and "run north" in a
> room-based and a coordinate-based systems?
> Coordinate-based systems also seem to imply finer movement granularity
> (closing-in for combat vs. walking towards the mountain) and therefore,
> additional user commands may be needed to realize this.
I only have finer movement granularity if the room descriptions show it as
such. I'm not sure yet if it will be meaningful to type "run north"...how
fast does that make one move? If you're in the middle of a large desert
with no real rooms for hundreds of thousands of units in any direction,
it's easy to run--just pick a rate of movement and let loose. However, if
you're in the middle of a town and you're running along a street, how fast
you traverse that street (and what you see while doing so) depends a lot on
the room descriptions. I think there's a scaling issue here, since the
scale is not necessarily the same for me in all locations (more of that
geometric sensibility violation). Running through real rooms is much
different from running through virtual rooms. I'm not sure how I'll settle
this one--there may be no "run" verb at all.
If it sounds like I'm not content with this model, it's not true. So far
it works for what I want to do.
"You only need two things in life:
WD-40 to make things go and duct tape to make them stop."
More information about the MUD-Dev