[Mod] Maze [0.5.5] [maze]

User avatar
Echo
Member
Posts: 122
Joined: Tue Jul 31, 2012 08:11
Location: Germany

[Mod] Maze [0.5.5] [maze]

by Echo » Post

Get lost! This will generate a random maze near your position. Will you find the exit?
Hint: The map is printed out in the console.

Use the chat-command

Code: Select all

/maze <size_x> <size_y> <#floors> <material_floor> <material_wall> <material_ceiling>
Example:

Code: Select all

/maze
gives you 20 x 20 x 3 maze with cobble walls, floor and ceiling

Code: Select all

/maze 30 50 1 default:dirt default:stone air
gives you 30 x 50 x 1 maze with dirt floor, stone walls, without ceiling

License
Code: WTFPL

Mod dependencies
default

Download
0.5.6 maze_0_5_6.zip
0.5.5 maze_0_5_5.zip
0.5.1 maze_0_5_1.zip
0.5 maze_0_5.zip
0.4.1 maze_0_4_1.zip
0.4 maze_0_4.zip
0.3 maze_0_3.zip
0.2.2 maze_0_2_2.zip
0.2.1 maze_0_2_1.zip
0.2 maze_0_2.zip
0.1 maze_0_1.zip

Image
default:stone - floor, default:cobble - walls and air-ceiling.

Version History
  • 0.5.5 added 20% partial braid maze (loops, harder to get through maze), small bug fixed placing the treasure
  • 0.5.1 bug fixed with "closer"-stone on exit
  • 0.5 find the treasure, added some torches, when you enter the maze the entrance closes (now you have to find the exit)
  • 0.4.1 fixed rounding error when coordinates jump from positive to negative, if exit is underground dig a hole to surface
  • 0.4 mazes are now 3D (3 floors by default), mazes are now really random (forgot randomseed), check if chosen material exists else fallback to default:cobble
  • 0.3 maze is generated in view direction of player, the exit of the maze is now always reachable, the entrance is right in front of you (middle of maze_size_y), default size is now 20 x 20
  • 0.2.2 nicer walls (no more "over-edge" walls, as in the screenshot, where light could shine through), therefore faster generation
  • 0.2.1 code cleanup
  • 0.2 choose material for wall, bottom, ceiling (optional)
  • 0.1 first release
ToDo
  • some bigger rooms in the maze, not just corridors
Edit: added word "license" for sfan5s squealer-script
Last edited by Echo on Mon Jul 26, 2021 12:33, edited 2 times in total.

sfan5
Moderator
Posts: 4094
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

Nice!
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

this is just a-MAZE-ing =)

Blackthorne
Member
Posts: 78
Joined: Tue Aug 14, 2012 07:38

by Blackthorne » Post

Could you perhaps make a variant that creates mazes out of leaves/hedges? It'd be perfect for my Victorian manor gardens.

+1

pagliaccio
Member
Posts: 65
Joined: Tue Jul 31, 2012 07:38
Location: italy

by pagliaccio » Post

screen?

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

by VanessaE » Post

Could you also add a screenshot?
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

User avatar
Echo
Member
Posts: 122
Joined: Tue Jul 31, 2012 08:11
Location: Germany

by Echo » Post

Blackthorne wrote:Could you perhaps make a variant that creates mazes out of leaves/hedges? It'd be perfect for my Victorian manor gardens.

+1
added your wish to my todos. Then you probably don't want a ceiling.

[Edit] realized your wish, except that leaves will disappear without a tree next to it... so build your floor out of default:tree or create a mod with a non-disappearing hedge-node.
Last edited by Echo on Sun Aug 19, 2012 11:02, edited 1 time in total.

User avatar
NakedFury
Member
Posts: 151
Joined: Thu Dec 08, 2011 03:55

by NakedFury » Post

Tried it yesterday.

Game runs out of lua memory if you try to make a 10000x10000 or 7kx7k maze.

I made a 10x10 maze, then without moving I ran the code again for a 15x15 maze it replace the old 10x10 maze.

Im gonna try to find where the run out of memory bug starts.

Edit: Ok just finished a very long construction of a 1kx1k long maze. IT took some time but it finally finished.
Gonna test 2kx2k later.
Last edited by NakedFury on Sun Aug 19, 2012 16:13, edited 1 time in total.

User avatar
Echo
Member
Posts: 122
Joined: Tue Jul 31, 2012 08:11
Location: Germany

by Echo » Post

Ok, I don't know the data-structure of LUA, but assuming that a number (LUA doesn't seems to have a byte or a integer type) needs 4 Bytes RAM.

Then we have 7000 * 7000 = 187MB just for the maze, then there is an array with coordinates for the creation-way through the maze with about another 150 MB.

7000 x 7000 is really big. Want to get lost forever? ;-)

User avatar
NakedFury
Member
Posts: 151
Joined: Thu Dec 08, 2011 03:55

by NakedFury » Post

Servererror: Luaerror: error: not enough memory

That is the complete error message

User avatar
Echo
Member
Posts: 122
Joined: Tue Jul 31, 2012 08:11
Location: Germany

by Echo » Post

For the array, representing the maze, I will switch to boolean instead of number. That will save a lot of memory.

User avatar
Echo
Member
Posts: 122
Joined: Tue Jul 31, 2012 08:11
Location: Germany

by Echo » Post

Tested 3000 x 3000 maze, it takes a long time but works now.

And you have to make sure your world is already generated that far. If not, the terrain builder will come and generate the landscape over/through the maze.

User avatar
NakedFury
Member
Posts: 151
Joined: Thu Dec 08, 2011 03:55

by NakedFury » Post

Yesterday my debug file got to weight a wooping 500 or more mb.

User avatar
Bas080
Member
Posts: 398
Joined: Mon May 21, 2012 15:54
GitHub: bas080
IRC: bas080
In-game: bas080
Location: Netherlands

by Bas080 » Post

cornernote wrote:this is just a-MAZE-ing =)
I wanted to make that same remark because it IS!

I like the ToDo list. 3d Mazes. I like seeing more of these ideas where you have this game-inception. Minetest is great for games in a game.

Blackthorne
Member
Posts: 78
Joined: Tue Aug 14, 2012 07:38

by Blackthorne » Post

I love watching things evolve. Only yesterday, this mod was at 0.1. now it's already gone through several more releases in a single DAY. That's pretty awesome.

User avatar
Echo
Member
Posts: 122
Joined: Tue Jul 31, 2012 08:11
Location: Germany

by Echo » Post

thanx alot

As I don't know how much time I can invest in developing my mods, I try to publish even the smaller steps. And we're far away from version 1.0 ;-)
Ok, next will be 3D-mazes, this will take a little bit longer...

User avatar
Echo
Member
Posts: 122
Joined: Tue Jul 31, 2012 08:11
Location: Germany

by Echo » Post

Tadaaa, 3D - mazes with ladders between the floors. It's really hard to keep orientation even in small mazes.

User avatar
Echo
Member
Posts: 122
Joined: Tue Jul 31, 2012 08:11
Location: Germany

by Echo » Post

Fixed bug when coordinates jump from positive to negative. When the exit is underground, a ladder will lead up to surface.

User avatar
Echo
Member
Posts: 122
Joined: Tue Jul 31, 2012 08:11
Location: Germany

by Echo » Post

Update:

User avatar
Echo
Member
Posts: 122
Joined: Tue Jul 31, 2012 08:11
Location: Germany

by Echo » Post

Update:
  • added 20% partial braid maze, about 20% of the dead end walls are broken to build loops. So it's harder to find your way through the maze.
  • fixed small bug placing the treasure
  • some more comments, especially for me...

User avatar
Echo
Member
Posts: 122
Joined: Tue Jul 31, 2012 08:11
Location: Germany

by Echo » Post

@GloopMaster: I changed the licence to WTFPL. So feel free to do what you want to.

I had something different in mind. I thought about evolving this mod to a new mod called: PacMan!
Rules:
Enter the maze, the mobs will hunt you through the maze.
You can find certain nodes in the maze which will make you a "hunter", so the mobs flee from you for some time (playing hunter-music in this time?). When you kill a fleeing mob you get a treasure. Killling a "hunting" mob will be much harder and will get you nothing.
The exit will only open, when all mobs are killed.
Last edited by Echo on Wed Sep 05, 2012 10:54, edited 1 time in total.

User avatar
Echo
Member
Posts: 122
Joined: Tue Jul 31, 2012 08:11
Location: Germany

by Echo » Post

GloopMaster wrote:Well, i mean because i have not the slightest idea where to start to make the mazes on mapgen. :)
Haven't done before, too. But when you look at celerons mobs-mod [http://c55.me/random/2012-07/mobs.tar.gz], his dungeons are just added after a new chunk has been generated.

Code: Select all

minetest.register_on_generated(function(minp, maxp, seed)
Perhaps he reads this topic and uses the algorithm to create better dungeons... :-)

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

[request]

can you make a craftable node, when you put it down:

a) it generates a maze with a fixed size
or
b) can you make a formspec (like a chest) so that you put the options into it, then click go and the maze is created

that way we can see mazes in public servers

edit: this is now done, as part of deploy nodes
Last edited by cornernote on Thu Sep 27, 2012 07:36, edited 1 time in total.

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

would you mind if this was added to worldedit? that way i can add it to the worldedit gui, and we will have a gui for making mazes! =)

User avatar
Echo
Member
Posts: 122
Joined: Tue Jul 31, 2012 08:11
Location: Germany

by Echo » Post

WTFPL
So do whatever you want to. Remove the "closer-stone" and/or the "treasure-chest", make it braid or not. The algorithm wasn't invented by me, I read http://www.astrolog.org/labyrnth/algrithm.htm and tried to bring that to lua code.

Take it, change it, write your name over it. You have my blessing. :-)

Btw: Any problem understanding the code (although I commented very much for my standards), I try to explain in advance:

1. create an table/array in size of the maze with all set to "true" -> walls
2. choose a random start-point and check all possible directions (wall exists) and choose one of it randomly. That's your new position. If there is no more direction possible (dead-end), walk back the way you came from until you find a position where an other direction is possible (make junction).
3. Repeat step 2 until you had to go back to your start-point.
4. Dig a way in the maze from the opposite side of the maze until you reach a corridor. That's the exit.

Additions:
Floors: Added a check for up-/downstairs for possible directions in step 2 (and mark them to place ladders later)
Torches: Illuminate the corridors or let the player do the work (I found it more confusing for the player if there are already torches, because else you place a torch always on your right side and when you find your torch again, you know you were there before and you know from which direction you came from)
Braid-maze: Mark all dead-ends and try to open some after the creation is done. This prevents the "always keep right" method to find the way through the maze)
Treasure: Place a chest in a dead-end (and don't open that dead-end for braid-maze)
Closer-stone: A node on the start-point and the exit, that closes behind the player when he moves over it. So he has to find the exit.
Last edited by Echo on Thu Sep 27, 2012 08:22, edited 1 time in total.

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests