I know this is a relatively old tutorial so I wanted to drop a comment to let you know your work is still being immensely appreciated! I have been ripping my hair out for the last week trying to figure out how to generate my dungeon! the way you explain things makes it so easy to see how it applies to my own project! so amazing job!
You can make a giant maze by only making rooms as you come to them. The same way as minecraft is creating terrain. I would prefer in code to refer to North, South, East, West instead of Up, Down, Left, Right. Your ideas is something I will look at :) thank you
Hey, did you manage to add keys and locks like in Runescape? If so, how'd you tackle the key and lock generation? I'm working on something inspired by the same system
This is a really nice tutorial. I'm starting my journey into Unity and the dungeon generation is a thing I really wanted to do. Thanks for sharing this !
coding beginner here👋 I am getting this , you are good at explaining stuff, thank you. Please cosider covering how to spawn monsters in the dungeon and the combat as well.
impressive. I was looking at GTFO rundowns and how the team at 10 chambers does it. Can't find anything but this will help in understanding the algorithm. Thanks.
Great tuturial. Btw you could likely have simplified this with a twodimensional array instead of a long list. var board[ , ] = new Cell[width,height]; and access each cell using board[x,y]
I am not expecting to get a reply as this video is 8 months old but I am getting the error: ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Thank you in advance
did you put a stop for the 'for' loop ? if not that there could be a mistype on the Index condition -note: I'm a complete beginner on C# but a similar problem happened to me too ,and that's how I fixed it
This was really helpful! I'm very new to programming and all this stuff, so I wanted to ask, Is there a way to make that the rooms that are generated to be randomly chosen to generate between different prefabs of rooms? so that the rooms don't look all the same? If so, I also would like to ask, how can I make that the last room can contain a boss, but not on the other rooms, or for example, how can I have enemies in each room except the starting one?
Hey, the code is working well but, after implementing the last thing instead of a nice shape dungeon, mine is just a strait line with 2 rooms width, pls help me!
How can i get the possition of the fathest or the last generated cell?, i want to create an exit. And also, how can i get a random position of a cell?, to spawn a key in a random cell that you need to open the exit.
I'd like to apply Keys and Locks to this, but i'm having troubles figuring out the way the room order is specified. I need to make sure that all locks can be unlocked by obtaining their key before reaching the point where the lock is. So if the locked room is room no. 12 the key would have to be in any room before that. Have you got any application of this?
Is there a way to make it spawn in all different door directions? Like, have a starting room with 4 doors, they then branch off into a random direction for a certain amount of rooms.
is there a way to do something like this built with all rooms being prebuilt? like instead of them all using the same room asset, with the doors toggled
I thought a little about this, and unsure if it would work but theoretically you could have an array of room prefabs that are prebuilt and then when instantiate is called in the MapGeneration Function, have it randomly choose a number corresponding to the index of one of the random rooms in the array of prefabs you made.
I have tried to find out how c# works, and im very familiar with the basics, but there are no videos explaining anything above that. Im really interested in finded out what that i means and what it does. Do you know any videos that explain this well?
Hey, I'd advise you to look into basics and more advanced programming concepts and maybe just search the concept+ c# and you'll probably find what you want to learn. Solving problems are also a great way to learn and there are many platforms out there for that.
Hello i'm pretty new to unity, i already did a simple 2d plateformer to see how it works in general. Now i'm trying to follow your tutorial, i have some issues : When i'm putting the different kind of grounds in the "empty object", they all appears in the main window, the game one, how to avoid this ? When you are creating your rooms, it seems that you are copy/paste each floors, walls, etc and they all automaticaly put close to each other, i dont have the same and just for the grounds parts, they are in random places. How to fix it ? Thanks !
So, when you're adding different types of ground to that "empty object," they're unexpectedly showing up in the main game view, right? It might be because you accidentally dragged them from the hierarchy panel directly into the scene or game view. To avoid this, make sure you're arranging everything within the scene view itself. If you want to prevent accidental movements, you can lock or hide layers that you're not currently working with. In the tutorial, you're seeing that the floors and walls are being copy-pasted and automatically placed close to each other to form rooms. But when you're trying this, things are ending up in random places, especially with the ground parts. This could be due to the pivot points of your objects or how they're aligning. Take a moment to check where the pivot point is on your objects - that's the point they rotate or scale from. If it's off, it could lead to unexpected placements when you copy-paste. You might need to adjust the pivot point or use snapping settings to make sure everything lines up properly. How to Fix It: Always work within the Scene View when arranging and duplicating objects to have better control. Keep an eye on the pivot point of your objects - it's like their anchor point. If it's not where you want it, things might get wonky when you copy-paste. Adjust it if needed, or use the snapping feature to help align things to the grid. Remember, Unity has a learning curve, especially when you're just getting started. It's normal to run into these hiccups, but with a bit of practice, you'll get the hang of it.
Does this generator generate a completely random dungeon everytime? or does it generate the dungeon with a single pattern? If it generates it randomly can I make it so that it generates it in a single pattern everytime?
I want to add a pillar in the middle of the room if all the doors are open in that particular room. there is only one pillar, it's always in the center. Please help, i'm basically an absolute beginner with C#. I'm also having another issue. I Finished the Room behavior script, attached it to the room, made the empy object (Generator), got the dungeon generator script from github, pasted it there, attached it to the empty object, and it is saying this error: "Assets\Scripts\DungeonGenerator.cs(90, 161): error CS0246: The type or namespace name 'RoomBehavior' could not be found (are you missing a using directive or an assembly reference?)" Thank you if you at least try to help.
It's probably just a difference in spelling, mine is "RoomBehaviour" and yours is "RoomBehavior" so when you imported the script it has my spelling. To spawn the pillar in the middle you can create a pillar prefab, get a reference for it on the RoomBehaviour and check if all the doors are open, if they are you can use Instantiate to spawn.
hello! thank you for your video. i am trying to use it a year later, and the line: var newRoom = Instantiate(room, new Vector3(i*offset.x,0,j*offset.y), Quaternion.identity, transform).GetComponent; is returning this error: CS8773 Feature 'inferred delegate type' is not available in C# 9.0. Please use language version 10.0 or greater. Does anyone know how to fix this? Thank you in advance!
Never forget to add your parentheses when you call a method, in your case "GetComponent" -> var newRoom = Instantiate(room, new Vector3(i*offset.x,0,j*offset.y), Quaternion.identity, transform).GetComponent();
Hey there! im running into an issue where my game is infinitely generating without stop and eventually crashes due to lack of memory -- any idea what could be causing this?
You're calling the function infinitely. Check where you're calling it, it shouldn't be on update, if you're using a while function, that could be your problem. Just make sure that you don't have a never ending loop calling the function.
Would it be possible to change the roombehaviour script to destroy the wall or door instead of disabling it? I want to do this because of it causing possible conflicts with how i want to do dynamic occlusion culling so as to get larger size dungeons to not lag as much.
@@SilverlyBee so instead of doors[i].SetActive(status[i]); walls[i].SetActive(!status[i]); i should do this instead? doors[i].Destroy(); walls[i].Destroy(); (and also a big thanks for the quick reaction)
It is possible but requires an additional package for it to work as there isn't a default way to calculate NavMesh at runtime. The previous comment wont work due to the NavMesh being broken off in each room which means the character cant go from room to room through the doors.
Hey, maybe in the future I'll make something of the sort (I have no plans though), but it would just be adding a 3rd dimension and 2 more neighbors to each cell. It wouldn't be that hard to expand on that
Yes! You can even write conditions where there isn't a doorframe to another room, and not even a wall, giving the illusion of a longer corridor room, but this involves a bit more Coding. Imagine the rooms as some Tiles. And from there, let your mind go free.
Great tutorial! Everything is good but there is a problem that I am suck on. Whenever I generate the dungeon the entrances arent in the right places and some rooms have doors and walls enabled at the same time. I downloaded the scripts from the github and followed every step and even watched the video twice but I have still not found the issue. Any help would be much appreciated. Thanks!
@@SilverlyBee Thanks for the help but I looked over all the doors and walls and they are in the right slots in the RoomBehaviour script. When I ran the game all of the rooms were still facing the wrong directions and for some of them the doors and walls still were both enabled at the same time. For example in one of the cells the door enabled should have been the Up door but instead the Right door was enabled. I have no idea why this is happening but thanks for trying to help
Having the same issue. Wrote all scripts to develop more practice, the room board works, but the doors / walls both spawn. So I went back and copied from GitHub. Part of the fix for me has been to fix the prefab. Make sure the prefab you're spawning in, is working and the transforms are reset before prefabbing. Additionally, when I wrote back in the debug status in RoomBehaviour, then tried and tested it out. I disabled the status and the rooms finally generated.
I initially just went along with the video, but for some reason had the problem that there was indeed a full grid, but the entrances were facing outside so that I can fall off into the void. Then I copied the code from the description and now all of a sudden the entrances are still facing outside, but also now it's not in a grid and there's absolutely no possible way to get from one room to another.
Which version of Visual Studio are you using? My code coloring looks different than yours, and it's driving me nuts. I recently upgraded to VS Community 2022 and that could be the reason the code coloring is different.
@@SilverlyBee Thank you - Great tutorial. It was exactly what I needed to get me over the procedural generation hump. Keep up the great work you've won a new sub.
It's because I'm using a single array (1 dimension) to work with the cells. If you want to, you can use multidimension arrays to make it more intuitive.
@@SilverlyBee ummmm the dungeon generator(script) component, that has a rooms that u can drag room prefabs into it right, but my one can’t drag anything into the rooms.😂
Thanks. Dungeon generation is a neat topic. BTW why not use Vector2Int instead to avoid those int conversions? Also one thing about those dungeon room models. I understand this tutorial is mostly about explaining and visualizing an algorithm, but in real world use those overlapping walls would be not ok.
@@bigblue489 Nothing prevents you from doing it. My point was pointing out a technical choice. You'll run into problems when two set of faces overlap exactly facing the same direction... you'll get z-fighting and it also is waste of geometry and causes overdraw. In this case there is no point having 4 walls on each cell (unless using half walls). You also seem to assume I made a comment not knowing about this being for games... but this is a channel about game dev. I have no idea why you assume something like that.
Hey, Vector2Int is a good alternative. As for overlapping walls, the tutorial was meant to be as simple and easy as possible. The overlapping walls/doors would have to be fixed for a bigger game and there are many alternatives for fixing it (from checking collision/distance to using a single generator to create the walls and doors). The tutorial is meant to be taken as the basis to build your own. The focus would be the relations between each room (the grid/board of cells), since I believe someone would be using a different type of room I decided to leave the walls as is. I'm currently making a video expanding a bit on this sort of dungeon, if you'd like I could include a section about how to clear the overlapping walls.
@@SilverlyBee Thanks for the reply. Like I said "I understand this tutorial is mostly about explaining and visualizing an algorithm". Really liked the use use 2D to 1D conversion of the grid data. I've used similar 1D array system myself but those border column rules were pretty ugly in my solution. I've personally used old school west/south facing wall setup, but I wouldn't mind seeing another take on wall placement, not too many videos on that topic, could be interesting!
@@322ss Yeah, the south/west could be a solution but in the case of the video you'd also have to create the east/north border walls. If it were a 2d dungeon (top down) you'd have to increase the space between the rooms and use a "bridge". I'll probably use a generator to create the walls, since the rooms follow a similar pattern. These 2d to 1d conversions can be quite challenging, if I ever use it again in a tutorial I'll try to explain it a little better, I feel like I went a bit fast on this one.
@@SilverlyBee i have a room that doesn't have any doors to open. it's okay if I don't write the door element in your script ?. I'm afraid that it when I will finish the entire script and go be to unity, it might say that there's gonna be an error where I didn't assigned an object to the door component. So for the final question: I have a room that doesn't have any doors, just walls, I am worried about messing up with the code because your script has is focused on a room that has a door. What am I supposed to do. Thanks for reading this and hopefully I will find the solution! Thanks!
I know this is a relatively old tutorial so I wanted to drop a comment to let you know your work is still being immensely appreciated! I have been ripping my hair out for the last week trying to figure out how to generate my dungeon! the way you explain things makes it so easy to see how it applies to my own project! so amazing job!
You can make a giant maze by only making rooms as you come to them. The same way as minecraft is creating terrain. I would prefer in code to refer to North, South, East, West instead of Up, Down, Left, Right. Your ideas is something I will look at :) thank you
You sure can! :D
man this really inspired me to generate dungeons like in Runescape. It's going pretty well. thanks for the guide.
Good luck on your project!
Hey, did you manage to add keys and locks like in Runescape? If so, how'd you tackle the key and lock generation? I'm working on something inspired by the same system
This is a really nice tutorial.
I'm starting my journey into Unity and the dungeon generation is a thing I really wanted to do. Thanks for sharing this !
Effective, concise and clear. 10/10 tutorial
coding beginner here👋 I am getting this , you are good at explaining stuff, thank you. Please cosider covering how to spawn monsters in the dungeon and the combat as well.
Well that was pretty awesome. Thanks so much for a clear description.
Going to be using this an academic project. Thank you so much for sharing this, you are a real life saver.
impressive. I was looking at GTFO rundowns and how the team at 10 chambers does it. Can't find anything but this will help in understanding the algorithm. Thanks.
Great tuturial. Btw you could likely have simplified this with a twodimensional array instead of a long list. var board[ , ] = new Cell[width,height]; and access each cell using board[x,y]
I prefer working with one dimension arrays, but multidimension arrays can be just as valid. If it's working for you, it sounds great! :D
Loved the tutorial, this channel deserves more subs.❤
I failed to do this (my algorithm sucks ) but I will try again in a month, I must get good :). Thanks for the excellent tutorial
Busque por muchos lados este tutoria....es el mejor...
Thanks!
This is great! Waiting for part 2!
To do it in 2d you just replace the 3d objects of the walls and doors... with sprites, from there the code is the same
thanks i'm using this to create a game about The Backrooms
Hey hey that’s what I was thinking of doing!
@@ahoksure pretty sure many people searching for this were
Sounds great! I hadn't heard of it, I'll take a look into it though!
@@SilverlyBee It's interesting :)
omfg thats what i also wanted to do
Your tutorials are really great
Thanks! Glad you liked it :D
@@SilverlyBee keep it up👍🏻👍🏻
She’s programmed so much that she’s learned to program her entire voice box.
In C#
In unity
In VS2019.
I wish lol
Thank you! Looking forward to more :)
Glad you liked it! :D
Also, how can you generate different looking rooms? (instead of just the same one) Thanks again!
@@lowbrown4206 Hey, that's exactly what I'll be covering on the next one! Basically I use a GameObject array and randomly select one.
I am not expecting to get a reply as this video is 8 months old but I am getting the error:
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Thank you in advance
did you put a stop for the 'for' loop ? if not that there could be a mistype on the Index condition -note: I'm a complete beginner on C# but a similar problem happened to me too ,and that's how I fixed it
This was really helpful! I'm very new to programming and all this stuff, so I wanted to ask, Is there a way to make that the rooms that are generated to be randomly chosen to generate between different prefabs of rooms? so that the rooms don't look all the same?
If so, I also would like to ask, how can I make that the last room can contain a boss, but not on the other rooms, or for example, how can I have enemies in each room except the starting one?
Hey, there's a follow up video where I cover exactly that th-cam.com/video/gI6G49t--RY/w-d-xo.html
Please help, for some reason only the doors all open in one line along the x and all the other door are closed
thanks, really nice tutorial!
Super helpful thank you!
this is great, thank you so much
Thank you for this tutorial. Can I know how to make the last instantiated room an exitroom?
Thats so cool, How does this algorithm assert that the same maze hasn't been generated previously?
Hey, the code is working well but, after implementing the last thing instead of a nice shape dungeon, mine is just a strait line with 2 rooms width, pls help me!
How can i get the possition of the fathest or the last generated cell?, i want to create an exit. And also, how can i get a random position of a cell?, to spawn a key in a random cell that you need to open the exit.
yoiu should make a stack that stores the dead ends or because you make a list you can use a randomiser to select a random object in that list
I'd like to apply Keys and Locks to this, but i'm having troubles figuring out the way the room order is specified. I need to make sure that all locks can be unlocked by obtaining their key before reaching the point where the lock is. So if the locked room is room no. 12 the key would have to be in any room before that. Have you got any application of this?
Thank you very much
Thank You Very Helpful
That was really really helpfull!
The drag and drop for the room prefab doesn't show up in my case using the code from github
Is there a way to make it spawn in all different door directions? Like, have a starting room with 4 doors, they then branch off into a random direction for a certain amount of rooms.
Sure, you just need to change the algorithm a bit, but it's entirely possible.
How do I make it 2D? I tried implementing the code as it is and the rooms generate across the x and z instead of x and y.
Great tutorial but is there away to create more than one room like make them bigger, smaller, l shape ect
hi, how would i randomly spawn items that can be collected within this randomly generated dungeon?
I cant make it work... the door are all messed up
Is it easy to make the generator generate vertically up or down using stairs
Wonderful pure voice
is there a way to do something like this built with all rooms being prebuilt?
like instead of them all using the same room asset, with the doors toggled
I thought a little about this, and unsure if it would work but theoretically you could have an array of room prefabs that are prebuilt and then when instantiate is called in the MapGeneration Function, have it randomly choose a number corresponding to the index of one of the random rooms in the array of prefabs you made.
I have tried to find out how c# works, and im very familiar with the basics, but there are no videos explaining anything above that. Im really interested in finded out what that i means and what it does. Do you know any videos that explain this well?
Hey, I'd advise you to look into basics and more advanced programming concepts and maybe just search the concept+ c# and you'll probably find what you want to learn. Solving problems are also a great way to learn and there are many platforms out there for that.
@@SilverlyBee ok, thanks for the advice!
Hello i'm pretty new to unity, i already did a simple 2d plateformer to see how it works in general. Now i'm trying to follow your tutorial, i have some issues : When i'm putting the different kind of grounds in the "empty object", they all appears in the main window, the game one, how to avoid this ? When you are creating your rooms, it seems that you are copy/paste each floors, walls, etc and they all automaticaly put close to each other, i dont have the same and just for the grounds parts, they are in random places. How to fix it ? Thanks !
So, when you're adding different types of ground to that "empty object," they're unexpectedly showing up in the main game view, right? It might be because you accidentally dragged them from the hierarchy panel directly into the scene or game view. To avoid this, make sure you're arranging everything within the scene view itself. If you want to prevent accidental movements, you can lock or hide layers that you're not currently working with.
In the tutorial, you're seeing that the floors and walls are being copy-pasted and automatically placed close to each other to form rooms. But when you're trying this, things are ending up in random places, especially with the ground parts. This could be due to the pivot points of your objects or how they're aligning. Take a moment to check where the pivot point is on your objects - that's the point they rotate or scale from. If it's off, it could lead to unexpected placements when you copy-paste. You might need to adjust the pivot point or use snapping settings to make sure everything lines up properly.
How to Fix It:
Always work within the Scene View when arranging and duplicating objects to have better control.
Keep an eye on the pivot point of your objects - it's like their anchor point. If it's not where you want it, things might get wonky when you copy-paste. Adjust it if needed, or use the snapping feature to help align things to the grid.
Remember, Unity has a learning curve, especially when you're just getting started. It's normal to run into these hiccups, but with a bit of practice, you'll get the hang of it.
Does this generator generate a completely random dungeon everytime? or does it generate the dungeon with a single pattern? If it generates it randomly can I make it so that it generates it in a single pattern everytime?
It currently generates it randomly, you can look into seeds to generate it in a single pattern
@@SilverlyBee okay thank you!
I want to add a pillar in the middle of the room if all the doors are open in that particular room. there is only one pillar, it's always in the center. Please help, i'm basically an absolute beginner with C#. I'm also having another issue. I Finished the Room behavior script, attached it to the room, made the empy object (Generator), got the dungeon generator script from github, pasted it there, attached it to the empty object, and it is saying this error: "Assets\Scripts\DungeonGenerator.cs(90, 161): error CS0246: The type or namespace name 'RoomBehavior' could not be found (are you missing a using directive or an assembly reference?)" Thank you if you at least try to help.
It's probably just a difference in spelling, mine is "RoomBehaviour" and yours is "RoomBehavior" so when you imported the script it has my spelling. To spawn the pillar in the middle you can create a pillar prefab, get a reference for it on the RoomBehaviour and check if all the doors are open, if they are you can use Instantiate to spawn.
hello! thank you for your video. i am trying to use it a year later, and the line:
var newRoom = Instantiate(room, new Vector3(i*offset.x,0,j*offset.y), Quaternion.identity, transform).GetComponent;
is returning this error:
CS8773 Feature 'inferred delegate type' is not available in C# 9.0. Please use language version 10.0 or greater.
Does anyone know how to fix this? Thank you in advance!
Upgrade to C# version 10.0, I think you can do it in Visual Studios settings. Do a quick google for updating the language version.
Never forget to add your parentheses when you call a method, in your case "GetComponent" -> var newRoom = Instantiate(room, new Vector3(i*offset.x,0,j*offset.y), Quaternion.identity, transform).GetComponent();
@@DayMoniakkEdits thank you!! i'll try that and let you know how it goes.
@@lukeallen5458 thank you! i'll do that.
Hey there! im running into an issue where my game is infinitely generating without stop and eventually crashes due to lack of memory -- any idea what could be causing this?
You're calling the function infinitely. Check where you're calling it, it shouldn't be on update, if you're using a while function, that could be your problem. Just make sure that you don't have a never ending loop calling the function.
@@SilverlyBee what would you replace the while loop with? I’m a beginner at coding so not to sure about what to do one o remove the while loop.
@@tommedenney Depends on the loop. You could still use it and have a max counter for like 1000 loops so it doesn't exceed it.
Would it be possible to change the roombehaviour script to destroy the wall or door instead of disabling it? I want to do this because of it causing possible conflicts with how i want to do dynamic occlusion culling so as to get larger size dungeons to not lag as much.
Just use the Destroy() function instead of setting it inactive.
@@SilverlyBee so instead of doors[i].SetActive(status[i]);
walls[i].SetActive(!status[i]);
i should do this instead?
doors[i].Destroy();
walls[i].Destroy();
(and also a big thanks for the quick reaction)
@@ARMADA-oz6we It would just be if(status[i]) Destroy(walls[i]) else Destroy(doors[i])
@@SilverlyBee ah, i understand now. thank you for the explaination.
Hello very nice tutorial. But I have a question is there any way to add a NavMesh to the generated dungeon so our character can walk on it ?
i think u can, by adding the navmesh in each rooms prefab
It is possible but requires an additional package for it to work as there isn't a default way to calculate NavMesh at runtime. The previous comment wont work due to the NavMesh being broken off in each room which means the character cant go from room to room through the doors.
continue to cook so i can learn🔥🔥🔥🔥🔥🔥🔥
Do you mind continuing the series with elevation in mind? Like stairs connecting rooms, etc.
Hey, maybe in the future I'll make something of the sort (I have no plans though), but it would just be adding a 3rd dimension and 2 more neighbors to each cell. It wouldn't be that hard to expand on that
wow great! is it possible to use more than one prefab to have more varied dungeons?
Yes! You can even write conditions where there isn't a doorframe to another room, and not even a wall, giving the illusion of a longer corridor room, but this involves a bit more Coding. Imagine the rooms as some Tiles. And from there, let your mind go free.
amazing video
Great tutorial! Everything is good but there is a problem that I am suck on. Whenever I generate the dungeon the entrances arent in the right places and some rooms have doors and walls enabled at the same time. I downloaded the scripts from the github and followed every step and even watched the video twice but I have still not found the issue. Any help would be much appreciated. Thanks!
Be sure that you have selected the right doors/walls on the slots. You can do so by trying to open/close doors in only one room.
@@SilverlyBee Thanks for the help but I looked over all the doors and walls and they are in the right slots in the RoomBehaviour script. When I ran the game all of the rooms were still facing the wrong directions and for some of them the doors and walls still were both enabled at the same time. For example in one of the cells the door enabled should have been the Up door but instead the Right door was enabled. I have no idea why this is happening but thanks for trying to help
I even made the exact same room that you made but the issue still occurs
Having the same issue. Wrote all scripts to develop more practice, the room board works, but the doors / walls both spawn. So I went back and copied from GitHub. Part of the fix for me has been to fix the prefab. Make sure the prefab you're spawning in, is working and the transforms are reset before prefabbing.
Additionally, when I wrote back in the debug status in RoomBehaviour, then tried and tested it out. I disabled the status and the rooms finally generated.
I initially just went along with the video, but for some reason had the problem that there was indeed a full grid, but the entrances were facing outside so that I can fall off into the void.
Then I copied the code from the description and now all of a sudden the entrances are still facing outside, but also now it's not in a grid and there's absolutely no possible way to get from one room to another.
I had the same isue, make sure your top and bot walls are in the z value, and left and right in the x value of the world space
@@diegolopez5924 Still does not work by the way
That's a nice one. New sub from me!
Thanks! Glad you liked it!
I tried! doors and walls not working!
Which version of Visual Studio are you using? My code coloring looks different than yours, and it's driving me nuts. I recently upgraded to VS Community 2022 and that could be the reason the code coloring is different.
I'm using the 2019 version, that's probably it.
@@SilverlyBee Thank you - Great tutorial. It was exactly what I needed to get me over the procedural generation hump. Keep up the great work you've won a new sub.
@@danc01 Thanks :D
Moving from this tutorial to the next, now when I run no new rooms will generate.
Now I get the 3 x 3 grid of rooms but it continuously stacks 3 x 3 grids of rooms on top of each other
I don't understand the logic of checking neighbors in its function. How cell-size.x is the top neighbor cell? and how cell -1 is the left neighbor?
It's because I'm using a single array (1 dimension) to work with the cells. If you want to, you can use multidimension arrays to make it more intuitive.
i cant put room prefabs into the Dungeon Generator Script Component, can some one help plssss
Have you watched the second video? It goes into detail about generating different types of rooms.
@@SilverlyBee ummmm the dungeon generator(script) component, that has a rooms that u can drag room prefabs into it right, but my one can’t drag anything into the rooms.😂
@@SilverlyBee it’s not showing like element 0, element 1 etc and None(Game Object) beside or below the Room in the dungeon generator scripts component
@@YiXin-gi1kt Make sure the variable is public(or serializable), then it should show up in the inspector
Thanks. Dungeon generation is a neat topic. BTW why not use Vector2Int instead to avoid those int conversions? Also one thing about those dungeon room models. I understand this tutorial is mostly about explaining and visualizing an algorithm, but in real world use those overlapping walls would be not ok.
In games it is ok to overlap walls, this is made for game ya know?
@@bigblue489 Nothing prevents you from doing it. My point was pointing out a technical choice. You'll run into problems when two set of faces overlap exactly facing the same direction... you'll get z-fighting and it also is waste of geometry and causes overdraw. In this case there is no point having 4 walls on each cell (unless using half walls). You also seem to assume I made a comment not knowing about this being for games... but this is a channel about game dev. I have no idea why you assume something like that.
Hey, Vector2Int is a good alternative. As for overlapping walls, the tutorial was meant to be as simple and easy as possible. The overlapping walls/doors would have to be fixed for a bigger game and there are many alternatives for fixing it (from checking collision/distance to using a single generator to create the walls and doors). The tutorial is meant to be taken as the basis to build your own. The focus would be the relations between each room (the grid/board of cells), since I believe someone would be using a different type of room I decided to leave the walls as is. I'm currently making a video expanding a bit on this sort of dungeon, if you'd like I could include a section about how to clear the overlapping walls.
@@SilverlyBee Thanks for the reply. Like I said "I understand this tutorial is mostly about explaining and visualizing an algorithm". Really liked the use use 2D to 1D conversion of the grid data. I've used similar 1D array system myself but those border column rules were pretty ugly in my solution. I've personally used old school west/south facing wall setup, but I wouldn't mind seeing another take on wall placement, not too many videos on that topic, could be interesting!
@@322ss Yeah, the south/west could be a solution but in the case of the video you'd also have to create the east/north border walls. If it were a 2d dungeon (top down) you'd have to increase the space between the rooms and use a "bridge". I'll probably use a generator to create the walls, since the rooms follow a similar pattern. These 2d to 1d conversions can be quite challenging, if I ever use it again in a tutorial I'll try to explain it a little better, I feel like I went a bit fast on this one.
thw that helped me a lot
It's okay if I use your algorithm with a game that has backrooms style? , I'm currently working on it
Sure!
@@SilverlyBee i have a room that doesn't have any doors to open. it's okay if I don't write the door element in your script ?.
I'm afraid that it when I will finish the entire script and go be to unity, it might say that there's gonna be an error where I didn't assigned an object to the door component.
So for the final question: I have a room that doesn't have any doors, just walls, I am worried about messing up with the code because your script has is focused on a room that has a door. What am I supposed to do.
Thanks for reading this and hopefully I will find the solution! Thanks!
@@tiefighter7216 If it's the walls work like the doors to be openings into the room then you can just remove the doors from the script.
I'm brazilian and I have a strange ease of understanding what you say, are you brazilian too?
Sim :D
@@SilverlyBee Q legal :)
Thank you
Thanks
can you make a bubble shooter game tutorial!
Maybe in the future. Currently I have no plans for it.
not me trying to make the backrooms
same
damn. boom. sub++;