How to Procedurally Generate a Perfect Maze (Unity Tutorial)

preview_player
Показать описание
In this tutorial we're going to look at how to procedurally generate a perfect maze.

The project files are available to our patrons here:

The final script can be found here

Help support our work:

Follow us:

Introduction - 0:00
Explanation of the Maze Generator Algorithm - 00:11
Creating the Project - 01:00
Creating the Maze Cell Prefab - 02:08
Implementing the Maze Generator Algorithm - 09:05
Summary - 22:06

#KetraGames #LearnUnity #UnityTutorials #UnityTips
Рекомендации по теме
Комментарии
Автор

This is a fantastic channel, and your talent for explaining how and why things work is truly remarkable. I sincerely hope that you will continue to produce more videos like this one for our community. Your contributions are highly valued and appreciated.

Ma_cieK
Автор

Wow I needed a way to create an array of buttons, just the way you created the array of Maze cells, this is incredible timing! Thank you so much for this

mrBN
Автор

Wow the best tutorial about this subject! Thanks a lot for this video! It’s better than many complete courses that I’ve seen.

marcoseliasmep
Автор

Super excited to see another upload, can't wait to watch the whole thing 😊

HandsOnKnowledge
Автор

This is fantastic and your channel is a gem this is exactly what I and many others needed to start to learn procedural generation

ld
Автор

This is interesting! I'm working on a top down shooter with a random generated city, so this can come in handy

runjimrun
Автор

Thanks Ketra!
I always wondered how mazes were created in software.

gazzer
Автор

That's awesome. I wanted to learn about maze algo.

ItachiX
Автор

This is nice. However, this method tends to create a single long main path with relatively short side branches.
To prevent that, you can iterate over a shuffled queue of all cells with unvisited neighbors instead.
In addition; at the end of the process, you can knock down a couple extra walls at random to create loops and overall a less straightforward to solve maze.

weckar
Автор

to those asking implement entrance/ exit to the maze you can garb all the outer walls as such
//if x=0 first row get the leftwall
//if x==row-1 last row get the rytwall
//if z=0 first colunm get the backwall
//if z=cols-1 first colunm get the frontkwall
add them to a list an perhaps find an index and clear 2 walls for entrance n exit
x, and z being the index of the cell row and colums being the width and the depth as per this tutorial

yours_indie_game_dev
Автор

I'm here after watching GamesofVab video😂

Aadtya__
Автор

Great tutorial!But I want to ask
there is way to make a maze entrance and exit?

zeshufuno
Автор

Wonderfully done! ♥ Might I suggest an addition to this system, wherein we can set a number of larger prefab rooms that get dropped into the maze (for enemy spawns, treasure, etc.)? Or would that be much too complicated?

Wrldbuilder
Автор

Never mind I got it.
For anyone who wants to know:
Create a variable inside your mazecell script to store the number of active walls of that cell. Now in the maze generator script fetch all the cells who have only 3 active walls, as dead end cells are the only cells with 3 active walls.

ButterDog
Автор

Great tutorial! please upgrade this to First Person or Third Person maze escape with minimap

AlaaMasalmeh
Автор

What is this best way to create this maze on a Coordinate that is not 0, 0, 0?
as example: I want to have two different mazes in the 3D Platforming Tutorial for the Player to run through.

mostlyreal
Автор

Thank you for the tutorial but how can i increase the dead ends (if possible)

umittadelen
Автор

please help, how to scale 2x the maze cell?

CarsNCrew
Автор

Hi, great tutorial!
One question I have is how would you make it so that the maze is spawns at a determined position rather than (0, 0, 0)?

CongTuSoi
Автор

How we can spawn collectibles within the maze path at every scene load?

How about enemy ? Can we do path finding within the maze path?

SyedHammadZada
join shbcf.ru