# Thread: HOW?: designing a 3 dimensional, zero gravity maze

1. ## HOW?: designing a 3 dimensional, zero gravity maze

How might one approach this task:

Imagine a game in which a cube is divided up into a maze by internal compartments, very like those transparent plastic "guide the marble thru the maze" toys, but with more divisions, maybe twelve to an edge, for a total of ...1728 compartments! Well, maybe that's a bit too many, maybe 8 to the side for 512 compartments.

Anyway, this will be the playing field for a Unity game, the player will guide "a craft" thru the maze.

What might be an efficient way to lay out successful paths thru the maze, with a few dead-ends and whatnot?

I think I've finally found something it makes sense to design INSIDE V.R.

2. If you have access to a vectorizing tool (I use CorelDraw), you could use an online maze generator, such as this one:

http://www.mazegenerator.net/

NOTE: the usage terms of this maze generator require a commercial license for commercial use

to generate 8 layers of maze, and specify PNG (with solution) as the download format. Vectorize with the tool of your choice and use Extrude and Move to create the walled maze for each successive layer. Between the layers, you could create a solid wall, using Solid Drill with a set of corridor-sized cubes in the background to create several openings between each two adjacent layers with at least one opening along both the solution paths of the two layers (if such a spot doesn't exist, may have to regenerate one of the layers).

mTp

3. For example, attached is a LW2015 scene file and object:

8x8x8_Maze_1_SolutionSplineCrawler.mov

This scene uses a Spline Control to move a multi-segment tube through the maze along the "multi-layer solution path". The Spline could also be used to move a "vehicle" through the maze on the solution path.

The method described above (https://forums.newtek.com/showthread...=1#post1555289) was used to create 8 maze layers. For each layer, a "corridor size cube" was pasted into various places to cut the "intra-layer walls" (Layer 10):

Layer 1 in foreground, layer 2 background, position corridor cubes

Intra-layer walls with all corridors drilled with Solid Drill

Create 2-point polys from each layer to next for multi-layer solution path curve (for Spline)

This is a simplistic approach to producing the cross-layer corridors with Solid Drill, with the solution path always moving from Layer 1 to Layer 8. A more complex 3D maze could be made by requiring the user to "backtrack" back toward Layer 1, and other variations.

mTp

4. Thanks, MonroePoteet! Amazing finds and work!

5. You could create a Lscript to do it...

6. Originally Posted by XswampyX
You could create a Lscript to do it...
For certain values of "you".

Is the 2nd part of the IF clauses checking for the boundaries???

And: did you just have this lying around???

7. Originally Posted by jeric_synergy
For certain values of "you".

Is the 2nd part of the IF clauses checking for the boundaries???

And: did you just have this lying around???
Haha. I'll post it when it's finished.

I started writing it 2 days ago.

It's quite clever. start in a grid, select 4 vales for directions, shuffle them, and then check each one to see if it's solid/not visited. If it is then move there and call the procedure again, from inside the procedure.

But....

LW's stack is too small and anything over 51 x 51 crashes it.

Cheers!

8. XswamyX : Stack is too small? Create your own, and instead of making it recursive, have it just keep looping until all cells are visited, ie, the stack is empty.

I was thinking of a rules based system...

For the maze:
-You may have 2 openings leading out of the volume.
-They may not be next to each other.
-An arbitrary random seed is used to generate unique maze volumes.

For each cell:
-Each cell has a minimum of 1 exit, and a maximum of 3.
-Any exit is at the center of a face, for a total of 6 possible locations.
-No cell can have an exit to the outside beyond the first two (Entrance and exit are generated outside of the main loop).

Certain conditions will have to be checked, and a generated exit will have to be discarded.
A solution path would be generated first, then branches off that path generated.

I'll have to start putting some code together, and see what I come up with.

9. Originally Posted by XswampyX
Haha. I'll post it when it's finished.
I started writing it 2 days ago.
It's quite clever. start in a grid, select 4 vales for directions, shuffle them, and then check each one to see if it's solid/not visited. If it is then move there and call the procedure again, from inside the procedure.
LW's stack is too small and anything over 51 x 51 crashes it.
Cheers!
So, it's recursive. (That always makes my head hurt.) Me no comprendo how such an algorithm guarantees that each square gets visited, and what determines if it's cleared or left alone.

INNNnnnteresting....

10. While this exercise is interesting, design ethics should be considered. A 2D maze can be navigated because the viewer can observe the entirety of the path. If you place the viewer within a 3D maze without any visual cues about what is up/down, left/right, or where they have already been, you may very well lead someone to madness. This is on your head. Consult your conscience before proceeding.

11. LOL, yes, I've considered that. For one thing, Walls would be differently colored, textured, or you'd never get out (heck, I get lost in PORTAL). Humans are probably crap at true 3D mazes, considering people manage to get lost in New York City.

I think aircraft carriers are probably the closest we come to nightmarish 3D mazes.

12. So I've coded my own stack and can now create them any size!

But it's a bit s l o w....

101 x 101

So now what?

This with options, or the 3D full on mental maze?

13. Originally Posted by jeric_synergy
So, it's recursive. (That always makes my head hurt.) Me no comprendo how such an algorithm guarantees that each square gets visited, and what determines if it's cleared or left alone.

INNNnnnteresting....
It's quite simple.... Really!

Imagine if you will you have a Dwarf who will only dig into an empty grid space.
He does just that and digs into the empty space.
But he doesn't walk into the empty space he gets his twin brother to walk into it and dig into another empty space.
When he has dug into his empty space he doesn't walk into it he gets another twin brother to dig from the new empty space.
This third brother can only dig one hole from his original (third) space so quits the dig and has a nice cup of tea.
The second brother then turns around and digs out another free space and calls the third brother back in to dig from this new position.
They carry this on until only the original dwarf is left on the site, and if he can't dig then the maze is done.

This is great and all that, but you might need 10,000 brothers!

14. Well here it is!

AMaze_XSX.zip

Don't go mad on the size!

15. Originally Posted by XswampyX
It's quite simple.... Really!

Imagine if you will you have a Dwarf who will only dig into an empty grid space.
He does just that and digs into the empty space.
But he doesn't walk into the empty space he gets his twin brother to walk into it and dig into another empty space.
When he has dug into his empty space he doesn't walk into it he gets another twin brother to dig from the new empty space.
This third brother can only dig one hole from his original (third) space so quits the dig and has a nice cup of tea.
The second brother then turns around and digs out another free space and calls the third brother back in to dig from this new position.
They carry this on until only the original dwarf is left on the site, and if he can't dig then the maze is done.

This is great and all that, but you might need 10,000 brothers!
???... still confused: by the first "empty grid space" above, do you mean "unchecked" or "unsurveyed"? This seems like it would eventually just empty the grid. And where does the randomization occur?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•