HOLY CRAP! I just got some insane whiplash, I used the EXACT same dungeon asset pack for a game prototype (Weapon of Wonder on my channel) and this procedural generation would fit right in with the game! Awesome stuff!! :D
So cool. Any even though the current iteration isn't _terribly_ interesting as an explorable space, it would still be immediately interesting to place something like a competitive FPS within it But then, making it interesting as an exploration space seems just a matter of iterating on the algorithm and adding more pre-fabs
Yep I think anyone who is a bit more creative than me could probably find some some ways to work it and create some interesting dungeon kits. It's also CC0 so anyone may modify or take portions of it to improve for their own uses.
@@branm5459and they realised that its not a good idea for competitive play as it's too unpredictable in terms of balance. The way they do it is by curating the generated maps. So the actual maps are proc gen'd, but they only 'release' the ones that are relatively balanced
This is incredibly cool! Making a doom-inspired roguelike FPS game, and just stumbled upon this video randomly; Definitely a lot of inspiration I can take from this! Super cool work! ^^
Love it. Seen some great content on Majikayo recently. I really appreciate time spent going thorough the problem solving process and algorithms. Super valuable. Thanks, for your time and effort - keep it coming (if possible)!
Thank you! Yep, planning on pumping out a bunch more content soon. Experimenting with different video types now to see what does best. I think I might go back to tutorials since my first stairs tutorial video is still the most viewed on the channel.
Cool video. On your point about the locked situation where rooms don't separate fully, you could add a step to your algorithm that shrinks the rooms as the final step in that case in order to provide the separation. If every red room decreases by one, until they are no longer in violation of the constraints. Also, on your solution to the Islands, another option would be to make it a feature of the algorithm using portals - adding some variety to they levels i.e. isolated rooms at the end are assigned a portal to a random location in the connected dungeon rooms.
This is awesome I've been looking for the past few days to see if there were many videos about 3D dungeon generation like this and there really aren't any and the ones that are out there don't do things like this, your video is exactly what I was looking for!
you are the greatest!!! for the past 3-4 months i have been banging my head against a wall trying to do this and just when I was ready to give up I saw this, tysm!! its pretty funny i found it because I was taking a little break and trying to make some water when i saw your realistic water tutorial
Wow. I love the dungeon generation system. I used the recursive backtracking technique, but I found it got boring with just winding corridors - I was trying to somehow superimpose the rooms after the maze generation, but it got really weird and glitchy. Glad I found this video! Inspired me to keep at a project I was sooo close to giving up on. I will attempt to ‘borrow’ the idea outlined in this video instead of floundering through my own maze of twisting errors. Have a cookie 🍪, and a sub :)
Sure thing! Please take as much code as you want from mine :) that's why it's cc0 public domain. And ask me here if you got any questions, hopefully I can save you some time if you get stuck.
@@MajikayoGames How difficult would it be to convert the demo/graybox phase version into unity, to run in editor (not at run time). It seems like it would be a great grayboxing phase starting point to get early design samples to start with.
@@Koniving if you just wanted to port it, i would imagine it wouldn't be too difficult if you knew what you were doing, all source code + multiple explanation videos are available. im not super well versed on unity, more godot, but really the complex part is just getting all the little details working right like room rotation, prefabs, etc. the initial version of this i got up and running pretty quick. and most of that was just trying to figure out how to solve the problem.
This is cool and easy to use! I will be utilizing this for building D&D dungeons on a Minecraft server I play on (And actual D&D for that matter). This will save a ton of time with the basic layout.
Ah awesome you mean the web prototypes? Great glad it seems useful to you. You can save the seed too if you close out the tab and it should be deterministic (3D one only)
Great video! I just started creating my game and I'm thinking of procedural generation to create a lot of stuff since I'm alone and do not want to spend most of my time designing stuff in the game, so your vide gave me good ideas. Thanks!
Nice! I think you might be overcomplicating the last step of connecting all the rooms. You can just A* from one room to all the others to make sure there is a path, and carve one if not.
Ah good point. There may be a way to simplify that in the code some more. The current way I went about doing it uses dijkstras with the cost of the corridors set to 0. The rooms aren't passable right now because it was getting a little complicated to detect whether we could walk thru, can only walk through/out of a room on a side with a door. I think the pathfinding would work if I fixed that... May also be preferable because then I don't think it would be very difficult to add support for things like, isolated islands which are accessible from other floors. So it would make the dungeon possible to be a bit more sparse. Might add this in the future! Thank you for your comment appreciate it:)
This gave me a lot of inspiration, I'm using a very different algorithm for procedural generation with UE5. However, the verticality is amazing, and I really want to make it a part of my design one way or another.
Nice algorithm! It seems easy to change the result, since you can move rooms and use pathfinding. You can change how clustered rooms will be or modify the pathing heuristics with ease.
Where have you been half a year ago? I tried to do the same stuff your videos have for ages Well, i guess it's time to fix my barely-functional code for portals and staircase and use all of those rooms i had made, very inspiring, thanks)
Very cool, I’ve been working on developing a system for building multilevel dungeons in D&D using 3D printed tiles. I’ll be checking this out to build some new and unique layouts for the table top.
Ohhh that looks very cool how that works. Procedual generated environments are interesting. They often are a hit or miss with me depending on the diversity of the pieces and application and how lost you become in them. When it's a hit it's reconizeable and interesting and has some variety on your current situation (different loadouts different abilities different enemies) when it's a miss it's just the same big room with a statue you've seen a bunch of times already.
Something I've been noodling out is generating hallways by joining the exits of rooms with splines so you can have procedurally generated curvy hallways. You could make some sloped hallways as an alternative to stairs.
Great idea.. I've been using spline paths in godot as well lately, pretty fun and quick to get some interesting designs with them. Now I'm imagining some giant noodle dungeon with the corridors twisted and tied around other. Lol
@@MajikayoGames that seems like a dangerous way to start learning about matchmatical graph untangling. Now that I think of the spline hallway thing, I think Deep Rock Galactic does the same thing where they place pre-made caverns and pipe them together with splines.
Waddup, my fellow roguedev! I haven't messed around two much with 3D tile generation since the early 2010s, but if you want I have a few dungeon complex algorithms I've open sourced that you're more than welcome to check out. Would love to see you come up with a 3-dimensional Qix maze, for instance.
Watched your vid on it! Great job, you gave a great breakdown on a variety of techniques for dungeon generation. For the Qix maze, that does look interesting, I considered something like that initially, but I realized if I have prefab rooms of varying tile dimensions, it can be hard to fit them into the space carved by pathfinding style algorithms. I was imagining that I might want some more interesting room shapes, or weirdly shaped stair rooms, spanning multiple tiles, doors at specific locations on the sides of the rooms, so that lead me to this implementation. Initially was going to allow any shape of rooms, but at some point I got lazy and just made them boxes XD I actually really liked your maze generator example in that vid though. I was thinking of how to do that, have never seen it talked about, how to do mazes procedurally.
Would it be possible to have more than just halls or stairs connecting rooms, instead of saying it is a door you also have like vents or holes so you could have tunnels or ductwork between rooms in addition what you have. It would also be neat to be able to essentially define or paint weights on your dungeon grid so it will try and generate certain structure types in certain areas and others elsewhere. For like if they are going from like a dungeon into a cave for example. This is cool as hell though so far.
For vents and holes, it's possible you could hook into some hook for post dungeon generation, and then generate them yourself in if you wanted them on a separate grid than the dungeon not aligned with the rooms. I have thought about some way to customize which rooms spawn where, I'm about to start working on this addon again so I'll keep it in mind, probably what I would do is allow it to be customized in code some way, like provide a hook function for the user to use as a callback to provide some info for how/where which rooms should spawn, maybe on which floor, etc.
@@MajikayoGames Same grid I guess more along what i meant just instead of it trying to generate a hallway/stairs between those two points it knows that it needs to draw from a different set of tiles like tunnel/ductwork for example. I am assuming with a hook like you could tell it to generate a like door or object to use as a spawn point or exit or other items. There is a old game now called anarhcy online that uses procedural generation for it's like side missions in game, you set the parameters when rolling for missions, it gives you a contract basically your key and a location somewhere in the world it basically says when you walk through that door you enter mission. This so far reminded me of that a lot, its awesome stuff keep at it.
I'd love to see a version of this algorithm that works in a continual 3d space without the larger 3d grid - I don't see the method of push separation varying that massively without discrete 3d grid spaces, but the pathfinding algorithm may be a bit more demanding. The advantage of this being that the inputted rooms and corridor dimensions could be any size you wanted, if you needed more variety
Yeah I initially wanted any shape, concave etc, rooms but settled on just using the boxes as changing the visual appearance can offer a lot of what I want in that way. I agree i think the same separation algorithm would probably work with a little modification. If the doors weren't on the grid it might get a little glitchy connecting the rooms. I'm imagining like kind of flexible cave type doors connecting them. Might be some weird edge cases there you'd have to deal with. Initially i misread this comment i thought you meant a continuous infinite grid that auto generates new portions of the dungeon as you walk through, which would be interesting in itself lol. Maybe could have like biomes and just link a bunch of the normal grids together seamlessly.
Hi . Could this addon have feature optionally creation: 1 generate rooms without connections to main net? 2 generate main net within designated 3D area (sphere or similar shape) 3 generate hidden corridors and rooms I want to make some kind of Asteroid Base and have some empty space cells outside the main body of the asteroid formation. And inspect asteroid from outside and like "it could be secret room somewhere in this area" and when dig my way (dynamically geo-modification) to it to have some loot.
I made some changes to the code and have been able to get it to tell the difference between multi-level rooms. I created a bool that's tied to the rooms and tweaked try_connect_floors_with_stair(), all_floors_connected(), and _get_stair_rooms(). I saw some of your other comments that you're going to be working on this again, so let me know if you want to see the changes I did. With those, I can now have rooms that drop down into other rooms and not have them considered a stair room.
Think you might be working with the last version of the code because it sounds like exactly what i added last night haha. In v2 you mark stair rooms explicitly, for use in the floor connect stage
@@flamebuggames still working on it so it may be pretty glitchy for a few days. if you are playing around with it you can open an issue for bugs or message me on discord @majikayogames gonna be working on it a lot for a few days till v2 is stable/done
very elegant implementation! Ive been trying to crack this sort of problem for a while, dabbled between function collapse procedures and even cellular automata, but now I realise that the solution was way more simple! thank you for your clear and concise video, its really inspiring! Only got one question tbh and Im not sure if you mentioned it or not, but besides the algorithm always connecting the nodes to the lowest value, you didnt implement any sort of weighted values for connecting specific types of rooms/modules right? and if thats the case, would it be too complicated to add that functionality to the generator? perhaps as a extra layer of generation after the initial room separation and pathfinding algorithm I imagine, anyhow, excelent work overall! keep on keeping on!
I also initially considered something like wave function collapse. The dream would be to somehow set many desired traits/conditions/restrictions for the shape of the dungeon and have an algorithm which is able to throw you a random selection from that search space based on a seed. My first idea was to just do a brute force search for all configurations but then realized that is an insanely massive search space for even small dungeons, lol. This idea was hobbled together between some other clips I found of 2D dungeons and my own simple idea for a trick to make it work in 3D by connecting with stairs and tracking with union find graph. Plus some logic to allow prefab rooms with required/optional doors. This current version is quite basic, really you can just set the min/max of number of each room, and it picks out of the hat one of the rooms which has
@@MajikayoGames Thank you for the quick and very in depth response! and yeah I totally agree, we seem to have the same concerns and ideas about scalability and specific project scope constrains. I do believe that with your solver approach theres a lot of room for experimentation and integration, and Ill try to throw around some ideas when I get a lil bit of free time soon, but in the meantime, let me thank you again for your attention and time! your video editing and explanation style is awesome!!! keep up!
It only needs merge with the portals, make some doors spawn as portals, add advanturers and skeletons from kaykit, simple basic multiplayer and simple AI movement, and we have a playable demo for the dungeon, and it would be a great game as is I think.
question- I'm trying out a kit that references terrain, while maintaining the standardized "room_size." It looks the DungeonGenerator successfully replicates the heightmap resource collision layer for each room, but doesn't replicate the splatmap resource texture. I know this ain't much to go on, but could you infer why my texture is being generated for each room?
@@futursoup9007 hey sorry just saw this - if you want me to take a look you're welcome to add me on discord, user is majikayogames there. it is a bit difficult to say without seeing it myself but the first thing that comes to mind is the "Local to scene" checkbox in the Resource in the inspector in Godot. There is a lot of tricky stuff that can go on with that. Maybe try setting that on/off for the splatmap or other resources (images, collision shapes, etc) which the terrain uses. also, don't know what terrain you're using. But it could come down to code in the terrain system calling a function on _ready or something, forcing it to regenerate every time it's replicated.
Amazing tool, thank you so much for this! Extremely simple to use without putting too many limits on developer creativity. One thing though, I was messing around with the sample dungeon (except with the stairs removed because I wanted to see how well this worked on 1 floor) and I noticed that the "LivingRoom" kept spawning with doors that led to nowhere, while "AnyRoom" would always remove doors if they didn't lead anywhere. Any reason why this could be, or how to fix it? I noticed renaming the doors to be mandatory would make it so they always spawned with rooms attached, but any reason this room in particular wasn't removing doors to nowhere?
AnyRoom (in SampleDungeonKit.tscn) has a script on it which removes unused doors. LivingRoom does not. In the SampleDungeonKitWithModels.tscn it does. You can have a look at the custom class that extends DungeonRoom (they are built in scripts so you won't see them in the files, they are just built in the scene attached to the room Node3Ds) on AnyRoom in the dev texture one, and the models one has custom scripts on AnyRoom, LivingRoom, and TrapRoom. I am planning to return to this addon but am working on another set of videos first. Will make a note to remove doors on the LivingRoom and maybe add some clarification on how the doors get removed. The idea is to just extend DungeonRoom and .connect to its placed_room() signal to do any post generation cleanup.
Yep I'm planning on creating one. I have a few more videos I'm going to release first that I'm currently working on. But after that I'm revisiting the SimpleDungeons addon and adding features and making a tutorial.
I assume it would be doable, but does this currently support rooms that span more than two floors? Like tall vertical chasm rooms that are 3 or more stories tall, for example?
Yep it does. You can define box shape rooms, with a standardized integer grid size, 1x1x1, 2x1x2, 1x2x3, etc. Then, on the walls of these rooms, you can add a door, also on any of the integer locations, left wall 0,0 right wall, 1,1, etc.
Don't worry about it :) I was super stumped by this problem the first time I approached it. That's why I broke it into the simpler 2D version version. And it took me multiple days of thinking about it all day before it made sense and I had an ok idea of what I wanted. Took me weeks to finish the whole thing. That's the heart of programming in my opinion, getting stuck on something but persevering until you figure it out. When you do this repeatedly you eventually realize the only barrier is time and you can almost solve any problem if you stare at it long enough and read/learn about it enough.
@@MajikayoGames thanks for answer dude. And how did you become such a strong programmer? Was it university or 500 leetcode problems? or something else ? :)
@@SuzukaTheBest i just learned by making a bunch of my own projects mostly actually. googling stuff, watching tutorials, and using other free online learning resources. i first learned to code modding games, i think my first few lines of code were partially copy pasted into a game called second life where you can write your own scripts for various things. i learned a lot more in a game called gmod as well growing up where you can make your own weapons, scripts, vehicles, etc. then i just kept making more mini games and apps and learned as i went along. my advice for any new programmer, might be contrary to what other people say, but i would probably say to try something ambitious/just whatever you want to do right off the bat. even if you can't figure it out or get stuck, you're likely to learn a lot. even if you program for 20 years you will still be learning every single day most likely. so it's fine to be in a bit of an overwhelmed state with things, i feel like i kinda just got used to that. certainly be realistic about what you'll be able to accomplish right away, but there are so many great free online resources for learning programming/gamedev nowadays and it's only getting better every day. have fun with it and make something you like :)
@@SuzukaTheBest hmm i realized my last comment might not have been that clear. what i meant, is that, starting out if you're wondering what direction you take. maybe you have an idea of a game you want to make in your head. what i did when first learning, was just pieced together various tutorials. for example, maybe you want some hack and slash game, well it might be hard to find a tutorial on a whole game of what you have in mind, but you can search tutorials of the many various parts. like how to make a character controller, a fighting mechanic, how to make the 3d models or art, and in this way you can take advantage of the vast amount of tutorials online. and just piece together and hack them together until you get close to what you want. when you're first learning it's fine if you don't understand it all. i think the important thing is to make your own stuff & have fun with it.
@@MajikayoGames First I had a dream to create a clone of mmorpg of my childhood - Lineage 2. (at least single-player version for now) Started with the desire to replicate the inventory system and just stunned how difficult it is. At first glance it seems as easy as to add item in the list and display it in the inventory interface, oh boy how wrong I was. Thought that need to first learn how to program, understand algorithms, etc. I found out about leetcode, it took me a whole day to solve even the first simplest task. (TwoSum) I don't know, maybe it's not my thing and I should give up.
Your work looks great! I've been working on a prototype for a 3D roguelike in UE5 for a bit as a hobby and generating a 3D dungeon is the most critical part that I've been researching (without having found any good resources yet). Any chance you'd make a tutorial/class on implementing this from scratch (or potentially porting this to UE)? I could probably eventually figure it out from the repo, but unfortunately don't have the time to dig into the weeds to figure it out, then also port it over. Probably good udemy material tbh.
Glad you enjoyed! A tutorial, I'm not so sure. The thing with this implementation, the basic idea is very simple, I'm sure you already grasped it from watching the video. It's mostly just astar pathfinding through some rooms. After placing & separating rooms, each floor is just like a 2d dungeon generation. 90% of the time I spent on this was glue code to make it work with godot prefabs & fixing glitchiness. If you implemented it, I think you would find much the same. If you want to get some basic 3d dungeon algorithm similar to this, I think you wouldn't find it too hard. Just placing boxes on a grid then looking at each floor and connecting them basically. The real pain would be getting the system with doors working, I also don't have other features which would make it even more messy, like allowing rooms to be rotated. I also have never really worked with Unreal. Most comfortable in Godot by far. Working on some other tutorials at the moment. A course is an interesting idea, I was thinking about those. If you do want to look through my code, feel free to ask me as many questions as you want here. I'm usually pretty good with responding to comments, I'd be happy to explain any part of the code or give you some advice when you start if you get stuck with anything.
What if i wanted my entrance room to be fixed to a specific position, or Vector3.y value? Like entrance to the dungeon should only spawn in Y = max_height. Is there a way to implement it with the current build or do i need to make a workaround myself? Also, great work on this addon and other videos! That's some high quality content
Currently that's not possible. You'd have to mod the add-on yourself to support that if you wanted it. I'm planning on adding that exact feature soon though. Pre-placing a room in editor, and having the dungeon generate around it/connect to it. I'm doing an FPS tutorial series which I'm going to start releasing in a few days, then after that's done, I'm going to return to SimpleDungeons. ETA I'm thinking like a month or so and I will get to adding that and other features to this add-on since people liked it. And thank you :) glad you enjoyed the video.
@@MajikayoGames I think there is a big problem with the way you spawn rooms right now. Every object inside a room is a copy of each other. Their ids are the same. They are not instances but not unique duplicates. That way when interacting with an object that requires being in a tree this approach fails. My fix rn is to store these objects and wipe them and instantiate again later, but it's a big hickup when it comes to quickly developing and changing new rooms. Might be something worh considering in future versions ;)
@@Potato6153 Going to be returning to working on this add-on soon so I'll make a note of it. Do you happen to have a sample project I can look at? My discord is @majikayogames or you can open an issue on GitHub.
I think there are already a few similar solutions for Unity :) I see one called Daedalus which is free, there is another called Dungeon Architect. I'm sure there's more if you look around.
it's all in GDScript. it's cc0 so theoretically you could just copy all the logic over to unreal engine to clone it and it wouldn't take that long if you had the know-how.
Great work, thanks for open sourcing this! This came at the exact right time, as I've been trying to get something like this working for months. Do you have a Discord for this? I'm currently running into a lot of issues implementing this in my project (not sure what I'm doing wrong), and I'd love to pick your brain on what could be happening.
Awesome work, I have been dabbing myself on this for a while and all content on this gets me obsessed bc is really hard for me lol Are the rooms only connected through 1 hall to any other room or you have multiple routes? Can you check a video I made on this, I kinda made a modified Astar3DGrid finder to avoid diagonal zigzagging hallways, and give me your opinion on it? The video is a bit filled with non related code stuff but you can skip through it I would love to hear you opinion if any on the way I'm generating dungeons. Also I will tear apart all your code I really like your results and I'm really curious on how you did the replacement and optional door logic, 10/10 video
Just watched yours. Love the thumbnail lol. Good summary, I do like your method of connecting to avoid zigzagging hallways, that's one potential downside of the method I'm using now. It's possible to have multiple routes, but it only optimizes for all doors being connected and for all rooms on a floor to be connected, so to add more routes, you could maybe add some corridor rooms in between to force it to connect more. The doors and optional doors unfortunately is not very elegant code, that's probably the messiest part of this. It's just some loops which prefer to pathfind from required doors first, and after connecting all rooms, it will go back and ensure all required doors are connected too. Optional doors are connected if it's convenient to do so or if it happens incidentally during corridor placement. The astar method is interesting. I saw the video by Vazgriz on it too. The reason I didn't go with that strategy was because it was seeming a bit over complicated amd restrictive. For example, what if you want stair rooms of strange shapes, and to make them fit cleanly into the dungeon. Initially when I started this, I thought I might be able to just brute force all the combos of rooms and do a massive search to fill the dungeon grid with connected rooms. But then I realized that is related to something called the 3D bin packing problem which is NP hard and the search would get absurdly massive very quickly as the dungeon scales. It would be difficult even for small dungeons I think. So I decided to think of some heuristics I could do instead to give me a flexible and simple system to achieve what I wanted. I realized I could do similar as the 2D version of this which you can find explained many places and just ensure all floors are connected by stairs. After that it's just the same 2D algorithm. Hope this helps :) and hope that some of my code or concepts I explained can be of use to you in your projects
@@MajikayoGames wow thanks a lot for your response and for checking my vid to give some feedback, I also hope some of my code will inspire ideas on you too, really cool approach I will definitively will learn from it. I plan on sharing my code once is more useful, so people like you can check it more closely maybe use some of it, great video.
I've been playing with the code and it is so much fun. The more I understand your code the more I want to play with it. One thing I've been messing with it the aabbs for non-rectangular rooms. (Think like a Tetris piece) I've been carving out the aabb so that it matches the shape of the room but generation doesn't seem to want to put rooms in that cut out section. Do you have any guidance on how to make the aabbs work as a "Complex Polygon"?
Yeah I actually initially wanted to do this but i realized it was going to be a bit messy to implement. Because there is the aabb logic and then also maybe even messier, the door logic. I think since we're using voxels it'd be pretty easy to do the separation algorithm. The first thing I'm thinking is how will we even draw the irregular AABBs in editor? Perhaps you could break some of the logic for AABBs into its own class. This way you can write some @tool logic to make them placeable in editor, and manage some of the complexity. The current logic just placing a CSGBox3D and nodes for the doors is a bit hacky but simple and easy to implement. With the complexities odd shaped rooms would introduce I think you would be on the verge of where it makes sense to write a whole editor tooling UI to facilitate this. Then you also have the question of how you will do doors. Maybe if writing a separate AABB class, we also put some logic in there for door placement. But I will say this is where i threw my hands up and decided not to do irregular shaped rooms. This makes things a lot messier and opens you up to a lot of edge cases. For example, I think it's a lot harder to detect, and properly place even, doors on concave rooms, maybe even like donut shaped room with holes in them, it would be easy to place an impossible to reach door in the center. Trying to mentally map out how doors fit onto the concave voxels sides got too confusing and I gave up. By all means have a go at it if you want to modify it for your uses, maybe you will create something cooler than I thought of. But consider these ideas i had of why just to go with the simple box AABBs: Do we really need complex shapes? Since we can inherit DungeonRoom, and just hold off on construction of the room until it's placed, i think you could do a lot with that. For example, what if you wanted an L shaped room, with doors all along the vertical part of the interior of the L. Well, you could fake it. By placing doors just on the outside of the AABB, then after placement, carve out the inner part of the L and just spawn in corridor rooms yourself, since its AABB will block out that space for us. Or, what if you wanted a very odd donut shaped room with the ability for a ladder type room to go through it? Well, again it might be better to just do this after generating, have the donut room, and model it with the ladder room inside, all part of the same AABB, but inaccessible depending on which door you went through and the ladder room would get deleted if not used, similar to how I remove door cuts in the AnyRoom/corridor code post generation. I think this offers a lot of possibilities. Also, there are more features to make it more varied and interesting before trying concave rooms. We could add rotated rooms. We could add pre placed rooms so you could have some ones you place in the grid which also could be static like a mansion front door. We could add more features to facilitate inheritance of DungeonRoom and allow for more odd variations of the generation process at various points, right now it's just a signal that is emitted once it's placed. One quick note if you're modifying my code I just remembered is you'll see some places I used "door cache or aabb cache" or something like that, reason for this is only for multithreaded generation, some rules in godot you can't access transforms directly from other thread. I forgot to leave a comment I think. Anyway, these are my thoughts. Hope this helps :)
@@MajikayoGames Thank you for the giant response, you got my brain going again with new ideas. My whole reason for wanting to make the complex room shapes was so that it would be possible to cram more rooms into a smaller space. I had never thought of placing the rooms manually afterwards, I do like that. I've been working with the code you put in for the dungeon with models, specifically the placement of torches and walls and such and its such a genius and simple way of going about it. I would've never thought of doing it like that and I love it. I have clutter to randomly spawn in the "AnyRoom", where I ran into the issue where all the clutter is facing the same way. Your code gave me the inspiration to use the RandomNumberGenerator to randomly rotate the clutter in 90 degree intervals after its placed to help break up any repeats. I have all the clutter in a 3D Node in the center of the room, where the clutter child nodes are arranged where it will never block a door. Then the RandomNumberGenerator generates a number between 0 and 20, with each quarter rotating the Parent Clutter 90 degrees. The only caveat with it I've found, is that the items have to be on the floor or the ceiling, as you already have solid wall code to handle anything else. I have also modified the "AnyRoom" to bring down the ceiling and bring in the walls by changing the cut shapes to make more narrow halls. Overall, I've been obsessed with it and have been making so may rooms because you made it so easy. For me, your code has been intuitive and made in a way that if I don't understand something, its easy to find out. My next hurdle is to try to get some generation where the two or more doors are not connected to the same corridor. Some rooms will just have the same hallway stretch around to both doors and it feels weird. This even happens when a shorter route was available. This is more of a preference though as a need, because I have some "Hazard" rooms. The goal would be that specifically for hazard rooms that if one door is connected to a corridor that the other door cannot connect to the same corridor or has to be so many voxels between the doors. This way the rooms are more likely to provide an alternate path to something else like a room or the other side of the maze, giving players a choice of "going the long way around" or "risking it and going through". There's even the possibility that the only way to get to a room is to go through the Hazard room. The Starter room is also a good example of this, where most often, all 3 doors are connected to the same single corridor, eliminating any choice. Anyway, thanks for the reply again and I look forward to any modifications you share on the code if any. I just think its so much fun working with other people making things so cool.
@@flamebuggames yes that is definitely one flaw with how it is now, the corridors are a bit odd, especially how multiple doors often just wrap around into the same corridor. First thing I'd play with for that is the astar grid code in i think it's the DungeonUtils file. Currently it has the heuristic of astar set to 0, and so it becomes dijkstras, which guarantees the shortest path. (Dijkstra's plus an added heuristic to govern which paths are checked first becomes astar). Astar/djikstras optimizes for the shortest aka lowest cost path. And currently i have corridors set to 0 to walk through. So it will prefer to always walk through an existing corridor even if there is another shorter path. The reason i choose djikstras is because iirc astar with intermittent zero cost tiles like that will not guarantee the shortest path. Maybe could play with that code, have corridors cost less but not 0. Also I think i saw something about how using euclidian distance (maybe godot has some preset for this as well) as a heuristic in astar can help avoid zigzagging hallways. I think it would be good to provide some options for tweaking the pathfinding algorithm used to on the dungeons. Glad you're having fun with it and glad my code is understandable :) I feel it was ok but could have been cleaner/more clear. In terms of future updates for it, I can't guarantee. Working on a few other videos and tutorials at the moment as well as some other Godot add-ons. Most recently just made some small changes to it to allow generating in editor via a checkbox and added some debug info. If anything it would probably be more sporadic updates to it like that whenever I get some ideas. Unless i get some good PRs i feel like accepting.
You can save the generated dungeon by generating it in editor using the editor force generate checkbox and then saving that scene. If you generate a level in game, then you could copy the seed from the debug console and paste it in before you generate in editor.
@@MajikayoGames Generate in editor button is not working. It says to have Dungeon kit set and I have it in "Dungeon Kit Scene" Set editor_button_generate_dungeon scene/resources/packed_scene.cpp:220 - Condition "!sdata.is_valid()" is true. Returning: nullptr Set editor_button_generate_dungeon SimpleDungeons Error: Must have a dungeon kit set to generate the dungeon. Unable to generate dungeon.
OK the game had to be running for it to work. Or is says it works but I'm not seeing any dungeon in the editor Using dungeon generation seed: 7829143906678547912 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] { 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9 } Success placing Separating... Separating... Suceeded in separating all rooms. Finished connection stage successfully
@@Yoni123 Is it one of the default included kits or is it one you made? If it's one you created or imported, I suggest looking at the default 2 dungeons kits included with it to see how they should be structured. The DungeonKit is required to have the DungeonKit.gd script on it and be set up in a particular way. There is also some information in the readme. I plan to do a more comprehensive tutorial on it soon but until then it may be a little hard to work with.
It should work fine with any dungeon pack as long as you can create evenly sized rooms with it, as well as a 1x1x1 (in whatever you set the voxel size units to) hallway room.
muito bom, tem muito potencial de uso até para ser usado por fora em jogos de plataforma. parabéns e obrigado por compartilhar. eu criava salas assim em voxel art em uma trabalheira e depois abria no blender para criar cenários como cavernas etc. eu pergunto como noob em godot. tem como exportar o cenário criado em gltf ou outro formato 3d para editar no blender.
Well I was playing a lot of lethal company at the time, and wanted to make a similar game. I am still planning one but my vision of it has shifted. For now, I have a bunch of videos planned, more educational explanation types like this one mostly. Will see how they do and upload some of what I'm working on to see what it takes shape to.
The main bottleneck is just spawning rooms models etc in the game engine i think. Everything else is pretty fast. I think the slowest part of the actual algorithm would just be running astar/dijkstras to connect the rooms. Maybe also the separation algorithm since i just wrote it in GDscript, could be way faster if I wrote it in native code and actually tried to optimize. But it's fast enough for me. I haven't ran into any crashes, i just added a max safe iterations value to prevent getting stuck while generating. There are probably some bugs, off the top of my head if you have some irregularly shaped rooms maybe it could cause some issues. If i ever used this in a full game, there are many more features I'd like to add and I would test it more thoroughly with more varied dungeons. But overall it has worked well every time I've tried it.
hey bud i've been gathering performant c methods for audio modeling/synthesis for decades. i should have something to share from my first opengl game using XBPD physics and various procedural methods sometime soon. one of my life things i do is cultivate distributors of numeric method eg. not every dev knows iniquilez, matthias mueller, 2nd order interpolation haha et c.. gotta run atm but ima nec wu in a few.
Interesting idea. You mean for room shapes or for the full dungeon shape? Current everything is just box shaped, dungeon and individual rooms. I think it wouldn't be too difficult to make it some interesting shape like an octagon. Same concepts apply. you could add something in the separation phase perhaps like static edges around the dungeon, to form the sides of the octagon, that would be in a fixed position so as to force the dungeon in an octagon shape. If you needed rooms in the shapes of octagons, you could either leave them box shaped for room placement and just have the visually as octagons basically, or modify the separation algorithm to work with different shapes than just boxes. I thought about doing this but didn't implement it.
@@MajikayoGames for connections and such. it would allow slanted paths. i would say for room types the cubes are enough, i have an idea i just can't type it, it's more visual. i don't have the time sadly because when i have time for gamedev i do a character controller, and blender.
This add-on is just written for Godot so my code would not run in unity no. Anyone is welcome to copy/port the code over though since it's public domain. I think there may already be some solutions for this on the unity asset store you could check out first though.
@@Alshim You might find the source for the 2D demo useful: majikayogames.github.io/dungeon_algorithm/dungeon_rooms_2d/index.html Source for the logic is all in the script.js file: majikayogames.github.io/dungeon_algorithm/dungeon_rooms_2d/script.js Just placing rooms & pushing them apart is pretty easy, you can go with my algorithm, or just make one with a similar idea, spawn many rooms in random locations, and then just keep pushing them apart if they overlap. Then you have some options to go for for connecting rooms. If you don't need specifically placed doors it may be simpler than mine. Most game engines will have an AStar class you can use to pathfind between the rooms. You don't have to do it exactly like I did. There are many style of room connections you can do. Main idea is just to to some AStar pathfinding on a grid to ensure the various rooms have hallways between them.
Hello! I Iike this, but most certainly it is not complete. You do not make the player to believe that the dungeon is not random by nature, but the imaginary builders have decided to build the dungeon this way for an unkown reason. The best way against this is showing the player a reason. For example with very vertical dungeon designs, you are able to show something vertical when the player looks out the window, feeling that the dungeon looks that way due to it being built around something, or along something. Also when you are in a building, you can kinda feel that there are rooms behind walls, but this case you can not expect such thig, as it is random. It feels not natural for a building that divides its rooms with no pattern basicaly. With this pattern i mean that there are way too long corridors, but there are no rooms along those, and you are not even showing the player the reason by for example placing windows along that corridor through which the immersion is kept up in the player's point of view. Also when you "carve out" a space under ground for example, you are not carving it out always as expected, so you might end up with a bunch of room cluttered to one another, and then other rooms cluttered to one another, but in the maps you are creating there are only lofty (, or solo) rooms. The thing is this does not always apply to carving. The most obvious real world comparison are the relation of cities. You can travel between them, but realy cities are just a good bunch of rooms inconsistently cluttered together. The other thing is that you procedurally generate every single map in a way that does not exploit the mathematical nature of bringing back the same map with a single seed. Using seeds is a must do for procedural generations because you do not have to save the entire map, only the seed. In fact that is one of the greatest leverage of a procedural map, that you are not taking. I suggest that instead of moving the rooms until they are separate, make some kind of a grid of the rooms in order for a seed to work, and then use the path finding algorythm. Do not forget to fill up the empty spaces with scenes that the player can see, or lightly interact with, like walking into it. Maybe empty rooms for example.
Appreciate the comment! You got some interesting ideas, I thought of something like this myself. Initially my vision was to be able to carve out the dungeon, so it was more like a building. I considered some wave function collapse type setup, or other various setups related to carving. However, I was set on the idea of easily being able to define prefab rooms for this for my uses. So this algorithm is rather simple to accommodate for this requirement. It has the advantage of being simple, but that's also a disadvantage in some ways too, there are more interesting generation styles we could do. Yes this idea of seeing out of the dungeon as a building is an interesting one. One way initially I had thought of doing this, was have 'static' rooms pre-placed (maybe they could be randomized on a separate simple algorithm) maybe around the perimeter, to guarantee a building shape. These rooms would always have windows to look outside. You could also do stuff like door rooms fitting to the outer level environment by using the static room concept, like pre-place an entry room on the edge of the dungeon in the preview editor, the the rest would generate around that, not moving the initial room. I have not implemented this as of yet, but might someday. Being able to use prefab rooms how I want, I figured if I wanted any more interesting generation features, I could augment the algorithm with ideas like the above static rooms one, and so I decided to just go with this simple algorithm. It also is nice that it is simple so others can use it as a starting point to modify it :) as it's public domain code. On the point of it not randomly generating on the same seed, it should do so, as long as the dimensions of the map are the same too. If this is not the case in the final Godot add-on, that is a bug you have found.
I highly appreciate your response. I think there is no bug with the seed, because i was just telling my expectation. I am also very interested in algorithms like this, and it is very good that you have made one. i hope to see more map generation algorithms from you.@@MajikayoGames
HOLY CRAP! I just got some insane whiplash, I used the EXACT same dungeon asset pack for a game prototype (Weapon of Wonder on my channel) and this procedural generation would fit right in with the game! Awesome stuff!! :D
So cool. Any even though the current iteration isn't _terribly_ interesting as an explorable space, it would still be immediately interesting to place something like a competitive FPS within it
But then, making it interesting as an exploration space seems just a matter of iterating on the algorithm and adding more pre-fabs
Yep I think anyone who is a bit more creative than me could probably find some some ways to work it and create some interesting dungeon kits. It's also CC0 so anyone may modify or take portions of it to improve for their own uses.
that gets me thinking about how interesting a competitive fps with randomly generated maps could be
Due Process is a game that practiced this in a smaller extent
@@branm5459and they realised that its not a good idea for competitive play as it's too unpredictable in terms of balance. The way they do it is by curating the generated maps. So the actual maps are proc gen'd, but they only 'release' the ones that are relatively balanced
This is incredibly cool! Making a doom-inspired roguelike FPS game, and just stumbled upon this video randomly; Definitely a lot of inspiration I can take from this! Super cool work! ^^
How do make the player spawn in the starting room? How do I save the generated dungeon?
This is EXACTLY what I was looking for, thank you so much for providing this for free. Will absolutely be using it for my first project!
Love it. Seen some great content on Majikayo recently. I really appreciate time spent going thorough the problem solving process and algorithms. Super valuable. Thanks, for your time and effort - keep it coming (if possible)!
Thank you! Yep, planning on pumping out a bunch more content soon. Experimenting with different video types now to see what does best. I think I might go back to tutorials since my first stairs tutorial video is still the most viewed on the channel.
Cool video.
On your point about the locked situation where rooms don't separate fully, you could add a step to your algorithm that shrinks the rooms as the final step in that case in order to provide the separation. If every red room decreases by one, until they are no longer in violation of the constraints.
Also, on your solution to the Islands, another option would be to make it a feature of the algorithm using portals - adding some variety to they levels i.e. isolated rooms at the end are assigned a portal to a random location in the connected dungeon rooms.
This is awesome I've been looking for the past few days to see if there were many videos about 3D dungeon generation like this and there really aren't any and the ones that are out there don't do things like this, your video is exactly what I was looking for!
Glad you enjoyed :D! Let me know if you have any questions or anything I can help with about it
you are the greatest!!! for the past 3-4 months i have been banging my head against a wall trying to do this and just when I was ready to give up I saw this, tysm!! its pretty funny i found it because I was taking a little break and trying to make some water when i saw your realistic water tutorial
Glad i could help :D love seeing comments like this. Let me know if you need any advice along the way implementing it or using my system
I've been looking for something like this for quite a long time, thank you so much for making this
Wow. I love the dungeon generation system. I used the recursive backtracking technique, but I found it got boring with just winding corridors - I was trying to somehow superimpose the rooms after the maze generation, but it got really weird and glitchy. Glad I found this video! Inspired me to keep at a project I was sooo close to giving up on. I will attempt to ‘borrow’ the idea outlined in this video instead of floundering through my own maze of twisting errors. Have a cookie 🍪, and a sub :)
Sure thing! Please take as much code as you want from mine :) that's why it's cc0 public domain. And ask me here if you got any questions, hopefully I can save you some time if you get stuck.
@@MajikayoGames How difficult would it be to convert the demo/graybox phase version into unity, to run in editor (not at run time). It seems like it would be a great grayboxing phase starting point to get early design samples to start with.
@@Koniving if you just wanted to port it, i would imagine it wouldn't be too difficult if you knew what you were doing, all source code + multiple explanation videos are available. im not super well versed on unity, more godot, but really the complex part is just getting all the little details working right like room rotation, prefabs, etc. the initial version of this i got up and running pretty quick. and most of that was just trying to figure out how to solve the problem.
Your can also add and spawn prefab room without any doors to make the dungeon less clumpy
i learned this the hard way. some things DONT need to be self learned :(
nice and simple way to explain.
This is cool and easy to use! I will be utilizing this for building D&D dungeons on a Minecraft server I play on (And actual D&D for that matter). This will save a ton of time with the basic layout.
Ah awesome you mean the web prototypes? Great glad it seems useful to you. You can save the seed too if you close out the tab and it should be deterministic (3D one only)
This is insanely awesome! And the video is absolutely easy to follow. Good codes and good edit!
Awesome :D! Thanks so much for your comment.
Fun to watch and very inspiring. Thank you for the video!
Absolutely beautiful. Been trying to learn this kind of 3d procedural generation. Loved the explanation, keep up the good work
Great video! I just started creating my game and I'm thinking of procedural generation to create a lot of stuff since I'm alone and do not want to spend most of my time designing stuff in the game, so your vide gave me good ideas. Thanks!
Nice! I think you might be overcomplicating the last step of connecting all the rooms. You can just A* from one room to all the others to make sure there is a path, and carve one if not.
Ah good point. There may be a way to simplify that in the code some more. The current way I went about doing it uses dijkstras with the cost of the corridors set to 0. The rooms aren't passable right now because it was getting a little complicated to detect whether we could walk thru, can only walk through/out of a room on a side with a door. I think the pathfinding would work if I fixed that... May also be preferable because then I don't think it would be very difficult to add support for things like, isolated islands which are accessible from other floors. So it would make the dungeon possible to be a bit more sparse. Might add this in the future! Thank you for your comment appreciate it:)
GENIUS ! thanks for the addon !
Thank you very much! Waited for this such a long time
This gave me a lot of inspiration, I'm using a very different algorithm for procedural generation with UE5. However, the verticality is amazing, and I really want to make it a part of my design one way or another.
Nice algorithm! It seems easy to change the result, since you can move rooms and use pathfinding. You can change how clustered rooms will be or modify the pathing heuristics with ease.
This is fantastic, great explanation and brilliant video
this methods makes really good tower levels.
This is so good! Thanks for uploading!
Damn, very impressive and exactly what I was looking for. Thanks!
Been looking for this exact thing for months. It's impressive, now may be time to discover how to spawn the player inside dungeon to explore it.
Where have you been half a year ago?
I tried to do the same stuff your videos have for ages
Well, i guess it's time to fix my barely-functional code for portals and staircase and use all of those rooms i had made, very inspiring, thanks)
:D let me know if I can give any advice along the way. Good to save each other time.
Very cool, I’ve been working on developing a system for building multilevel dungeons in D&D using 3D printed tiles. I’ll be checking this out to build some new and unique layouts for the table top.
Ohhh that looks very cool how that works. Procedual generated environments are interesting. They often are a hit or miss with me depending on the diversity of the pieces and application and how lost you become in them. When it's a hit it's reconizeable and interesting and has some variety on your current situation (different loadouts different abilities different enemies) when it's a miss it's just the same big room with a statue you've seen a bunch of times already.
Man this channel is amazing!!!
Something I've been noodling out is generating hallways by joining the exits of rooms with splines so you can have procedurally generated curvy hallways. You could make some sloped hallways as an alternative to stairs.
Great idea.. I've been using spline paths in godot as well lately, pretty fun and quick to get some interesting designs with them. Now I'm imagining some giant noodle dungeon with the corridors twisted and tied around other. Lol
@@MajikayoGames that seems like a dangerous way to start learning about matchmatical graph untangling. Now that I think of the spline hallway thing, I think Deep Rock Galactic does the same thing where they place pre-made caverns and pipe them together with splines.
you a hero!, que buen elemento te ganaste un seguidor.
Waddup, my fellow roguedev!
I haven't messed around two much with 3D tile generation since the early 2010s, but if you want I have a few dungeon complex algorithms I've open sourced that you're more than welcome to check out. Would love to see you come up with a 3-dimensional Qix maze, for instance.
Watched your vid on it! Great job, you gave a great breakdown on a variety of techniques for dungeon generation. For the Qix maze, that does look interesting, I considered something like that initially, but I realized if I have prefab rooms of varying tile dimensions, it can be hard to fit them into the space carved by pathfinding style algorithms. I was imagining that I might want some more interesting room shapes, or weirdly shaped stair rooms, spanning multiple tiles, doors at specific locations on the sides of the rooms, so that lead me to this implementation. Initially was going to allow any shape of rooms, but at some point I got lazy and just made them boxes XD
I actually really liked your maze generator example in that vid though. I was thinking of how to do that, have never seen it talked about, how to do mazes procedurally.
The stair handling looks awesome will you be making the controller tutorial soon ?
Really really inspiring. Thanks
That is so cool. Thanks 😎👍
Over the last couple weeks i’ve been doing something quite similar, but in unity, and it works without a corridor algorithm
Would it be possible to have more than just halls or stairs connecting rooms, instead of saying it is a door you also have like vents or holes so you could have tunnels or ductwork between rooms in addition what you have. It would also be neat to be able to essentially define or paint weights on your dungeon grid so it will try and generate certain structure types in certain areas and others elsewhere. For like if they are going from like a dungeon into a cave for example. This is cool as hell though so far.
For vents and holes, it's possible you could hook into some hook for post dungeon generation, and then generate them yourself in if you wanted them on a separate grid than the dungeon not aligned with the rooms. I have thought about some way to customize which rooms spawn where, I'm about to start working on this addon again so I'll keep it in mind, probably what I would do is allow it to be customized in code some way, like provide a hook function for the user to use as a callback to provide some info for how/where which rooms should spawn, maybe on which floor, etc.
@@MajikayoGames Same grid I guess more along what i meant just instead of it trying to generate a hallway/stairs between those two points it knows that it needs to draw from a different set of tiles like tunnel/ductwork for example. I am assuming with a hook like you could tell it to generate a like door or object to use as a spawn point or exit or other items.
There is a old game now called anarhcy online that uses procedural generation for it's like side missions in game, you set the parameters when rolling for missions, it gives you a contract basically your key and a location somewhere in the world it basically says when you walk through that door you enter mission. This so far reminded me of that a lot, its awesome stuff keep at it.
I'd love to see a version of this algorithm that works in a continual 3d space without the larger 3d grid - I don't see the method of push separation varying that massively without discrete 3d grid spaces, but the pathfinding algorithm may be a bit more demanding. The advantage of this being that the inputted rooms and corridor dimensions could be any size you wanted, if you needed more variety
Yeah I initially wanted any shape, concave etc, rooms but settled on just using the boxes as changing the visual appearance can offer a lot of what I want in that way. I agree i think the same separation algorithm would probably work with a little modification. If the doors weren't on the grid it might get a little glitchy connecting the rooms. I'm imagining like kind of flexible cave type doors connecting them. Might be some weird edge cases there you'd have to deal with.
Initially i misread this comment i thought you meant a continuous infinite grid that auto generates new portions of the dungeon as you walk through, which would be interesting in itself lol. Maybe could have like biomes and just link a bunch of the normal grids together seamlessly.
Hi .
Could this addon have feature optionally creation:
1 generate rooms without connections to main net?
2 generate main net within designated 3D area (sphere or similar shape)
3 generate hidden corridors and rooms
I want to make some kind of Asteroid Base and have some empty space cells outside the main body of the asteroid formation. And inspect asteroid from outside and like "it could be secret room somewhere in this area" and when dig my way (dynamically geo-modification) to it to have some loot.
I made some changes to the code and have been able to get it to tell the difference between multi-level rooms. I created a bool that's tied to the rooms and tweaked try_connect_floors_with_stair(), all_floors_connected(), and _get_stair_rooms(). I saw some of your other comments that you're going to be working on this again, so let me know if you want to see the changes I did. With those, I can now have rooms that drop down into other rooms and not have them considered a stair room.
Think you might be working with the last version of the code because it sounds like exactly what i added last night haha. In v2 you mark stair rooms explicitly, for use in the floor connect stage
@@MajikayoGames Welp. I didn't realize there was a newer version of the code. I'll go check that out, lol.
@@flamebuggames still working on it so it may be pretty glitchy for a few days. if you are playing around with it you can open an issue for bugs or message me on discord @majikayogames
gonna be working on it a lot for a few days till v2 is stable/done
very elegant implementation! Ive been trying to crack this sort of problem for a while, dabbled between function collapse procedures and even cellular automata, but now I realise that the solution was way more simple! thank you for your clear and concise video, its really inspiring! Only got one question tbh and Im not sure if you mentioned it or not, but besides the algorithm always connecting the nodes to the lowest value, you didnt implement any sort of weighted values for connecting specific types of rooms/modules right? and if thats the case, would it be too complicated to add that functionality to the generator? perhaps as a extra layer of generation after the initial room separation and pathfinding algorithm I imagine, anyhow, excelent work overall! keep on keeping on!
I also initially considered something like wave function collapse. The dream would be to somehow set many desired traits/conditions/restrictions for the shape of the dungeon and have an algorithm which is able to throw you a random selection from that search space based on a seed. My first idea was to just do a brute force search for all configurations but then realized that is an insanely massive search space for even small dungeons, lol. This idea was hobbled together between some other clips I found of 2D dungeons and my own simple idea for a trick to make it work in 3D by connecting with stairs and tracking with union find graph. Plus some logic to allow prefab rooms with required/optional doors.
This current version is quite basic, really you can just set the min/max of number of each room, and it picks out of the hat one of the rooms which has
@@MajikayoGames Thank you for the quick and very in depth response! and yeah I totally agree, we seem to have the same concerns and ideas about scalability and specific project scope constrains. I do believe that with your solver approach theres a lot of room for experimentation and integration, and Ill try to throw around some ideas when I get a lil bit of free time soon, but in the meantime, let me thank you again for your attention and time! your video editing and explanation style is awesome!!! keep up!
It only needs merge with the portals, make some doors spawn as portals, add advanturers and skeletons from kaykit, simple basic multiplayer and simple AI movement, and we have a playable demo for the dungeon, and it would be a great game as is I think.
v dope! Thanks mate 🦜
question- I'm trying out a kit that references terrain, while maintaining the standardized "room_size." It looks the DungeonGenerator successfully replicates the heightmap resource collision layer for each room, but doesn't replicate the splatmap resource texture. I know this ain't much to go on, but could you infer why my texture is being generated for each room?
@@futursoup9007 hey sorry just saw this - if you want me to take a look you're welcome to add me on discord, user is majikayogames there. it is a bit difficult to say without seeing it myself but the first thing that comes to mind is the "Local to scene" checkbox in the Resource in the inspector in Godot. There is a lot of tricky stuff that can go on with that. Maybe try setting that on/off for the splatmap or other resources (images, collision shapes, etc) which the terrain uses. also, don't know what terrain you're using. But it could come down to code in the terrain system calling a function on _ready or something, forcing it to regenerate every time it's replicated.
Have you worked with this inside a project that uses a voxel based world? I'm curious how to integrate this in a way like minecraft uses caves.
Amazing tool, thank you so much for this! Extremely simple to use without putting too many limits on developer creativity.
One thing though, I was messing around with the sample dungeon (except with the stairs removed because I wanted to see how well this worked on 1 floor) and I noticed that the "LivingRoom" kept spawning with doors that led to nowhere, while "AnyRoom" would always remove doors if they didn't lead anywhere. Any reason why this could be, or how to fix it?
I noticed renaming the doors to be mandatory would make it so they always spawned with rooms attached, but any reason this room in particular wasn't removing doors to nowhere?
AnyRoom (in SampleDungeonKit.tscn) has a script on it which removes unused doors. LivingRoom does not. In the SampleDungeonKitWithModels.tscn it does. You can have a look at the custom class that extends DungeonRoom (they are built in scripts so you won't see them in the files, they are just built in the scene attached to the room Node3Ds) on AnyRoom in the dev texture one, and the models one has custom scripts on AnyRoom, LivingRoom, and TrapRoom.
I am planning to return to this addon but am working on another set of videos first. Will make a note to remove doors on the LivingRoom and maybe add some clarification on how the doors get removed. The idea is to just extend DungeonRoom and .connect to its placed_room() signal to do any post generation cleanup.
@@MajikayoGames Oh damn I feel silly, I totally missed that.
Thank you so much! Again, awesome tool!
Can you make a step by step video tutorial on how to do that using that modular kit?
Yep I'm planning on creating one. I have a few more videos I'm going to release first that I'm currently working on. But after that I'm revisiting the SimpleDungeons addon and adding features and making a tutorial.
@@MajikayoGames Thanks
Eyyyy! Godot? Instant sub!
I assume it would be doable, but does this currently support rooms that span more than two floors? Like tall vertical chasm rooms that are 3 or more stories tall, for example?
Yep it does. You can define box shape rooms, with a standardized integer grid size, 1x1x1, 2x1x2, 1x2x3, etc. Then, on the walls of these rooms, you can add a door, also on any of the integer locations, left wall 0,0 right wall, 1,1, etc.
This is so cool!
After watching this I'm like: "Sorry for me even starting to learn game dev"
Don't worry about it :) I was super stumped by this problem the first time I approached it. That's why I broke it into the simpler 2D version version. And it took me multiple days of thinking about it all day before it made sense and I had an ok idea of what I wanted. Took me weeks to finish the whole thing. That's the heart of programming in my opinion, getting stuck on something but persevering until you figure it out. When you do this repeatedly you eventually realize the only barrier is time and you can almost solve any problem if you stare at it long enough and read/learn about it enough.
@@MajikayoGames thanks for answer dude.
And how did you become such a strong programmer?
Was it university or 500 leetcode problems? or something else ? :)
@@SuzukaTheBest i just learned by making a bunch of my own projects mostly actually. googling stuff, watching tutorials, and using other free online learning resources. i first learned to code modding games, i think my first few lines of code were partially copy pasted into a game called second life where you can write your own scripts for various things. i learned a lot more in a game called gmod as well growing up where you can make your own weapons, scripts, vehicles, etc. then i just kept making more mini games and apps and learned as i went along. my advice for any new programmer, might be contrary to what other people say, but i would probably say to try something ambitious/just whatever you want to do right off the bat. even if you can't figure it out or get stuck, you're likely to learn a lot. even if you program for 20 years you will still be learning every single day most likely. so it's fine to be in a bit of an overwhelmed state with things, i feel like i kinda just got used to that. certainly be realistic about what you'll be able to accomplish right away, but there are so many great free online resources for learning programming/gamedev nowadays and it's only getting better every day. have fun with it and make something you like :)
@@SuzukaTheBest hmm i realized my last comment might not have been that clear. what i meant, is that, starting out if you're wondering what direction you take. maybe you have an idea of a game you want to make in your head. what i did when first learning, was just pieced together various tutorials. for example, maybe you want some hack and slash game, well it might be hard to find a tutorial on a whole game of what you have in mind, but you can search tutorials of the many various parts. like how to make a character controller, a fighting mechanic, how to make the 3d models or art, and in this way you can take advantage of the vast amount of tutorials online. and just piece together and hack them together until you get close to what you want. when you're first learning it's fine if you don't understand it all. i think the important thing is to make your own stuff & have fun with it.
@@MajikayoGames First I had a dream to create a clone of mmorpg of my childhood - Lineage 2. (at least single-player version for now)
Started with the desire to replicate the inventory system and just stunned how difficult it is. At first glance it seems as easy as to add item in the list and display it in the inventory interface, oh boy how wrong I was.
Thought that need to first learn how to program, understand algorithms, etc. I found out about leetcode, it took me a whole day to solve even the first simplest task. (TwoSum) I don't know, maybe it's not my thing and I should give up.
Your work looks great! I've been working on a prototype for a 3D roguelike in UE5 for a bit as a hobby and generating a 3D dungeon is the most critical part that I've been researching (without having found any good resources yet).
Any chance you'd make a tutorial/class on implementing this from scratch (or potentially porting this to UE)? I could probably eventually figure it out from the repo, but unfortunately don't have the time to dig into the weeds to figure it out, then also port it over. Probably good udemy material tbh.
Glad you enjoyed! A tutorial, I'm not so sure. The thing with this implementation, the basic idea is very simple, I'm sure you already grasped it from watching the video. It's mostly just astar pathfinding through some rooms. After placing & separating rooms, each floor is just like a 2d dungeon generation. 90% of the time I spent on this was glue code to make it work with godot prefabs & fixing glitchiness. If you implemented it, I think you would find much the same. If you want to get some basic 3d dungeon algorithm similar to this, I think you wouldn't find it too hard. Just placing boxes on a grid then looking at each floor and connecting them basically. The real pain would be getting the system with doors working, I also don't have other features which would make it even more messy, like allowing rooms to be rotated.
I also have never really worked with Unreal. Most comfortable in Godot by far. Working on some other tutorials at the moment. A course is an interesting idea, I was thinking about those.
If you do want to look through my code, feel free to ask me as many questions as you want here. I'm usually pretty good with responding to comments, I'd be happy to explain any part of the code or give you some advice when you start if you get stuck with anything.
What if i wanted my entrance room to be fixed to a specific position, or Vector3.y value? Like entrance to the dungeon should only spawn in Y = max_height. Is there a way to implement it with the current build or do i need to make a workaround myself?
Also, great work on this addon and other videos! That's some high quality content
Currently that's not possible. You'd have to mod the add-on yourself to support that if you wanted it. I'm planning on adding that exact feature soon though. Pre-placing a room in editor, and having the dungeon generate around it/connect to it. I'm doing an FPS tutorial series which I'm going to start releasing in a few days, then after that's done, I'm going to return to SimpleDungeons. ETA I'm thinking like a month or so and I will get to adding that and other features to this add-on since people liked it. And thank you :) glad you enjoyed the video.
Sounds great! That would be perfect for a mix of hand crafted and procedural content
@@MajikayoGames I think there is a big problem with the way you spawn rooms right now. Every object inside a room is a copy of each other. Their ids are the same. They are not instances but not unique duplicates. That way when interacting with an object that requires being in a tree this approach fails. My fix rn is to store these objects and wipe them and instantiate again later, but it's a big hickup when it comes to quickly developing and changing new rooms. Might be something worh considering in future versions ;)
@@Potato6153 Going to be returning to working on this add-on soon so I'll make a note of it. Do you happen to have a sample project I can look at? My discord is @majikayogames or you can open an issue on GitHub.
@@MajikayoGames Yea sure, I can send you a project of my game on discord
interesting, good job!
Weird question but how can you make this in unity instead. Im looking for exactly this but for unity 3D instead
I think there are already a few similar solutions for Unity :) I see one called Daedalus which is free, there is another called Dungeon Architect. I'm sure there's more if you look around.
What language is the plug-in? What would it take to make something like this for Unreal Engine 5 or C++?
it's all in GDScript. it's cc0 so theoretically you could just copy all the logic over to unreal engine to clone it and it wouldn't take that long if you had the know-how.
I literally just got into game dev with the goal of creating this system and making a game around it, im glad and sad to see someone beat me to it
Well then you can go and take my code for it and start working on the other parts for it :) it is in public domain so you may use it for whatever
Great work, thanks for open sourcing this! This came at the exact right time, as I've been trying to get something like this working for months. Do you have a Discord for this? I'm currently running into a lot of issues implementing this in my project (not sure what I'm doing wrong), and I'd love to pick your brain on what could be happening.
Sure I don't use discord much just asking here might be better but you can message on discord you want, my username there is: majikayogames
@@MajikayoGames Thanks so much!! My username is the same as on TH-cam. Just sent you a friend request.
Awesome work, I have been dabbing myself on this for a while and all content on this gets me obsessed bc is really hard for me lol
Are the rooms only connected through 1 hall to any other room or you have multiple routes?
Can you check a video I made on this, I kinda made a modified Astar3DGrid finder to avoid diagonal zigzagging hallways, and give me your opinion on it? The video is a bit filled with non related code stuff but you can skip through it I would love to hear you opinion if any on the way I'm generating dungeons.
Also I will tear apart all your code I really like your results and I'm really curious on how you did the replacement and optional door logic, 10/10 video
Just watched yours. Love the thumbnail lol. Good summary, I do like your method of connecting to avoid zigzagging hallways, that's one potential downside of the method I'm using now. It's possible to have multiple routes, but it only optimizes for all doors being connected and for all rooms on a floor to be connected, so to add more routes, you could maybe add some corridor rooms in between to force it to connect more.
The doors and optional doors unfortunately is not very elegant code, that's probably the messiest part of this. It's just some loops which prefer to pathfind from required doors first, and after connecting all rooms, it will go back and ensure all required doors are connected too. Optional doors are connected if it's convenient to do so or if it happens incidentally during corridor placement.
The astar method is interesting. I saw the video by Vazgriz on it too. The reason I didn't go with that strategy was because it was seeming a bit over complicated amd restrictive. For example, what if you want stair rooms of strange shapes, and to make them fit cleanly into the dungeon.
Initially when I started this, I thought I might be able to just brute force all the combos of rooms and do a massive search to fill the dungeon grid with connected rooms. But then I realized that is related to something called the 3D bin packing problem which is NP hard and the search would get absurdly massive very quickly as the dungeon scales. It would be difficult even for small dungeons I think. So I decided to think of some heuristics I could do instead to give me a flexible and simple system to achieve what I wanted. I realized I could do similar as the 2D version of this which you can find explained many places and just ensure all floors are connected by stairs. After that it's just the same 2D algorithm.
Hope this helps :) and hope that some of my code or concepts I explained can be of use to you in your projects
@@MajikayoGames wow thanks a lot for your response and for checking my vid to give some feedback, I also hope some of my code will inspire ideas on you too, really cool approach I will definitively will learn from it. I plan on sharing my code once is more useful, so people like you can check it more closely maybe use some of it, great video.
I've been playing with the code and it is so much fun. The more I understand your code the more I want to play with it. One thing I've been messing with it the aabbs for non-rectangular rooms. (Think like a Tetris piece) I've been carving out the aabb so that it matches the shape of the room but generation doesn't seem to want to put rooms in that cut out section. Do you have any guidance on how to make the aabbs work as a "Complex Polygon"?
Yeah I actually initially wanted to do this but i realized it was going to be a bit messy to implement. Because there is the aabb logic and then also maybe even messier, the door logic. I think since we're using voxels it'd be pretty easy to do the separation algorithm. The first thing I'm thinking is how will we even draw the irregular AABBs in editor? Perhaps you could break some of the logic for AABBs into its own class. This way you can write some @tool logic to make them placeable in editor, and manage some of the complexity. The current logic just placing a CSGBox3D and nodes for the doors is a bit hacky but simple and easy to implement. With the complexities odd shaped rooms would introduce I think you would be on the verge of where it makes sense to write a whole editor tooling UI to facilitate this. Then you also have the question of how you will do doors. Maybe if writing a separate AABB class, we also put some logic in there for door placement. But I will say this is where i threw my hands up and decided not to do irregular shaped rooms. This makes things a lot messier and opens you up to a lot of edge cases. For example, I think it's a lot harder to detect, and properly place even, doors on concave rooms, maybe even like donut shaped room with holes in them, it would be easy to place an impossible to reach door in the center. Trying to mentally map out how doors fit onto the concave voxels sides got too confusing and I gave up.
By all means have a go at it if you want to modify it for your uses, maybe you will create something cooler than I thought of. But consider these ideas i had of why just to go with the simple box AABBs:
Do we really need complex shapes? Since we can inherit DungeonRoom, and just hold off on construction of the room until it's placed, i think you could do a lot with that. For example, what if you wanted an L shaped room, with doors all along the vertical part of the interior of the L. Well, you could fake it. By placing doors just on the outside of the AABB, then after placement, carve out the inner part of the L and just spawn in corridor rooms yourself, since its AABB will block out that space for us.
Or, what if you wanted a very odd donut shaped room with the ability for a ladder type room to go through it? Well, again it might be better to just do this after generating, have the donut room, and model it with the ladder room inside, all part of the same AABB, but inaccessible depending on which door you went through and the ladder room would get deleted if not used, similar to how I remove door cuts in the AnyRoom/corridor code post generation. I think this offers a lot of possibilities.
Also, there are more features to make it more varied and interesting before trying concave rooms. We could add rotated rooms. We could add pre placed rooms so you could have some ones you place in the grid which also could be static like a mansion front door. We could add more features to facilitate inheritance of DungeonRoom and allow for more odd variations of the generation process at various points, right now it's just a signal that is emitted once it's placed.
One quick note if you're modifying my code I just remembered is you'll see some places I used "door cache or aabb cache" or something like that, reason for this is only for multithreaded generation, some rules in godot you can't access transforms directly from other thread. I forgot to leave a comment I think.
Anyway, these are my thoughts. Hope this helps :)
@@MajikayoGames Thank you for the giant response, you got my brain going again with new ideas. My whole reason for wanting to make the complex room shapes was so that it would be possible to cram more rooms into a smaller space. I had never thought of placing the rooms manually afterwards, I do like that.
I've been working with the code you put in for the dungeon with models, specifically the placement of torches and walls and such and its such a genius and simple way of going about it. I would've never thought of doing it like that and I love it. I have clutter to randomly spawn in the "AnyRoom", where I ran into the issue where all the clutter is facing the same way. Your code gave me the inspiration to use the RandomNumberGenerator to randomly rotate the clutter in 90 degree intervals after its placed to help break up any repeats. I have all the clutter in a 3D Node in the center of the room, where the clutter child nodes are arranged where it will never block a door. Then the RandomNumberGenerator generates a number between 0 and 20, with each quarter rotating the Parent Clutter 90 degrees. The only caveat with it I've found, is that the items have to be on the floor or the ceiling, as you already have solid wall code to handle anything else. I have also modified the "AnyRoom" to bring down the ceiling and bring in the walls by changing the cut shapes to make more narrow halls.
Overall, I've been obsessed with it and have been making so may rooms because you made it so easy. For me, your code has been intuitive and made in a way that if I don't understand something, its easy to find out.
My next hurdle is to try to get some generation where the two or more doors are not connected to the same corridor. Some rooms will just have the same hallway stretch around to both doors and it feels weird. This even happens when a shorter route was available. This is more of a preference though as a need, because I have some "Hazard" rooms. The goal would be that specifically for hazard rooms that if one door is connected to a corridor that the other door cannot connect to the same corridor or has to be so many voxels between the doors. This way the rooms are more likely to provide an alternate path to something else like a room or the other side of the maze, giving players a choice of "going the long way around" or "risking it and going through". There's even the possibility that the only way to get to a room is to go through the Hazard room. The Starter room is also a good example of this, where most often, all 3 doors are connected to the same single corridor, eliminating any choice.
Anyway, thanks for the reply again and I look forward to any modifications you share on the code if any. I just think its so much fun working with other people making things so cool.
@@flamebuggames yes that is definitely one flaw with how it is now, the corridors are a bit odd, especially how multiple doors often just wrap around into the same corridor. First thing I'd play with for that is the astar grid code in i think it's the DungeonUtils file. Currently it has the heuristic of astar set to 0, and so it becomes dijkstras, which guarantees the shortest path. (Dijkstra's plus an added heuristic to govern which paths are checked first becomes astar). Astar/djikstras optimizes for the shortest aka lowest cost path. And currently i have corridors set to 0 to walk through. So it will prefer to always walk through an existing corridor even if there is another shorter path. The reason i choose djikstras is because iirc astar with intermittent zero cost tiles like that will not guarantee the shortest path. Maybe could play with that code, have corridors cost less but not 0. Also I think i saw something about how using euclidian distance (maybe godot has some preset for this as well) as a heuristic in astar can help avoid zigzagging hallways. I think it would be good to provide some options for tweaking the pathfinding algorithm used to on the dungeons.
Glad you're having fun with it and glad my code is understandable :) I feel it was ok but could have been cleaner/more clear. In terms of future updates for it, I can't guarantee. Working on a few other videos and tutorials at the moment as well as some other Godot add-ons. Most recently just made some small changes to it to allow generating in editor via a checkbox and added some debug info. If anything it would probably be more sporadic updates to it like that whenever I get some ideas. Unless i get some good PRs i feel like accepting.
Very impressive
How do make the player spawn in the starting room? How do I save the generated dungeon?
You can save the generated dungeon by generating it in editor using the editor force generate checkbox and then saving that scene. If you generate a level in game, then you could copy the seed from the debug console and paste it in before you generate in editor.
@@MajikayoGames Generate in editor button is not working. It says to have Dungeon kit set and I have it in "Dungeon Kit Scene"
Set editor_button_generate_dungeon
scene/resources/packed_scene.cpp:220 - Condition "!sdata.is_valid()" is true. Returning: nullptr
Set editor_button_generate_dungeon
SimpleDungeons Error: Must have a dungeon kit set to generate the dungeon.
Unable to generate dungeon.
OK the game had to be running for it to work. Or is says it works but I'm not seeing any dungeon in the editor
Using dungeon generation seed: 7829143906678547912
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
{ 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9 }
Success placing
Separating...
Separating...
Suceeded in separating all rooms.
Finished connection stage successfully
@@Yoni123 Is it one of the default included kits or is it one you made? If it's one you created or imported, I suggest looking at the default 2 dungeons kits included with it to see how they should be structured. The DungeonKit is required to have the DungeonKit.gd script on it and be set up in a particular way. There is also some information in the readme. I plan to do a more comprehensive tutorial on it soon but until then it may be a little hard to work with.
@@MajikayoGames included
This looks awesome!! Do you think theres a way to have procedural generation every time the game starts, like a roguelike? I'm new to godot
Yep that should be the default! The generate on ready checkbox should do what you want.
Would this work with Synty Dungeon pack? Or does it need to be just like the modular pack you used?
It should work fine with any dungeon pack as long as you can create evenly sized rooms with it, as well as a 1x1x1 (in whatever you set the voxel size units to) hallway room.
you said the word "prefab" . I wonder do you have a background in architecture or construction?
mostly just game and web dev :) i was thinking of unity's 'prefabs' similar to how godot uses 'scenes' for everything.
Dark and darker vibes)
muito bom, tem muito potencial de uso até para ser usado por fora em jogos de plataforma. parabéns e obrigado por compartilhar. eu criava salas assim em voxel art em uma trabalheira e depois abria no blender para criar cenários como cavernas etc. eu pergunto como noob em godot. tem como exportar o cenário criado em gltf ou outro formato 3d para editar no blender.
I actually got a couple request for an export feature, so if I get some time I might add that. Thanks for your comment:)
Looks awesome! I love making procedural systems. Are you planning to develop this further into a game?
Well I was playing a lot of lethal company at the time, and wanted to make a similar game. I am still planning one but my vision of it has shifted. For now, I have a bunch of videos planned, more educational explanation types like this one mostly. Will see how they do and upload some of what I'm working on to see what it takes shape to.
Impressive. How is the speed of generation? Any issues, crashes? Thanks!
The main bottleneck is just spawning rooms models etc in the game engine i think. Everything else is pretty fast. I think the slowest part of the actual algorithm would just be running astar/dijkstras to connect the rooms. Maybe also the separation algorithm since i just wrote it in GDscript, could be way faster if I wrote it in native code and actually tried to optimize. But it's fast enough for me. I haven't ran into any crashes, i just added a max safe iterations value to prevent getting stuck while generating. There are probably some bugs, off the top of my head if you have some irregularly shaped rooms maybe it could cause some issues. If i ever used this in a full game, there are many more features I'd like to add and I would test it more thoroughly with more varied dungeons. But overall it has worked well every time I've tried it.
This is a similar method to what I'm working on. Any progress?
hey bud i've been gathering performant c methods for audio modeling/synthesis for decades. i should have something to share from my first opengl game using XBPD physics and various procedural methods sometime soon. one of my life things i do is cultivate distributors of numeric method eg. not every dev knows iniquilez, matthias mueller, 2nd order interpolation haha et c.. gotta run atm but ima nec wu in a few.
Would an octagon work?
Interesting idea. You mean for room shapes or for the full dungeon shape? Current everything is just box shaped, dungeon and individual rooms. I think it wouldn't be too difficult to make it some interesting shape like an octagon. Same concepts apply. you could add something in the separation phase perhaps like static edges around the dungeon, to form the sides of the octagon, that would be in a fixed position so as to force the dungeon in an octagon shape. If you needed rooms in the shapes of octagons, you could either leave them box shaped for room placement and just have the visually as octagons basically, or modify the separation algorithm to work with different shapes than just boxes. I thought about doing this but didn't implement it.
@@MajikayoGames for connections and such. it would allow slanted paths. i would say for room types the cubes are enough, i have an idea i just can't type it, it's more visual. i don't have the time sadly because when i have time for gamedev i do a character controller, and blender.
Can I use the assets in unity??? PLS!
Yes they are on itch.io for free made by rgsdev rgsdev.itch.io/free-modular-low-poly-dungeon-pack-by-rgsdev
question... would this work in unity?
This add-on is just written for Godot so my code would not run in unity no. Anyone is welcome to copy/port the code over though since it's public domain. I think there may already be some solutions for this on the unity asset store you could check out first though.
anyone know anything like this for unity?
cooool! do you have a 2d tutorial for Procedurally Generated platformer?
Not at the moment but I'm planning on updating this add-on soon. May add 2d dungeon support as well.
@@MajikayoGames im still trying to reproduce this in a 2D game but yup i still don't know how hahaha
@@Alshim You might find the source for the 2D demo useful:
majikayogames.github.io/dungeon_algorithm/dungeon_rooms_2d/index.html
Source for the logic is all in the script.js file:
majikayogames.github.io/dungeon_algorithm/dungeon_rooms_2d/script.js
Just placing rooms & pushing them apart is pretty easy, you can go with my algorithm, or just make one with a similar idea, spawn many rooms in random locations, and then just keep pushing them apart if they overlap. Then you have some options to go for for connecting rooms. If you don't need specifically placed doors it may be simpler than mine. Most game engines will have an AStar class you can use to pathfind between the rooms. You don't have to do it exactly like I did. There are many style of room connections you can do. Main idea is just to to some AStar pathfinding on a grid to ensure the various rooms have hallways between them.
ohhh thank you very much for this, ill try it
Where were you 6 months ago when I was searching like mad?
ho this is so useful
Woooooooow
Can't really hear your voice over the music
Sorry about that! Still learning to make vids. :)
Reminds me of delver
I need a tutorial 😭🙏
Hello! I Iike this, but most certainly it is not complete. You do not make the player to believe that the dungeon is not random by nature, but the imaginary builders have decided to build the dungeon this way for an unkown reason. The best way against this is showing the player a reason. For example with very vertical dungeon designs, you are able to show something vertical when the player looks out the window, feeling that the dungeon looks that way due to it being built around something, or along something. Also when you are in a building, you can kinda feel that there are rooms behind walls, but this case you can not expect such thig, as it is random. It feels not natural for a building that divides its rooms with no pattern basicaly. With this pattern i mean that there are way too long corridors, but there are no rooms along those, and you are not even showing the player the reason by for example placing windows along that corridor through which the immersion is kept up in the player's point of view. Also when you "carve out" a space under ground for example, you are not carving it out always as expected, so you might end up with a bunch of room cluttered to one another, and then other rooms cluttered to one another, but in the maps you are creating there are only lofty (, or solo) rooms. The thing is this does not always apply to carving. The most obvious real world comparison are the relation of cities. You can travel between them, but realy cities are just a good bunch of rooms inconsistently cluttered together. The other thing is that you procedurally generate every single map in a way that does not exploit the mathematical nature of bringing back the same map with a single seed. Using seeds is a must do for procedural generations because you do not have to save the entire map, only the seed. In fact that is one of the greatest leverage of a procedural map, that you are not taking. I suggest that instead of moving the rooms until they are separate, make some kind of a grid of the rooms in order for a seed to work, and then use the path finding algorythm. Do not forget to fill up the empty spaces with scenes that the player can see, or lightly interact with, like walking into it. Maybe empty rooms for example.
Appreciate the comment! You got some interesting ideas, I thought of something like this myself. Initially my vision was to be able to carve out the dungeon, so it was more like a building. I considered some wave function collapse type setup, or other various setups related to carving. However, I was set on the idea of easily being able to define prefab rooms for this for my uses. So this algorithm is rather simple to accommodate for this requirement. It has the advantage of being simple, but that's also a disadvantage in some ways too, there are more interesting generation styles we could do.
Yes this idea of seeing out of the dungeon as a building is an interesting one. One way initially I had thought of doing this, was have 'static' rooms pre-placed (maybe they could be randomized on a separate simple algorithm) maybe around the perimeter, to guarantee a building shape. These rooms would always have windows to look outside. You could also do stuff like door rooms fitting to the outer level environment by using the static room concept, like pre-place an entry room on the edge of the dungeon in the preview editor, the the rest would generate around that, not moving the initial room. I have not implemented this as of yet, but might someday.
Being able to use prefab rooms how I want, I figured if I wanted any more interesting generation features, I could augment the algorithm with ideas like the above static rooms one, and so I decided to just go with this simple algorithm. It also is nice that it is simple so others can use it as a starting point to modify it :) as it's public domain code.
On the point of it not randomly generating on the same seed, it should do so, as long as the dimensions of the map are the same too. If this is not the case in the final Godot add-on, that is a bug you have found.
I highly appreciate your response. I think there is no bug with the seed, because i was just telling my expectation. I am also very interested in algorithms like this, and it is very good that you have made one. i hope to see more map generation algorithms from you.@@MajikayoGames