Collection of Mazes - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Games (https://qb64phoenix.com/forum/forumdisplay.php?fid=57) +---- Thread: Collection of Mazes (/showthread.php?tid=2803) |
Collection of Mazes - eoredson - 06-16-2024 Hi, Find attached a collection of maze programs. Erik. RE: Collection of Mazes - bplus - 06-16-2024 basically 3 programs, one is old one liner psuedo maze generator, another is pretty good maze generator but takes too many loc and third is old ansii maze style that is variation of amazing in basic games collection of david alh but works ;-)) RE: Collection of Mazes - eoredson - 06-17-2024 (06-16-2024, 01:47 PM)bplus Wrote: basically 3 programs, one is old one liner psuedo maze generator, another is pretty good maze generator but takes too many loc and third is old ansii maze style that is variation of amazing in basic games collection of david alh but works ;-))Thank you for noticing! If you want more 16-bit DOS programs I have older stuff that goes way back into the 1980s.. RE: Collection of Mazes - madscijr - 06-17-2024 (06-16-2024, 01:47 PM)bplus Wrote: basically 3 programs, one is old one liner psuedo maze generator, another is pretty good maze generator but takes too many loc and third is old ansii maze style that is variation of amazing in basic games collection of david alh but works ;-))Are they 3 different algorithms? When I get to the PC, I'll compare them with a couple I was using. 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) RE: Collection of Mazes - bplus - 06-18-2024 this is almost the one-liner other basic's could do Code: (Select All) _Font 8 that was expanded to this in oldmaze.bas Code: (Select All) Dim Shared MainWindow As Long 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 RE: Collection of Mazes - bplus - 06-18-2024 Quote:Has anyone seen any "procedural dungeon generator" ones? 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. RE: Collection of Mazes - SMcNeill - 06-18-2024 (06-18-2024, 12:37 AM)bplus Wrote:Quote:Has anyone seen any "procedural dungeon generator" ones? For my Rogue-Like generator. 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. RE: Collection of Mazes - madscijr - 06-18-2024 (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? 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 doThe 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! RE: Collection of Mazes - SMcNeill - 06-18-2024 (06-18-2024, 02:09 AM)madscijr Wrote: Pretty neat, that'll be fun to play with. Thanks! A quick and dirty demo of what I'm talking about for you: Code: (Select All)
Toggle that first CONST and you can see the difference between a direct path from the center of one room to another, and a meandering path. Change those values in the SELECT CASE for the SUB MeanderingPath, and you can alter how much it deviates from that basic direct path. I tried to use color for this to showcase the room (blue), center of room (red), direct path (green), and wandering path (purple), but that wandering path tends to wander and cover up everything else if you're not careful. LOL! Try it imagine it all being one set color for your "dungeon" or "rogue-like play area", and you should be able to see how this creates a map very much like Rogue used to back in the days. One thing I'd suggest to make this a ton better -- check to make certain the rooms don't overlap each other. The further apart the rooms are, the more room the paths have to stretch out and crisscross and such. Touching rooms kind of defeats the purpose of building roads between them. RE: Collection of Mazes - madscijr - 06-18-2024 (06-18-2024, 06:34 AM)SMcNeill Wrote:I like the presentation with the grid lines, and that it waits for you to press a key before going on to the next step.(06-18-2024, 02:09 AM)madscijr Wrote: Pretty neat, that'll be fun to play with. Thanks!A quick and dirty demo of what I'm talking about for you: I'll play with it some more later. Thank you! |