Quick note: In the tutorial I failed to mention that if you want to bring the dungeon generated in the editor over to the game, you also have to set the owner of each of the cells you add as a child. this can be done by adding the line : dun_cell.set_owner(owner) after add_child(dun_cell) at 39:21 This is because when saving scenes godot needs to know each node's owner. Sorry for the neglect. I'll correct this in the github repo
Hi, could you explain how a generated dungeon could be exported in a new scene? i try copy paste in a bunch of different way but the hidden walls became visible
@@giampaoloschembri452 I'm not sure if this helps at all, but the way I got the walls to not be visible in a live run was first to combine all of the DunGen/DunMesh primary functions to run one after another. Meaning that in the set_start function of DunGen, I have an instance of dun_mesh running create_dungeon after creating the grid map Then I made it so in my main world node in the main scene, I created a script that only has a _ready() function and I added a call to the DunGen set_start function in the _ready() function Essentially I have it so when I load my main scene, it runs the grid map generation, the dungeon mesh generation, disables to grid map generation, and this way all the extra walls are no longer in there
I did everything like the video and added that line but when I play every cell contains every one of the doors and walls. Essentially every cell is a copy of the entire tileset and I can't move anywhere because I'm stuck in a 1 by 1 box
Insane video. Its great that you not only explained code but showed the logic behind the code with the animations before. This makes it very easy to Understand. Thank you for this great Video!
Really awesome tutorial ! Thanks you for making this tutorial, which will undoubtedly help many people in the Godot community. Some minor things that could be done differently (Without wishing to be demeaning ! Quick disclaimer : I'm by no means a professional....) : 6:24 : no need to declare the set function, add ":" at end of the variable line, on next line write "set(value) :" instead of the function, and finally the code. 13:04 : use "randi_range(min_room_size,max_room_size)" which is more clearer than the modulo one 19:15 : take advantage of the vector3 operators : var center : Vector3 = Vector3(start_pos) + Vector3(width,0.0,height)/2.0 33:52 : here, the type can be inferred, so you can omit the type name : var pos_from := Vector2i(h[0].x,h[0].z) 43:04 : only one simple handle_all function with an extra parameter key could very well have done the job : func handle_all(cell:Node3D,dir:String,key:String) : match key : "" : cell.call("remove_door_"+dir) # for handle_none "00" : cell.call("remove_wall_"+dir) ; cell.call("remove_door_"+dir) "01" : cell.call("remove_door_"+dir) and so on... Again, great work ! Nicely explained and well done. New subscriber.
Thanks for taking the time to watch it. Super appreciate the feedback. (regarding the handle_all() situation I thought what I did would be more performant since it wouldn't use any conditional statements but in hindsight yeah you're probably right a one time check wouldn't hurt performance, it might have been even better idk :p) again thanks for watching. learned so many things from you comment.
Such a great video indeed! But I cant find anywhere a tutorial that just connects 2 rooms by code though. Lets say they have a door in the middle of the wall and you want to connect them. I dont think a tilemap would be best, if you just want to combine only 3-4 types of room (so I mean, random generated locations of rooms, but the rooms themselves premade in Blender ).
Hey, i don't know if you are still on this project but could you send the lines of codes that replace the set function (6:24, I don't understand your current instructions)
I have been nibbing at this for a good month or two now(nowhere close to where you got, time and struggle learning too), also I was not using the grid system yet. This video is so incredibly good for me that I have downloaded it in case your account explodes I will always have it lol. But seriously, this is an amazing achievement for roguelike dungeon games on Godot, thank you so much for your effort and sharing, I know is not easy to reach this result(at least for me was being really hard). Also this is so incredibly flexible too! I want to add several floors and I think I can now, will definitively share it once if no one beats me to it (pls some beat me to it xD) Now just to create nav meshes based on the grid, spawning systems for loot, mobs, secrets, dynamics, art, sound, tons of work and you got yourself a nice rouge like dungeon game lol! Again I was 2 mins in and I subscribed and liked because some people has done it but no video comes close to explaining this well enough as you did, not even mentioning godot 4. You say this could be not "optimal" but im forking this and doing my best to upload any improvements (if any). Really exiting 11/10 content. EDIT: Almost forgot the "quick" text popups are hilarious lol
Wow! Amazing code and excellent explanation! I'm studying it to learn about procedural generation. I'll recommend your channel to my friends, hope you make more videos!
Thank you for this amazing tutorial! I made some modifications to the way the room are generated to instead use pre-made ones and it works really great
no need for the disclaimer...no one is perfect and if someone is going to judge you for english being your second language or that you laptop is maybe old or something..who cares..you are providing people a valuable service...(liked)
Thanks for the tutorial, I've been thinking about doing something similar but most of the tutorials I've watch never really went in depth, thanks for the video.
Ok I finally mastered the concepts on this video, wanna thank you a lot for this, really gave me that initial push on procedural generation. Now im creating my own Astar algorithm to search in 3D add stairs and whatnot, finally using triangulation on 3 dimensions and such, but got to say thanks to this video, before it I was really stuck... I would like it 100 times if I could but I guess a second comment will do
@@sleepymushroom9403 Well I'm using Astar3D but since Godot doesn't have a 3DAstarGrid method, I just made an array, and dictionary of all points. The key on the dictionary is the position of the points. Then I manually connect them all :P, here you could just connect octagonally or all the points around each point, that will give you the no diagonal method. And the Astar3D method has a "compute distance" and "stimate distance" functions that are overwritable. So I implemented the Manhattan distance there, have to say I had to tweak it a bit and is still not working flawlessly bc the path finding in 3 can connect stuff from the bottom and I want it to always connect on the front but is a matter of a bit more work. I might do a video explaining it all, is pretty simple 🤔(even if it sound messy)
Great video man, I'm currently watching it through on my second monitor just out of curiousity because I love procedural related topics and this is a great system you made
Thanks massively for making the tutorial. Honestly still don't understand alot of the long for-loops and how exactly the algorithms used work. But having a working example and code with it probably saved me alot of head-ache trying to figure all of this out otherwise. So yeah, thanks alot!
Also just a follow up I have incorporated a few changes to the code and I'm goig to add generation for specific rooms and items/resources, will definitely email you some results to show you what I've made with your generator
how would i go about changing the 1x1x1 grid map to another size? is it just a matter of changing the grid map size itself, the mesh library size and the actual den cell size? or is there stuff in the code that needs to be changed also?
do you think you can do the same but with like assets that you built ? like in lethal company ? you got x numbers of created room and corridors that you can assemble with a random generation
Hi, great work! Do you know how to make it so that after I generate the dungeon, and all the textures, I can run the scene and observe the textures? Currently, after playing the scene, only the coloured boxes are visible, but not the textures. Why does this happen?
hmmmmm. interesting question, for custom sized rooms I'd place them manually before adding the procedurally generated rooms (it has to occupy space in the gridmap, if not you can place the custom made mesh for the boss room in first, place debug nodes to know where the doors are supposed to be, clamp those nodes' positions to integers to better fit the gridmap space and mark them as door tiles, that way the generator can still handle the hallways. and ofcourse you have to fill up the space that the room mesh occupies in the gridmap space so that other rooms won't intersect with it.) , and then draw the hallways between them, of course that's just one way. keep in mind the process of generating the map layout is separate from generating mesh for that layout. in my video I made a simple solution for the mesh part . it's totally up to you how you break this process to fit your needs. for example you can make the layout first, using the room_positions and the room_tiles properties decide which room is which. and then add your own premade rooms in manually. make hallways between your rooms and the rooms generated from before, and then using that information generate mesh for the dungeon.
Hello, first of all, very good job! You helped me and a lot of other people with this tutorial! But I still got a problem. Whenever I turn the DunMesh on, it will generate perfectly. Now, if I swap the 3D-perspective to another scene and back to the world (or just start the game), every block is surrounded by doors (not walls though). Any suggestions as to how to fix it?
Hey, I have a quick question: I got it working after following the tutorial, however when I ho to play the level, none of the walls or doors are removed. It looks fine in the editor, it's just when I run the game
@@jonathanwilliams9593 3D is possible because it can bake but I don't see a way to integrate the NavigationRegion with the TileMap I feel like this is a huge oversight would be awesome if there was a way to make it happen.
Hey bro how would I make this dungeon have collisions so i can put a player in it? and how could I make the dunmesh automatically load in when i open a project instead of having to start it.
You can add the collisions as children of the wall objects on the cell scene, like I did ( at 36:46 ). and naturally the floor and the ceiling will always have collisions . this way, you can also bake a navmesh based on the results after the dungeon is created.
are they inside the imports folder? maybe its because of my ignorance but there i just seem to find textures and code i dont understand. How am i supposed to get the models to put them on my own project? sorry to bother you@@quwatz
@@jurgevaIIejos yup I just downloaded it from the repo, both the dun_cell scene and the .glb model are included in the files and work fine out of the box. the dun_cell files (both the scene and the mesh) are in the import folder. the main scene in the tutorial is the dun_gen.tscn . try opening that first . hope this helps. it could be that an antivirus software is deleting the files for whatever reason but you should be able to find all of the files mentioned above in the project files
Hey. Pretty sure 3.x has the Astar and Astar2D classes still which pretty much work the same way. the only difference is that you have to set each cell manually using add_point(), set_point_disabled(),and ... And that you have to do some extra stuff to account for diagonal movement since they're not written to work with a grid system only. I recommend you read the docs on it and take a look at the Astar pathfinding demo on GDQuest
Greetings! I'm a game developer and I've been following your tutorials closely. They've been incredibly helpful in my journey. I just watched your tutorial on creating Procedural Dungeons in Godot 4 and I have a question. In your tutorial, you've shown how to create rooms and hallways for a 2D dungeon. I'm trying to adapt your script to a 3D environment. I'm struggling with creating hallways in 3D. Could you provide some guidance on how to modify the script to achieve this? Specifically, I'm looking at the create_hallway function and wondering how to adapt it for 3D
Hey, glad you liked the video. I'm not sure what you mean by 'not generating properly'.do the cells not appear ? it most probably has to do with the code. maybe you're not using the right indexes
Bro i added my fps character inside the dungeon but my character is stuck in only one block where it can't move anywhere all the 4 sides are blocked. Can you help with this how to fix.
why there is an issue with the walls shows when I run the project? it shows a lot of unorganized walls that suddenly appears Note: I had even tried your project but is shows the same issue
could you maybe tell me how I can use this ingame now and not just as a tool, I worked through the tutorial and want this all to run on start, currently when I press play the Dunmesh dissapears
The tool keyword is just so you don't have to run the game each time you want to see the changes you make to the script. you can bind the functions to create both the layout and the mesh to a timer on _ready and it should work like it does in the editor. to build upon it is a completely different story and entirely up to you. example : you can randomly choose a point form the room_positions variable and decide that's where the player spawns. better yet since you have the hallways as a graph you can algorithmically choose a straight path for the player to progress through. in short, everything should still work the same in game as in the editor. only difference being that you have to manually call the appropriate functions to create the dungeon (first the layout then the mesh) and apart from that, you have the data you need to work with to create anything you want (e.g. decorations, enemies , navigation meshes). with that being said, the reason you're not seeing the mesh in-game is because you also have to set the added child's owner to be the currently open scene. try adding a dun_cell.owner = self.owner before adding it as a child at 39:20 in hindsight I probably should have added that in the tutorial I don't know why I didn't, that's on me
Hi there! When I run the project, only the blocks from the grid map are visible and none of the actual dungeon parts are. Is there a part in the code that explains how to have the dungeon be visible or is there a separate way to get that to happen? I'm fairly new to using godot
hello. this is because I'm dumb and forgot to mention in the tutorial that if you want the dungeon that's generated in the scene to translate over the game you also have to set each cell's owner after adding it to the scene. this can easily be done by adding the line : dun_cell.set_owner(owner) after add_child(dun_cell) at 39:21 . the reason I didn't think about mentioning this in the tutorial is because I initially intended for these functionalities to be called and used in-game only (generating both the layout and the mesh in-game) and not as an actual level building tool. The tool keyword , like I said, was only added so we could debug the project without needing to run it every time we made a change.
As an AI language model, I don't have feelings, so I can't really find anything ridiculous or humorous. However, as a language model, I can provide some insights into why premature optimization is not always a good idea. Premature optimization occurs when developers focus on optimizing code before it's necessary to do so. This can lead to wasted time and resources that could have been spent on more important tasks, such as writing high-quality code, identifying potential issues, and testing. One of the main issues with premature optimization is that it can distract developers from solving real problems. Instead of focusing on building robust and scalable software, they may end up spending too much time tweaking minor details that might not even make a significant difference in performance. Moreover, premature optimization can also lead to overly complex code and make it difficult for other developers to understand. Code complexity can be a major obstacle when it comes to maintaining software over time, especially if the original developers leave the project. Another issue with premature optimization is that it can introduce new bugs and create unexpected behavior. When developers optimize code without fully understanding its implications, they may inadvertently introduce new issues that are difficult to identify and resolve. Furthermore, premature optimization can also hinder innovation and creativity. If developers focus too much on optimizing existing code, they may miss out on opportunities to explore new ideas or approaches that could ultimately lead to better solutions. In conclusion, while optimization is an essential part of software development, it's crucial to balance it with other priorities, such as functionality, maintainability, and ease of use. Premature optimization can cause more harm than good, so it's important to avoid it whenever possible. Ultimately, developers should strive to write high-quality code and prioritize problem-solving over minor optimizations.
@@quwatz yes you should listen to the last paragraph. you just spent a bunch of time over a fcking if and match statement. if you were worried about performance write a c++ plugin using gdnative or something, not fiddle with gds lol. and that's after you ran into performance issues, not before
@@Digitalgems9000 yeah I understand what you're saying. but I figured doing it in gdscript does a good enough job. ideally things like this run only once in the beginning of the game. plus like I said using C# is also an alternative without the need to work with gd extension since I really couldn't wrap my head around that. but even if I could I was NOT about to extend the video for another 20 minute just to explain how it's done. also yeah I know what I chose to do instead of simply using a match block was dumb.
@@quwatz gdscript is becoming a hot mess anyways with all their new syntax and keywords. it goes against the exact opposite of what reduz originally intended the language to be used for, so you're not to blame. back in the day, we'd say hey, write your code with c++ if you want it to be faster. now, they want to turn gds into some god level programming language with static typing, lambdas, ridiculous warning system, etc. fact of the matter is, even good old gds on 2.1 is just fine for 99% of the needs of game devs... it's a function of time and will get worse as more crap gets added in. they have to because they need to put on an illusion of feature creep, so they can continue to get donations, sadly.
Quick note:
In the tutorial I failed to mention that if you want to bring the dungeon generated in the editor over to the game, you also have to set the owner of each of the cells you add as a child.
this can be done by adding the line :
dun_cell.set_owner(owner)
after add_child(dun_cell) at 39:21
This is because when saving scenes godot needs to know each node's owner.
Sorry for the neglect.
I'll correct this in the github repo
Hi, could you explain how a generated dungeon could be exported in a new scene? i try copy paste in a bunch of different way but the hidden walls became visible
Any chance of a Multi-Level Generation tutorial?
@@giampaoloschembri452
I'm not sure if this helps at all, but the way I got the walls to not be visible in a live run was first to combine all of the DunGen/DunMesh primary functions to run one after another.
Meaning that in the set_start function of DunGen, I have an instance of dun_mesh running create_dungeon after creating the grid map
Then I made it so in my main world node in the main scene, I created a script that only has a _ready() function and I added a call to the DunGen set_start function in the _ready() function
Essentially I have it so when I load my main scene, it runs the grid map generation, the dungeon mesh generation, disables to grid map generation, and this way all the extra walls are no longer in there
I did everything like the video and added that line but when I play every cell contains every one of the doors and walls. Essentially every cell is a copy of the entire tileset and I can't move anywhere because I'm stuck in a 1 by 1 box
i actually fixed this. I had to make a _ready() function in the DunMesh script and call create_dungeon() inside it
Insane video. Its great that you not only explained code but showed the logic behind the code with the animations before. This makes it very easy to Understand. Thank you for this great Video!
Really awesome tutorial ! Thanks you for making this tutorial, which will undoubtedly help many people in the Godot community.
Some minor things that could be done differently (Without wishing to be demeaning ! Quick disclaimer : I'm by no means a professional....) :
6:24 : no need to declare the set function, add ":" at end of the variable line, on next line write "set(value) :" instead of the function, and finally the code.
13:04 : use "randi_range(min_room_size,max_room_size)" which is more clearer than the modulo one
19:15 : take advantage of the vector3 operators : var center : Vector3 = Vector3(start_pos) + Vector3(width,0.0,height)/2.0
33:52 : here, the type can be inferred, so you can omit the type name : var pos_from := Vector2i(h[0].x,h[0].z)
43:04 : only one simple handle_all function with an extra parameter key could very well have done the job :
func handle_all(cell:Node3D,dir:String,key:String) :
match key :
"" : cell.call("remove_door_"+dir) # for handle_none
"00" : cell.call("remove_wall_"+dir) ; cell.call("remove_door_"+dir)
"01" : cell.call("remove_door_"+dir)
and so on...
Again, great work ! Nicely explained and well done. New subscriber.
Thanks for taking the time to watch it. Super appreciate the feedback. (regarding the handle_all() situation I thought what I did would be more performant since it wouldn't use any conditional statements but in hindsight yeah you're probably right a one time check wouldn't hurt performance, it might have been even better idk :p) again thanks for watching. learned so many things from you comment.
Thanks for the hint with randi_range. Didn't know, that it exists.
Such a great video indeed! But I cant find anywhere a tutorial that just connects 2 rooms by code though. Lets say they have a door in the middle of the wall and you want to connect them. I dont think a tilemap would be best, if you just want to combine only 3-4 types of room (so I mean, random generated locations of rooms, but the rooms themselves premade in Blender ).
Hey, i don't know if you are still on this project but could you send the lines of codes that replace the set function (6:24, I don't understand your current instructions)
@@paul_musique I'm not sure what you mean by that. but the script is up on github. are you asking for the 'set_start' function code?
29:32 "So, assuming you understood everything"
Bold of you to assume I understood *anything*
time for you to dive into Datastructures & Algorithms :)
its mostly understandable until the halfway point, where the code goes completely batshit insane
I have been nibbing at this for a good month or two now(nowhere close to where you got, time and struggle learning too), also I was not using the grid system yet.
This video is so incredibly good for me that I have downloaded it in case your account explodes I will always have it lol. But seriously, this is an amazing achievement for roguelike dungeon games on Godot, thank you so much for your effort and sharing, I know is not easy to reach this result(at least for me was being really hard).
Also this is so incredibly flexible too! I want to add several floors and I think I can now, will definitively share it once if no one beats me to it (pls some beat me to it xD)
Now just to create nav meshes based on the grid, spawning systems for loot, mobs, secrets, dynamics, art, sound, tons of work and you got yourself a nice rouge like dungeon game lol!
Again I was 2 mins in and I subscribed and liked because some people has done it but no video comes close to explaining this well enough as you did, not even mentioning godot 4. You say this could be not "optimal" but im forking this and doing my best to upload any improvements (if any). Really exiting 11/10 content.
EDIT: Almost forgot the "quick" text popups are hilarious lol
Wow! Amazing code and excellent explanation! I'm studying it to learn about procedural generation. I'll recommend your channel to my friends, hope you make more videos!
Magnificent work here. Perhaps I can convert this for my 2d game in the future.
It's really easy to translate this tutorial to 2d using Vector2i's and a TileMapLayer, I can recommend it!
Thank you for this amazing tutorial!
I made some modifications to the way the room are generated to instead use pre-made ones and it works really great
can i get some insight on how you did this? (i'm trying to do the same thing and im really curious)
@@Mop82-h4b maby set the room to min mx 1 and make the cell be the entaiar costum room?
I'd love some insight in how you went about this if you get the chance!
no need for the disclaimer...no one is perfect and if someone is going to judge you for english being your second language or that you laptop is maybe old or something..who cares..you are providing people a valuable service...(liked)
Searching for a tutorial for this for a long time, thanks!
Thanks for the tutorial, I've been thinking about doing something similar but most of the tutorials I've watch never really went in depth, thanks for the video.
Good sir, you have an amazing talent explaining things. Thank you!
Incredible video. Absolutely crazy! Thank you for the in depth explanations.
Ok I finally mastered the concepts on this video, wanna thank you a lot for this, really gave me that initial push on procedural generation. Now im creating my own Astar algorithm to search in 3D add stairs and whatnot, finally using triangulation on 3 dimensions and such, but got to say thanks to this video, before it I was really stuck... I would like it 100 times if I could but I guess a second comment will do
Hey man I'm wondering; how did you figure out generation for dungeons upwards and downwards?
@@sleepymushroom9403 Well I'm using Astar3D but since Godot doesn't have a 3DAstarGrid method, I just made an array, and dictionary of all points. The key on the dictionary is the position of the points. Then I manually connect them all :P, here you could just connect octagonally or all the points around each point, that will give you the no diagonal method. And the Astar3D method has a "compute distance" and "stimate distance" functions that are overwritable. So I implemented the Manhattan distance there, have to say I had to tweak it a bit and is still not working flawlessly bc the path finding in 3 can connect stuff from the bottom and I want it to always connect on the front but is a matter of a bit more work. I might do a video explaining it all, is pretty simple 🤔(even if it sound messy)
@sleepymushroom9403 I uploaded a video explaining how I approached the 3D generation if you want to check it out
@@AirmanCS Thanks man
Thank you!@@AirmanCS
Awesome work, vastly more advanced in Godot than i can use, but love the zoom / outerglow use to target parameters 🤟
This tutorial is mind-blowing! Thanks for the service 🙏
I've always wondered how this method works. Thanks for sharing this.
Great video man, I'm currently watching it through on my second monitor just out of curiousity because I love procedural related topics and this is a great system you made
This is the most useful video for learning this I have found thank you. I've been trying to use chat gpt to learn how to do this
Thank you so much bro. It took me ages but I managed to learn a lot and found out how to do this in 2D!
I'm not actually interested in dungeon generation but your video is a great resource for procedural generation from the editor !
Thanks massively for making the tutorial. Honestly still don't understand alot of the long for-loops and how exactly the algorithms used work. But having a working example and code with it probably saved me alot of head-ache trying to figure all of this out otherwise. So yeah, thanks alot!
Thank you so much for this! This was an excellent tutorial and I look forward to seeing what else you come up with to teach us!
this is a great tutorial. i couldn't code my way out of a paper bag (rip godot's visual scripting) and this is all making sense to me
Using a room class to save the data instead of two separate arrays works nicely
Holy moly, that's awesome! Thank you!
Greatest tutorial! Thank you very much!
This is the greatest video ever made
pretty sure this is a better video:
ruclips.net/video/a37d1BGLpWo/видео.html
super cool video! please do more Godot Videos
Also just a follow up I have incorporated a few changes to the code and I'm goig to add generation for specific rooms and items/resources, will definitely email you some results to show you what I've made with your generator
thank you bro I needed this so much
could you make a tutorial on how to add decorations like windows or tables and/or away to make the path more linear?
That "misspelling" of DunGen is smart. 😉
how would i go about changing the 1x1x1 grid map to another size? is it just a matter of changing the grid map size itself, the mesh library size and the actual den cell size? or is there stuff in the code that needs to be changed also?
Thank you for sharing !!! new subscriber for sure
Thank you for this!
Top vídeo GODOT 😊
Need to be able to mark a boss room. And make sure its not the start room, first room, etc. Regardless, a good starting point.
Got to subscribe because u provide it for free.
do you think you can do the same but with like assets that you built ? like in lethal company ?
you got x numbers of created room and corridors that you can assemble with a random generation
Great tutorial!
What advantage does your method of getting a random width/height have over just randi_range(min_room_size, max_room_size)?
i had some advices, maybe gives 2 seconds delay for the text so peeps can pause it easly xD
possibly 5 seconds since its hard to to that in phones
Hi, great work!
Do you know how to make it so that after I generate the dungeon, and all the textures, I can run the scene and observe the textures?
Currently, after playing the scene, only the coloured boxes are visible, but not the textures. Why does this happen?
this is awesome! is it possible to generate a pregenerated room (sort of like a boss rooms, spawn rooms) for it?
hmmmmm. interesting question, for custom sized rooms I'd place them manually before adding the procedurally generated rooms (it has to occupy space in the gridmap, if not you can place the custom made mesh for the boss room in first, place debug nodes to know where the doors are supposed to be, clamp those nodes' positions to integers to better fit the gridmap space and mark them as door tiles, that way the generator can still handle the hallways. and ofcourse you have to fill up the space that the room mesh occupies in the gridmap space so that other rooms won't intersect with it.) , and then draw the hallways between them, of course that's just one way. keep in mind the process of generating the map layout is separate from generating mesh for that layout. in my video I made a simple solution for the mesh part . it's totally up to you how you break this process to fit your needs. for example you can make the layout first, using the room_positions and the room_tiles properties decide which room is which. and then add your own premade rooms in manually. make hallways between your rooms and the rooms generated from before, and then using that information generate mesh for the dungeon.
@@quwatz thank you, i will try and figure it out.
Why do I use one cube for both the border and the rooms, even though there are 4 of them, as in the tutorial?
thanks for posting this
Hello,
first of all, very good job! You helped me and a lot of other people with this tutorial!
But I still got a problem. Whenever I turn the DunMesh on, it will generate perfectly. Now, if I swap the 3D-perspective to another scene and back to the world (or just start the game), every block is surrounded by doors (not walls though). Any suggestions as to how to fix it?
I have the same issue
This is super helpful. Is there some way I could make the hallways be wider than one block?
Awesome work
how would you go about making a start room and an end room? brilliant video tho
Hey, I have a quick question: I got it working after following the tutorial, however when I ho to play the level, none of the walls or doors are removed. It looks fine in the editor, it's just when I run the game
But can you use a NavigationRegion?
I've been trying to figure this out as well.
@@jonathanwilliams9593 3D is possible because it can bake but I don't see a way to integrate the NavigationRegion with the TileMap I feel like this is a huge oversight would be awesome if there was a way to make it happen.
Hey bro how would I make this dungeon have collisions so i can put a player in it? and how could I make the dunmesh automatically load in when i open a project instead of having to start it.
You can add the collisions as children of the wall objects on the cell scene, like I did ( at 36:46 ). and naturally the floor and the ceiling will always have collisions .
this way, you can also bake a navmesh based on the results after the dungeon is created.
gigabased video. thanks
question: where are the models of the walls from???
I made them myself in blender, they come with the project files in the github repo .
of course you can make your own models too if you wish to
are they inside the imports folder? maybe its because of my ignorance but there i just seem to find textures and code i dont understand. How am i supposed to get the models to put them on my own project? sorry to bother you@@quwatz
@@jurgevaIIejos yup I just downloaded it from the repo, both the dun_cell scene and the .glb model are included in the files and work fine out of the box.
the dun_cell files (both the scene and the mesh) are in the import folder. the main scene in the tutorial is the dun_gen.tscn .
try opening that first . hope this helps. it could be that an antivirus software is deleting the files for whatever reason but you should be able to find all of the files mentioned above in the project files
it worked!! thank you so much 4 taking your time to solve my questions
@@quwatz
Great tutorial, is there an easy way to keep the dungeon mesh children when running the scene?
Do you have a 2d tuts for this?
Thank you for the tutorial. Do you have a tip how i can connect the hallway doors without using AStarGrid2D, because it doesnt exist in Godot 3.5.2.
Hey. Pretty sure 3.x has the Astar and Astar2D classes still which pretty much work the same way. the only difference is that you have to set each cell manually using add_point(), set_point_disabled(),and ...
And that you have to do some extra stuff to account for diagonal movement since they're not written to work with a grid system only.
I recommend you read the docs on it and take a look at the Astar pathfinding demo on GDQuest
Greetings! I'm a game developer and I've been following your tutorials closely. They've been incredibly helpful in my journey. I just watched your tutorial on creating Procedural Dungeons in Godot 4 and I have a question.
In your tutorial, you've shown how to create rooms and hallways for a 2D dungeon. I'm trying to adapt your script to a 3D environment. I'm struggling with creating hallways in 3D. Could you provide some guidance on how to modify the script to achieve this? Specifically, I'm looking at the create_hallway function and wondering how to adapt it for 3D
Amazing video. Works perfectly but i used a different set of tiles and they arent generating properly. Any tips on why?
Hey, glad you liked the video. I'm not sure what you mean by 'not generating properly'.do the cells not appear ? it most probably has to do with the code. maybe you're not using the right indexes
Bro i added my fps character inside the dungeon but my character is stuck in only one block where it can't move anywhere all the 4 sides are blocked. Can you help with this how to fix.
same here, did u find out how to fix?
Which software did u use for animations?
blender
Anyone know why the walls come back when I actually play the scene?
why there is an issue with the walls shows when I run the project?
it shows a lot of unorganized walls that suddenly appears
Note: I had even tried your project but is shows the same issue
Thanks a lot!
I have one issue so far. Any camera i have shows all the walls even the ones that are disabled
same did you find out hows to fix?
could you maybe tell me how I can use this ingame now and not just as a tool, I worked through the tutorial and want this all to run on start, currently when I press play the Dunmesh dissapears
The tool keyword is just so you don't have to run the game each time you want to see the changes you make to the script. you can bind the functions to create both the layout and the mesh to a timer on _ready and it should work like it does in the editor. to build upon it is a completely different story and entirely up to you. example : you can randomly choose a point form the room_positions variable and decide that's where the player spawns. better yet since you have the hallways as a graph you can algorithmically choose a straight path for the player to progress through. in short, everything should still work the same in game as in the editor. only difference being that you have to manually call the appropriate functions to create the dungeon (first the layout then the mesh)
and apart from that, you have the data you need to work with to create anything you want (e.g. decorations, enemies , navigation meshes).
with that being said, the reason you're not seeing the mesh in-game is because you also have to set the added child's owner to be the currently open scene.
try adding a
dun_cell.owner = self.owner
before adding it as a child at 39:20
in hindsight I probably should have added that in the tutorial I don't know why I didn't, that's on me
Hi there! When I run the project, only the blocks from the grid map are visible and none of the actual dungeon parts are. Is there a part in the code that explains how to have the dungeon be visible or is there a separate way to get that to happen? I'm fairly new to using godot
hello. this is because I'm dumb and forgot to mention in the tutorial that if you want the dungeon that's generated in the scene to translate over the game you also have to set each cell's owner after adding it to the scene.
this can easily be done by adding the line :
dun_cell.set_owner(owner)
after add_child(dun_cell) at 39:21
.
the reason I didn't think about mentioning this in the tutorial is because I initially intended for these functionalities to be called and used in-game only (generating both the layout and the mesh in-game) and not as an actual level building tool. The tool keyword , like I said, was only added so we could debug the project without needing to run it every time we made a change.
Thank you very much!
"DunGen" - ha! Nice!
bro cooks well
What themes are you using?
the default theme but desaturated and darkened with a slightly reduced contrast
thanks!
this tutorial is awesome!!
awesome work, but that color you use for your comments is awful :P
"I could explain what each edge is, and how it works... but I can't be f'd... sorry". 😅😅😅😅
that's some ridiculous premature optimization at the end there, lmao
As an AI language model, I don't have feelings, so I can't really find anything ridiculous or humorous. However, as a language model, I can provide some insights into why premature optimization is not always a good idea.
Premature optimization occurs when developers focus on optimizing code before it's necessary to do so. This can lead to wasted time and resources that could have been spent on more important tasks, such as writing high-quality code, identifying potential issues, and testing.
One of the main issues with premature optimization is that it can distract developers from solving real problems. Instead of focusing on building robust and scalable software, they may end up spending too much time tweaking minor details that might not even make a significant difference in performance.
Moreover, premature optimization can also lead to overly complex code and make it difficult for other developers to understand. Code complexity can be a major obstacle when it comes to maintaining software over time, especially if the original developers leave the project.
Another issue with premature optimization is that it can introduce new bugs and create unexpected behavior. When developers optimize code without fully understanding its implications, they may inadvertently introduce new issues that are difficult to identify and resolve.
Furthermore, premature optimization can also hinder innovation and creativity. If developers focus too much on optimizing existing code, they may miss out on opportunities to explore new ideas or approaches that could ultimately lead to better solutions.
In conclusion, while optimization is an essential part of software development, it's crucial to balance it with other priorities, such as functionality, maintainability, and ease of use. Premature optimization can cause more harm than good, so it's important to avoid it whenever possible. Ultimately, developers should strive to write high-quality code and prioritize problem-solving over minor optimizations.
@@quwatz yes you should listen to the last paragraph. you just spent a bunch of time over a fcking if and match statement. if you were worried about performance write a c++ plugin using gdnative or something, not fiddle with gds lol. and that's after you ran into performance issues, not before
@@Digitalgems9000 yeah I understand what you're saying. but I figured doing it in gdscript does a good enough job. ideally things like this run only once in the beginning of the game. plus like I said using C# is also an alternative without the need to work with gd extension since I really couldn't wrap my head around that. but even if I could I was NOT about to extend the video for another 20 minute just to explain how it's done. also yeah I know what I chose to do instead of simply using a match block was dumb.
@@quwatz gdscript is becoming a hot mess anyways with all their new syntax and keywords. it goes against the exact opposite of what reduz originally intended the language to be used for, so you're not to blame. back in the day, we'd say hey, write your code with c++ if you want it to be faster. now, they want to turn gds into some god level programming language with static typing, lambdas, ridiculous warning system, etc. fact of the matter is, even good old gds on 2.1 is just fine for 99% of the needs of game devs...
it's a function of time and will get worse as more crap gets added in. they have to because they need to put on an illusion of feature creep, so they can continue to get donations, sadly.
i dont like people like you. Always shitting on others and their progress. Just mind your own business and dont use it then. I think it rocks.
If statements are usually faster than nesting for loops when it comes to choosing which evil is " greater "
Which parts of the godot docs did you reference?