Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Collection of Mazes
#8
(06-18-2024, 12:53 AM)SMcNeill Wrote:
(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

Pretty neat, that'll be fun to play with. Thanks!

(06-18-2024, 12:24 AM)bplus Wrote: this is almost the one-liner other basic's could do
Code: (Select All)
_Font 8
10 Print Mid$("/\", Rnd * 2 + 1, 1);: GoTo 10

that was expanded to this in oldmaze.bas
Code: (Select All)
Dim Shared MainWindow As Long
Dim Shared Commodore64Screen As Long
MainWindow = _NewImage(768, 496, 32)
Commodore64Screen = _NewImage(320, 200, 32)
Screen MainWindow
_Title "Never Ending Maze"
_Font 8
Cls , _RGB32(112, 91, 207)
_Dest Commodore64Screen
Cls , _RGB32(52, 30, 149)
Color _RGB32(112, 91, 207), _RGB32(52, 30, 149)
_Font 8
Do
    _Limit 30
    For i = 1 To 13
        Print Mid$("/\", Rnd * 2 + 1, 1);
    Next
    _PutImage (64, 48)-(704, 448), Commodore64Screen, MainWindow
    _Display
    k& = _KeyHit
Loop Until k& = 27
System

here is whole folder but as i  said only 3 basic kinds of mazes

here is standard graphics version

and one of many ascii versions
The one I had was like the ascii version, but allows specifying how many spaces wide the passages are. It might be better to include an option to vary how wide the passages are at random points, or have it generate rooms here and there, within the maze. I didn't make it to the computer tonight - maybe tomorrow I'll play with these!
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: 2 Guest(s)