Page 1 of 1

[Mod] Hedge Maze [1.2] [maze]

PostPosted: Sat Sep 14, 2013 20:06
by thefamilygrog66
Description:
Here's a mod that is based on an old BASIC script that I used to play around with back in the early 1980s(!).

The player crafts a Maze Generating Block, which when right-clicked, opens an interactive form that allows the player to select wall and floor materials, as well as the width of the maze (odd numbers less than 93). Then the player left-clicks the Maze Generating Block and it randomly generates a 3-block high, hedge maze, complete with a start and finish.

Recipe:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Maze Generating Block

    +---------------+---------------+---------------+
    |     cactus    |     cactus    |     cactus    |
    +---------------+---------------+---------------+
    |     cactus    |               |     cactus    |
    +---------------+---------------+---------------+
    |  desert stone |  desert stone |  desert stone |
    +---------------+---------------+---------------+


Mod dependencies: default, wool

License:
Sourcecode: WTFPL
Graphics: WTFPL

Thanks to mauvebic for showing me how to replace goto statements with recursive functions, to make the mod work on linux servers as well.

Download:
https://github.com/thefamilygrog66/maze/archive/master.zip

Browse code on GitHub:
https://github.com/thefamilygrog66/maze

Screenshots:
Image
Maze Generating Block placed on the ground

Image
Menu to change settings, with defaults shown

Image
An aerial view of the default generated hedge maze (39x39 wool:dark_green walls and default:desert_stone floor)

Image
A treetop maze with default:leaves walls and default:tree floor

Image
Walls of default:ice with default:dirt_with_snow floor

Image
Hell maze, with default:obsidian walls and default:lava_source floor!

Image
The original BASIC program (for Commodore 64)

PostPosted: Sat Sep 14, 2013 20:20
by Mossmanikin
Very cool!

PostPosted: Sat Sep 14, 2013 20:24
by Casimir
With a downloadlink it would be even cooler.

PostPosted: Sat Sep 14, 2013 22:13
by Inocudom
It would be more interesting if these randomly generated in deserts.

PostPosted: Sat Sep 14, 2013 23:41
by mauvebic
Inocudom wrote:It would be more interesting if these randomly generated in deserts.


Possibly could use a different material depending on the biome: ice in snow biome, leaves in grassland, and cactus in desert?

PostPosted: Sun Sep 15, 2013 01:28
by paramat
^ Nice idea, could put default:tree in the ground to stop leaf decay, would be enough for 3 nodes height.
Good mod, ideal for naughty games in mansion gardens etc.

PostPosted: Sun Sep 15, 2013 02:07
by thefamilygrog66
Cool ideas guys, thanks. I'll try to incorporate a few of them in future versions.

I've finished working on it for now, and have uploaded it to GitHub - check out the first post for links!

PostPosted: Sun Sep 15, 2013 02:58
by Josh
Nice.
This could be added to a mansion, by a tennis court or swimming pool ingame.

PostPosted: Sun Sep 15, 2013 03:36
by paramat
Wow PEEK and POKE, i started progamming in BASIC in 1982 on a Sinclair ZX Spectrum 48K.

PostPosted: Sun Sep 15, 2013 04:11
by thefamilygrog66
paramat wrote:Wow PEEK and POKE, i started progamming in BASIC in 1982 on a Sinclair ZX Spectrum 48K.


Cool! I started at school in 1981 on a Commodore PET, and my first home computer was also a Sinclair - the Timex Sinclair 1000 (http://en.wikipedia.org/wiki/Timex_Sinclair_1000), before getting a Commodore 64. Good times!

PostPosted: Sun Sep 15, 2013 04:17
by ch98
maybe few different sized ones too.

PostPosted: Sun Sep 15, 2013 04:31
by paramat
Ah i didn't know you had a version of the ZX81 over there. Looks like you got a modified ZX Spectrum as a Timex Sinclair 2068. Unsurprisingly one of my favourite games was Jet Set Willy (platform game kids).

PostPosted: Sun Sep 15, 2013 06:06
by LionsDen
Wow, I'm not the only old fart on this forum. ;^P

I remember those days. :)

PostPosted: Sun Sep 15, 2013 15:50
by rubenwardy
Very nice.

PostPosted: Sun Sep 15, 2013 17:21
by hoodedice
Does this have a pathfinding code to ensure that mazes are solvable?

PostPosted: Mon Sep 16, 2013 14:48
by thefamilygrog66
Thanks for the comments - I'll have a new version on GitHub a bit later today, which will allow players to specify wall and floor materials, as well as maze size.

hoodedice wrote:Does this have a pathfinding code to ensure that mazes are solvable?


As long as the maze is an odd number of nodes wide - a rule that is enforced when the size is selected - the generating algorithm ensures that each corner is open, so there will always be a path from start to end.

PostPosted: Mon Sep 16, 2013 17:05
by hoodedice
hoodedice wrote:Does this have a pathfinding code to ensure that mazes are solvable?

As long as the maze is an odd number of nodes wide - a rule that is enforced when the size is selected - the generating algorithm ensures that each corner is open, so there will always be a path from start to end.


Sweet.

PostPosted: Tue Sep 17, 2013 19:18
by thefamilygrog66
I've just made a fairly major update: now the mod includes an interface menu in which the player can choose materials for the walls and floor, as well as the width of the maze (odd numbers, less than 100 blocks).

Enjoy!

PostPosted: Wed Sep 18, 2013 01:03
by Element
nice

PostPosted: Wed Sep 18, 2013 04:33
by paramat
Hell maze looks good you could have lava under glass as a floor to make it walkable.

PostPosted: Sat Sep 21, 2013 03:38
by thefamilygrog66
Just uploaded a new version which replaces the goto statements with recursive functions (thanks mauvebic!), so that the mod will also work on linux servers.

PostPosted: Sat Sep 21, 2013 08:36
by Bas080
Another maze mod:
https://forum.minetest.net/viewtopic.php?id=2814
This one has closing doors, torches and chests with items.

It's nice to see that it can be done differently.

PostPosted: Sat Sep 21, 2013 14:37
by thefamilygrog66
Bas080 wrote:Another maze mod:
https://forum.minetest.net/viewtopic.php?id=2814
This one has closing doors, torches and chests with items.

It's nice to see that it can be done differently.


Yeah, for sure - I saw that mod after I'd made my first version. Looks like it uses a different algorithm to generate the maze, but still very cool.