Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
FYI: In the DikuMUD (and its descendents) representations, there is only the room. Each room has an ID and a list of exits. An exit is a pair consisting of direction ID and room ID. If the exit doesn't exist, you can't go that direction.

Now, this ends up with a Zorkifying influence. You stand in room 1. You go "south" into room 2. However, to get back to room 1, you have to go "northeast" (or whatever). This is poor mapping technique, but the possibility still exists.

As for storing just the coordinates - there's another problem to be aware of - you have to make sure that you don't have overlapping coordinate groups. Also, it is possible that you will have the same coordinate list up to 8 times, once for each room.

Now, the storage of this - I would recommend having a ROOM table and a ROOM_COORD table which foreign-key's back to the ROOM table. This also allows for something like ROOM_TRAP, ROOM_ITEM, etc - all FK'ing back to ROOM.

Of course, the entire room discussion presupposes that you want an imperfect model. Another way is to have objects contain their location rather than locations containing their objects. The room system is the latter. The problem with the former is the issue of description. It is very difficult in a text-based system to auto-generate descriptions back to a user when there isn't a set description for the location. Object-based systems are only really possible with graphical ray-traced systems, like EverQuest. But, it's still something to think about.

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.


In reply to Re3: Mapping node relationships by dragonchild
in thread Mapping node relationships by one4k4

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 05:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found