SaxonRahs Tutorial Thread - Random Maze Generation & Solving

SaxonRah - many thanks for this!

I’m working on generated dungeon game where the dungeon is generating before game starts (like rogue like games) and I’ve a problem with lighting. Do you have any idea how to generate dungeon with static lighting? It’s possible?

Hey im sorry i missed this, what i would do is set up some maze construction variables so they are in your h/cpp files and then expose them to blueprint and use them in blueprint and use the genmaze blueprint function in the construction script

i THINK that will create a maze that can have static lighting. im like 95% sure if it doesn’t work or you don’t understand me ill help you figure it out :slight_smile:

EDIT oh yeah doesn’t work anymore. im not sure why, i just tested it. ill get back to you in a littlewhile

EDIT TWO: RIGHT! its because its trying to spawn actors instead of adding child actors to itself ~!
sooooo let me try something and ill update

Darn. i forgot exactly what project the static level is in, you’ll have to excuse me for a moment i need to do some project clean up so i can find thing, i have like 90 projects lol

I’ve made a UE Project and uploaded the code on GitHub in-case anyone is having trouble running the sample: GitHub - robertsmieja/UE4-Maze: An Unreal Engine 4.23 project for the code sample provided at https://forums.unrealengine.com/showthread.php?47-SaxonRahs-Tutorial-Thread-Random-Maze-Generation-amp-Solving

is going to help a lot for my own project, thanks. :slight_smile:

Would it be possible to make into a Blueprint that I can drag out into the world and have it randomly generate the map instead of on play??

[=SeanG1987;138062]
Would it be possible to make into a Blueprint that I can drag out into the world and have it randomly generate the map instead of on play??
[/]
Of course its possible. The question is who going to take the challenge to create the Blueprints?

For me the whole maze/dungeon generator seems like a perfect item for the marketplace…

SaxonRah?! :slight_smile:

[=SeanG1987;138062]
Would it be possible to make into a Blueprint that I can drag out into the world and have it randomly generate the map instead of on play??
[/]

Like so it is static ? You can do that, just transcribe the code i have written into blueprint nodes and jam it into the construction script. it should be super simple. if you can’t do it come back and post here where you got stuck. i’ll help you through it.

[=btengelh;138753]
For me the whole maze/dungeon generator seems like a perfect item for the marketplace…

SaxonRah?! :slight_smile:
[/]
It’s on my ‘Finish Or Else’ todo list, i have a semi working plugin for it but currently the marketplace is content only. Epic said in the future they want to support plugins but are delaying it for whatever reasons, hopefully they will get everything sorted and update the marketplace soon!

[=robber9000;110116]
I’ve made a UE Project and uploaded the code on GitHub in-case anyone is having trouble running the sample: GitHub - robertsmieja/UE4-Maze: An Unreal Engine 4.23 project for the code sample provided at https://forums.unrealengine.com/showthread.php?47-SaxonRahs-Tutorial-Thread-Random-Maze-Generation-amp-Solving

is going to help a lot for my own project, thanks. :slight_smile:
[/]

Many thanks for that robber9000! and thanks SaxonRah - looking forward to your coming full feature plugin!

so thanks for that robber9000 and SaxonRah …
Please tell me how it works?

[=shahab361;229804]
so thanks for that robber9000 and SaxonRah …
Please tell me how it works?
[/]

maze.png&stc=1

Generate a square of n * m
outline the square perimeter in walls
fill ever other floor tile as a wall tile in n and in m avoiding the perimeters
go from each wall inside the perimeter and select a random direction
Change floor to wall where direction was selected.

Hey; I’ve been searching for a good maze generation tutorial and saw that one was well explained. I took an actor time and set the original logic so nothing would produce cutoff portions. It almost works; for a square of rand() with no seed value (I put in a seed value to play with for different variations), it works fine. However, anything with a different seed almost always cuts the end off, and anything that’s not a square produces the same problem.

I’m also wondering how you might be able to attach the maze itself to an object in the game upon BeginPlay, instead of having the maze always start at (0, 0). I’m currently trying to see what method will properly attach and relocate each actor based on a relative location instead of spawning it directly in the scene.

I am lost on something, is there a way to access 2D array in a Blueprint? is in reply to ramas 2D array.

Hey guys, I followed the tutorial and the code mentioned in the github project. I couldn’t view the blueprints since I’m using 4.16. Anyways, for the block tile BP, I’m using the 400x400 version of Shape_Wall static mesh. It seems like with asset, the thickness looks weird. It’s almost flat. Just wanted to make sure if is only an issue in the asset transforms and nothing related to the displaying of the maze. I have attached the screenshot of the 19x19 maze I generated.

looks great and perfect for a project I’ve been meaning to start/finish for ages!

any got a downloadable file to share?