[QUESTION] Randomly Generated Areas

From: Daniel Koepke (dkoepke@california.com)
Date: 02/02/97


It's been talked about a bit here, but here's what I want to do.
I want to start at point 0,0 on my world map and from there, I want
to create an area with *every* room linked in some way to the others
(eg., no loose rooms), but with dead ends.  Every room along the
parimeter (eg., 0,0-0,24 , 0,0-24,0 , 24,0-24,24 , 0,24-24,24) would
be linked to another parameter wall (thus, there's a clear path around
the parameter).  Not every parameter "square" would be linked to the
interior of the area, just to the adjacent parameter walls.

That last part is easy.  I create the rooms (25x25 grid) and go along
the parameter adding the exits.  At this same time, I can randomly
add exits n/s/e/w from the parameter into the interior.  Now, here's
where I'm stuck.  After doing the parameter, we need to link every
other room in some way, where we'd have dead ends, etc.  Somewhat like
a maze. 

Er, perhaps I'm not stuck, but I'd like suggestions about how to go
about this.  I have the idea of going through the area in horizontal
rows and optionally adding turns.

For instance, we start with this (scaled down to 5x5)

    A  B  C  D  E
  1 o--o--o--o--o
    |        |  |
  2 o--o  o  o  o
    |           |
  3 o  o  o  o--o
    |           |
  4 o--o  o  o  o
    |           |
  5 o--o--o--o--o

Then we go horizontally, starting at A2 (first part of the interior),
we move to B2, C2, D2.  We either make a link to the east, or we decide
to make a turn.  If we make a turn, we go the square either north/south
of the current one.  Then we keep going in that same direction until we
decide to turn again.  That would give us a random patch through the
grid.  But then we'll have many unlinked rooms.  What to do about them?
Make a cleanup sweep and link any rooms that aren't presently linked?
Some code demonstrating generation of a maze would be nice (I'm trying
to get the major parts of a pkill MUD done before next week)...

Thank you for any assistance you are willing to give,


--
Daniel Koepke
dkoepke@california.com
Forgive me father, for I am sin.


+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST