Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Collection of Mazes
#7
(06-18-2024, 12:37 AM)bplus Wrote:
Quote:Has anyone seen any "procedural dungeon generator" ones?
(ie not really mazes, more like a bunch of rooms connected by passages, some of which may be maze-like)

i remember steve the amazing starting something like that years ago probably buried away like my little ascii thingy i started on jb years ago just helping someone else get started.

For my Rogue-Like generator.  Wink   

The basic concept was very simple:

1) Choose 2 points inside your rooms.   (The x/y coordinates for the center, if you like.)
2) Now, all you have to do is draw a straight line from point A to point B -- that would be the easiest road to how to get there.

Problem with step 2 is that's not very "dungon like".   So instead, install a variance to that path as you generate it.

Start at the first point, in the first room
DO
  meander = RND * 100
  Select Case meander
     CASE 0 to 10:  Wander the path north
     CASE 11 to 20:  Wander the path south
     CASE 21 to 30:  Wander the path east
     CASE 31 to 40:  Wander the path west
     CASE 41 to 60:  Keep wandering in the last direction 2 more steps
     CASE ELSE:    Course correct and head directly towards the 2nd point. 
  END SELECT
LOOP

By traveling towards your goal with the CASE ELSE, you'll eventually get to where you want to go.   Adjust the values for how much meandering you want to do with the path, before you get there.



And the way you make criss-crossing paths is by making sure rooms connect sequentially, but you make and place the rooms at random.

Example:  

Room 1 is in the upper right corner.
Room 2 is in the lower left corner.
Room 3 is in the middle left.
Room 4 is in the middle right.

You would now wander roughly SE from room 1 to room 2.   Then roughly north to room 3.   Then roughly east to room 4 -- and this path should automatically transverse the path from room 1 to room 2, now giving you an intersection.



Really, very simple logic at the end of the day.  The end user won't know how you made those paths, and when playing, they'll look like "dungeon tunnels" for the most part.  Wink
Reply


Messages In This Thread
Collection of Mazes - by eoredson - 06-16-2024, 03:00 AM
RE: Collection of Mazes - by bplus - 06-16-2024, 01:47 PM
RE: Collection of Mazes - by eoredson - 06-17-2024, 12:12 AM
RE: Collection of Mazes - by madscijr - 06-17-2024, 11:38 PM
RE: Collection of Mazes - by bplus - 06-18-2024, 12:24 AM
RE: Collection of Mazes - by bplus - 06-18-2024, 12:37 AM
RE: Collection of Mazes - by SMcNeill - 06-18-2024, 12:53 AM
RE: Collection of Mazes - by madscijr - 06-18-2024, 02:09 AM
RE: Collection of Mazes - by SMcNeill - 06-18-2024, 06:34 AM
RE: Collection of Mazes - by madscijr - 06-18-2024, 12:01 PM



Users browsing this thread: 1 Guest(s)