Procedural Maze Dungeon Generation

Enhance your game environment creation skills by learning to automate dungeon and maze generation with Unity & Blender.

Last updated 2022-01-10 | 4.8

- How to create modular models in blender that can snap together in Unity to form mazes and dungeons.
- A variety of maze creation algorithms from simple random crawlers to mathematically perfect mazes.
- How the scale
- orientation and position of a mesh from Blender can be imported into Unity and manipulated with code.

What you'll learn

How to create modular models in blender that can snap together in Unity to form mazes and dungeons.
A variety of maze creation algorithms from simple random crawlers to mathematically perfect mazes.
How the scale
orientation and position of a mesh from Blender can be imported into Unity and manipulated with code.

* Requirements

* Students should have a basic understanding of Blender and Unity.
* Students should be have a working knowledge of C#.

Description

Procedural generation in game development lends itself to the algorithmic generation of unique computer-created environments and gameplay experiences. The power is in its ability to automatically develop game content on the fly, reducing the amount of work required by the game designer. However, a lot of preparation by the programmers and artists is necessary for such a strategy to be implemented.  A thorough understanding of the role that both sides of the game development coin (of technical/logic and art/design) play in procedural generation is key for a successful implementation. In this course, Penny and Mike bring a unique experience to both programmers and artists alike and combine their skills and many years of industry and academic knowledge, to bring you a holistic learning experience in which you will find content and invaluable mastery.

This course uses Unity 2020.1 and Blender 2.9 and is Windows and Mac compatible.

Mike will start by teaching you how to model six separate modular meshes that can be put together perfectly to generate an entire maze. He will take you from there into building pieces for a dungeon, where each module is created with a smaller subset of models that can be mixed and matched to speed up your design workflow and production of game assets. You'll create a set of sewer pieces with pipework that snaps together to build a maze and later create the brickwork-textured elements to define a dungeon. Each model will be readied for use in Unity once completed.

Penny will lead you through numerous exercises in the Unity game engine that examine the logic that will snap modular model pieces together using the magic of geometry and mathematics to form an infinite array of maze and dungeon possibilities, worthy of any avid 3D game player. She will take the pieces you create with Mike in Blender and work through a variety of maze generation algorithms to show you the possibilities, from very random environments to perfect mazes that traverse an entire map. She will also work with you to create dungeons with a variety of rooms and interconnecting corridors before exploring multilevel maps, using the A* algorithm for pathfinding and selecting traversable subsets of a complete maze or dungeon.

By the end of this course, you will have a multidisciplinary toolkit of skills that will give you the advantage over others who are "just programmers" or "just artists". Understanding game development that tightly integrates both design and logic from this standpoint is critical to making you a valuable commodity in the job market or preparing you for running an indie operation.

What others are saying about Penny's courses:

  • I do like Penny de Byl's courses and way of teaching, they are much more specific than your average "master Unity" kind of courses and usually, you don't learn just the engine but also how things work behind the scenes. She's really amazing!

  • I've been coding for about 3 years and since purchasing Penny's "Animation", and "Procedural Terrain" courses, the excitement and fun have returned once again to my programming.

  • Penny and her team know their stuff and are just amazing in explaining everything, breaking it down. Most importantly she challenges you to do stuff on your own rather than just "spoon-feeding" you everything. Then she comes back and shows you one way of doing it. Just an amazing course!!!

What others are saying about Mike's courses:

  • I've used Blender for a number of years, but I'm a total novice next to Mikey and I've learned so very much from him here!

  • Mikey is an amazing teacher, I can't praise this course highly enough. Worth every penny.

  • Mikey is a talented, thorough, and clear instructor, and he knows how to make the student think 'for themselves', which is such a great experience.

Who this course is for:

  • Intermediate level students and game developers who want to extend their skill base into working with both art and code to create unique game worlds.

Course content

11 sections • 113 lectures

Introduction by Penny Preview 01:45

This is an introduction to Penny's part of the course.

Introduction by Mike Preview 01:43

This is an introduction to Mike's part of the course.

Need a Blender or Unity Refresher? Preview 00:08

This article provides links to free and short tutorials to give you an overview of Unity and Blender if you need a refresher course or are new to the software.

Join the H3D Student Community Preview 01:26

H3D has a bustling online student community.  Here's how to get involved.

FAQs Preview 00:14

Here's how to get the best experience from studying this course and answers to some popular student questions.

Defining a Modular Maze Preview 10:44

In this lecture students will generate a series of basic cubes that will act as the foundation of a maze.

Defining Walls and Corridors Preview 11:29

In this lecture we will create an underlying data structure to hold information about the organisation of the maze before any walls are constructed.

The Drunken Crawl Preview 14:31

In this lecture students will learn how to write a maze crawling algorithm that will ensure there is a continuous path from one end to the other.

Crawling Challenges Preview 11:01

In this video students will be given a number of challenges to help hone their crawler algorithm writing skills.

Placing a Border Wall Preview 11:44

In this lecture students will learn how to ensure there is a border around the entire maze as well as rescale and ready the maze for walking through with a character.

Exploring the Maze as a First Person Character Preview 05:29

In this lecture students will add a first person character into their environment to explore their maze from ground level.

Counting Neighbours Preview 09:26

In this lecture students will create helper methods that will assist the maze generation algorithms.

Randomised Prims Algorithm Preview 11:17

In this lecture students will be introduced to the Randomised Prims Algorithm that creates a perfect maze within the entire space supplied to it.

Wilson's Maze Generator Part 1 Preview 14:21

In this lecture students will learn about Wilson's maze generation algorithm and start developing the code for it.

Wilson's Maze Generator Part 2 Preview 14:12

In this lecture students will learn how to determine if a random crawler has found part of the maze.

Wilson's Maze Generator Part 3 Preview 16:19

In this lecture students will discover how to better the algorithm to add multiple walkers and control the starting positions.

Wilson's Maze Generator Part 4 Preview 06:45

In this video we troubleshoot the code to determine why rooms are still being created and finalise the Wilson's algorithm.

Recursive Depth First Search Maze Part 1 Preview 13:16

In this lectures students will learn about the use of recursion for generating maze cells.

Recursive Depth First Search Maze Part 2 Preview 17:18

In this lecture students will finish the recursive maze generation algorithm by randomising the directions chosen for carving the corridors.

Introduction To The Maze Section Preview 01:04

In this lecture Mike introduces the section ahead, giving an overview of what is coming up next.

What Is Modular Anyway? Preview 02:08

In this lecture, we discuss what modular means when it comes to putting together pieces using algorithms.

Planning Your Pieces - On Paper Preview 12:21

In this lecture, we ditch the computer for a moment and quickly work out the basic minimum pieces we are going to need to make a modular system.

Setting Up Blender And Add-Ons Preview 04:06

In this lecture, we get Blender setup for everything moving forward in the course.

Origins and Auto Mirror Preview 10:24

In this lecture, we discuss the origin of an object and how it affects many things, including the mirror modifier.

Watching For Incorrect Normals Preview 11:01

In this lecture, we see that Blender is great at hiding incorrect normals, this, however, is a big issue when exporting models so we look at way of exposing incorrect normals.

Mid-Section Challenge Preview 07:12

In this lecture, we have the challenge to make the final 3 pieces of our modular set.

Export and Test in Unity Preview 09:36

In this lecture, we export out models from Blender into Unity and look at the multiple processed to do this.

Scripting To Speed Up Export Preview 08:27

In this lecture,  we export again, but this time using a script demonstrating the power of using scripting in Blender to automate tasks.

Reference Material Preview 05:55

In this lecture,  we go and grab some reference material- really important when making any assets.

Level Of Detail Overview Preview 14:13

In this lecture,  we look at how to balance a scene so that it is readable and has an overall balance of detail.

Medium Detail - Watch Your Time Preview 14:58

In this lecture,  we add some medium-level detail to our scene.

Fixing Shading And Adding Materials Preview 15:29

In this lecture,  we look at a common shading issue and add materials to our models.

Managing Material Imports Preview 14:38

In this lecture,  we look at how materials come across into Unity and what to watch out for.

Basic Pipeline Overview Preview 05:40

In this lecture,  we step back and have a look at the overall pipeline now we have some experience with the process.

Adding More Details Preview 23:17

In this lecture, we add more details to our environment, with an eye on more assets taking additional time.

Making A Light Preview 13:02

In this lecture, we add some light to our scene.

The Maze Section Wrap Up Preview 00:44

In this lecture, Mike wraps up the section and encourages you to share your mazes.

Preparing Models for Placement Preview 12:59

In this lecture students will learn how to prepare the FBX models they created in Blender and ready them for use in Unity and the maze generator.

Placing a Piece with Code Preview 17:06

In this lecture students will learn how to programmatically add a model to the maze in the correct location.

Wildcard Piece Placement Patterns Preview 08:56

In this lecture students will learn how to add wildcards into their pattern matching algorithm for positioning maze pieces.

Patterns and Placement for All Pieces Preview 13:31

In this lecture students will review the patterns required for matching each model to the required area on the maze as well as look at rotating the pieces correctly.

Starting Positions for the Player Character Preview 09:32

In this lecture students will be challenged to find a way to place the player character inside the maze.  They will also examine how to light the environment by creating a torch for their character.

Introduction To The Dungeon Section Preview 01:03

In this lecture, Mike introduces the next section and overviews what we will be doing.

Material Overview Preview 06:25

In this lecture,  we look at the difference between the Blender and Unity material systems and why materials don't always come across as expected.

Texture Type Overview Preview 10:22

In this lecture,  we have a look at the various map types and what they are used for.

Lighting Your Scene With An HDRI Preview 08:08

In this lecture,  we use a HDRI in order to light our scene and models better.

Importing An Image As A Plane Preview 12:57

In this lecture, we import an image and apply it to a plane quickly use a built in add-on.

Exporting With Textures Preview 08:22

In this lecture,  we look at how you would export a model with the texture baked into the file.

Blocking Out Your Pieces Preview 15:47

In this lecture,  we block out the scene we are going to make and make sure everything fits together as expected.

Fixing Issues Now Not Later Preview 07:33

In this lecture,  we fix an issue with or scene- it is often more productive to fix issues when they are spotted rather than leaving the issue.

Testing Our Test Pieces Preview 10:31

In this lecture,  we export out pieces and text them in Unity.

Making The Pillar Preview 06:47

In this lecture,  we make a pillar, and place it so we can use it across all of our areas.

Adding Wall Detail Preview 06:43

In this lecture, we add addition detail to the wall to help separate it from its surroundings.

Adding Detail To The Other Pieces Preview 13:01

In this lecture,  we continue adding further detail to our scene.

Looking At Everything Together Preview 13:19

In this lecture, we put all of our pieces together and make sure they flow.

UV Mapping Overview Preview 10:03

In this lecture, we have a look at what UV mapping is and why we need it.

Unwrapping An Open Mesh Preview 16:28

In this lecture, we unwrap our first model in the course, focusing on an easier open mesh.

Unwrapping A Closed Mesh Preview 17:00

In this lecture, we tackle our first closed mesh and mark seams allow up to effectively flatten the mesh.

Mirroring And Pinning UV's Preview 17:09

In this lecture, we look at the benefits and drawbacks of mirroring a UV map and pinning vertices of a UV map.

Unwrapping The Rest Of The Scene Preview 09:19

In this lecture, you are challenged to unwrap the rest of our models.

Making The Vault Roof Piece Preview 12:55

In this lecture, we look at techniques to make a vaulted roof, which at first glance is a reasonably complex structure.

Export, Testing And Fixing Preview 16:04

In this lecture, we export our updated models and test them thoroughly, making notes of fixes required and then applying those fixes.

Making A Victorian Lamp Preview 18:21

In this lecture, we need to see in our world so we create a lamp that suits the environment.

Additional Ceiling Pieces Preview 12:21

In this lecture, we notice that in order to make larger rooms we need some additional roof/ceiling pieces for that to work.

Ceiling Pieces Challenge Preview 14:00

In this lecture, we finish off the ceiling pieces through a challenge.

Checking, Naming and Exporting Preview 12:38

In this lecture, we finalise the work we have done and make sure each piece is named correctly, in the right collect and ready for export.

End Of The Dungeon Section Preview 00:52

In this lecture, Mike wraps up the section and encourages you to show off your version of the dungeon.

Replacing Pieces Preview 13:46

In this lecture students will practice changing the module maze pieces for a different set and have to deal with scaling, rotation and lighting issues.

Making Rooms Preview 07:57

In this lecture students will learn how to create rooms that will turn their maze into a dungeon.

Defining Modular Room Pieces Preview 10:12

In this lecture students will learn how to orient and place individual room pieces of floors, walls, ceilings and doors to build the representation of a space larger than a single spaced corridor.

Placing Room Pieces Preview 09:37

In this lecture students will examine the patterns required to place floor and ceiling pieces into large room areas within the map.

Placing Walls Preview 11:26

In this lecture students will learn how to place single walls into rooms to match up with floor and ceiling pieces.

Creating Pillars and Doorways Preview 15:08

In this lecture, we add some extra pieces that we need when making our world.

Importing New Pillars & Doorways Preview 13:53

In this lecture students will bring newly created models into Unity to act as mechanisms to hide any breaks in the map.

Positioning Pillars Preview 09:51

In this lecture students will take a closer look at the locations of where pillars should appear.

More Pillar Positioning Preview 09:20

In this lecture students will be challenged to place the other pillars into the dungeon to complete the hiding of outer corners.

Tracking Pillar Placement Preview 07:02

In this lecture students will work to detect duplicate pillars and ensure they aren't added to the dungeon.

Adding Doorways Preview 11:15

In this lecture students will be challenged to place doorways between rooms and corridors.

Z-Fighting Preview 09:18

In this lecture students will learn about Z-Fighting and what causes it.  They will also examine a couple of ways to fix it.

Labelling Map Modules Part 1 Preview 13:08

In this lecture students will learn how to create a matrix to store the piece types that have been placed into a maze or dungeon.

Labelling Map Modules Part 2 Preview 09:59

In this lecture students will use the labelled piece types matrix to place doorway arches in the correct place.

Refactoring Code for Plug & Play Modules Preview 09:29

In this lecture students will quickly refactor the maze class to allow for the storing of the modular piece rotations.

Creating Manholes Part 1 Preview 11:35

In this lecture, we create a connection between multiple levels with a simple ladder descent.

Creating Manholes Part 2 Preview 12:08

In this lecture, you are challenged to create another connection between levels.

Creating Stairwells Part 1 Preview 11:59

In this lecture, we block out a stairwell for our dungeon pieces.

Creating Stairwells Part 2 Preview 30:21

In this lecture, you are challenged to finish off the stairwell in a slightly longer than normal video.

Generating Multiple Maze Levels Preview 14:34

In this lecture students will learn how to create equidistant maze levels that can later be linked by a manhole model with a ladder.

Building a Maze Manager Preview 13:15

In this lecture students will learn how to manage the multiple maze levels by adding a maze manager and the manhole pieces will be readied for use.

Placing Manholes between Levels Preview 14:36

In this lecture students will learn how to add the manhole models into the multilevel mazes to connect them.

Extending Level Connections for All Levels Preview 10:01

In this lecture students will learn how to extend the matching of manhole pieces to work with all levels of a multilevel maze.

Multi-storey Dungeon Challenge Preview 19:13

In this lecture students will learn how to add a complex stairwell to multilevel dungeons.

Preparing to Offset a Maze Preview 11:54

In this lecture students will learn how to apply offsets to mazes to have the entire level shift in the x and z to allow pieces above and below to match for adding stairs.

Calculating Maze Offsets Preview 19:28

In this lecture students will learn how to adjust the x and z position of an entire maze to line up connecting vertical pieces such as stairs.

The A* Pathfinding Algorithm Part 1 Preview 15:04

In this lecture students will learn about the concepts behind the A* algorithm and take an in-depth look at its inner workings.

The A* Pathfinding Algorithm Part 2 Preview 10:34

In this lecture students will write some preliminary code to get their project ready for the dedicated A* method.

The A* Pathfinding Algorithm Part 3 Preview 16:12

In this lecture students will begin writing the A* algorithm by creating a start and goal location as well as marking them inside a maze.

The A* Pathfinding Algorithm Part 4 Preview 19:14

In this lecture students will complete most of the code focused on running the A* algorithms logic.

The A* Pathfinding Algorithm Part 5 Preview 12:11

In this lecture students will finalise their A* code project and find the final path between the start and the end markers.

A* Corridor Challenge Preview 07:31

In this video students will be challenged to turn their A * paths into maze corridors.

Corridors Between Mazes Preview 14:58

In this lecture students will be challenged to integrate corridors into the multilevel dungeon project.

More Stairs Preview 09:05

In this lecture students will learn how to add in more than one type of stair placement conditions and to use the existing stair well with 4 different rotations.

Brute Force Stairwell Placement Part 1 Preview 12:12

In this lecture students will learn how to purposely place corridors in a maze or corridor to force the placement of matching stairwell pieces.

Brute Force Stairwell Placement Part 2 Preview 11:25

In this lecture students will complete the code to ensure each dungeon, maze and corridor level will be connected with stairs.

Final Project Part 1 Preview 03:25

In this lecture students will be challenged to create their own multilevel environment that is a mixture of dungeons and corridors.

Final Project Part 2 Preview 07:27

In this lecture students will be challenged to add lights to the straight sections of the maps.

Final Project Part 3 Preview 07:15

In this lecture students will be challenged to place lights on every second straight piece instead of every straight piece.

Final Project Part 4 Preview 12:12

In this lecture students will be challenged to place random artefacts around their maps based on a chance of appearance and model piece type.

Final Project Part 5 Preview 11:15

In this lecture students will learn how to put in a teleport that can take the player character instantly from one location to another throughout the levelled environment.

Final Project Part 6 Preview 12:53

In this lecture students will begin setting up the maze code ready to calculate a path from the player's position to the exit point.

Final Project Part 7 Preview 15:51

In this lecture students will add new methods to the AStar path algorithm code to allow the first person character to calculate a path to the exit.

Final Project Part 8 Preview 13:00

In this lecture students will complete their project by creating a waypoint system out of the AStar path for the particles to travel along.

Some Final Words from Penny Preview 01:58

In this video Penny provides a few final words to finish off the course and suggest future studies.

Where to now? Preview 11:16

Where you should take your game development learning journey next.