Sign in to follow this  

Unity My Procedural Dungeon Generation Algorithm Explained for my game TinyKeep

This topic is 1718 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Thanks for sharing, looks like you get pretty good results from a relatively simple technique! smile.png

Share this post


Link to post
Share on other sites

I really like the dungeon generating technique and how you used animation to demonstrate it. Good luck with your project.

Share this post


Link to post
Share on other sites

For a school assignment (a simple one, which is why) I added something similar. Of course it was not as good at creating dungeons, it had a similar idea of creating random rooms first then connecting them. Yours is a lot better in the fact that you use some very simple and effective algorithms to achieve a nice balance of distance and size of rooms. Your hallways (or what connects the rooms) are also a lot better, since mine were only straight lines. I also like the fact that there are no flaws, like mine could spawn you into a room with nowhere to go to. 

 

I'll also check out your game, as it seems pretty well thought out.

 

Happy coding!

Share this post


Link to post
Share on other sites

This is an interesting Top-Down approach.

 

Personally, I am more a fan of a Bottom-Up approach, where I keep adding and connecting rooms one by one, with random amount of smaller leafs - e.g. random depth (a range from 0-5) from the main corridor.

 

 

This way, I am guaranteed that the main quest items can be found easily, since the algorithm doesn't put them in the last leafs (which is frustrating from a player's perspective).

 

Also, since I am adding one main room after another (in a snake-like manner/shape), I keep generating and precomputing the pathfinding - thus making the in-game pathfinding reduced to 5-10 if..else conditions (which is plenty fast for a cell phone, even).

 

I can see, however, that it is pretty hard for you to generate some longer narrow corridors (with nowhere to dodge/escape) - which, personally, seem to be a big part of a dungeon crawler.

Share this post


Link to post
Share on other sites

It's always interesting to see someone else's take on something like dungeon/connected rooms generation. I'm curious.. is there much overhead in the part of the algorithm which moves the random rooms until they're not overlapping?

Share this post


Link to post
Share on other sites

This is an interesting Top-Down approach.

 

Personally, I am more a fan of a Bottom-Up approach, where I keep adding and connecting rooms one by one, with random amount of smaller leafs - e.g. random depth (a range from 0-5) from the main corridor.

 

 

This way, I am guaranteed that the main quest items can be found easily, since the algorithm doesn't put them in the last leafs (which is frustrating from a player's perspective).

 

Also, since I am adding one main room after another (in a snake-like manner/shape), I keep generating and precomputing the pathfinding - thus making the in-game pathfinding reduced to 5-10 if..else conditions (which is plenty fast for a cell phone, even).

 

I can see, however, that it is pretty hard for you to generate some longer narrow corridors (with nowhere to dodge/escape) - which, personally, seem to be a big part of a dungeon crawler.

 

Hmm, I do agree - Bottom-Up approaches tend to be more natural for gameplay as it almost simulates how one would explore the dungeon! Does your algorithm allow for loops or is it very much a tree? I tried this in the past to create a tree, but found it difficult to create an elegant way to loop back.

 

It's always interesting to see someone else's take on something like dungeon/connected rooms generation. I'm curious.. is there much overhead in the part of the algorithm which moves the random rooms until they're not overlapping?

 

I haven't done any serious tests, but if I turn off all the graphical visualizations the entire generation takes less than a second. There is probably quite a lot of overhead for sure but it's a one-time operation. I'll let you know when I have more specific results.

Share this post


Link to post
Share on other sites

If it takes under a second, then it is nothing to worry about during level loading. The textures alone will take longer to load than that, for sure. I was asking, since you mentioned using several of the trees, and some types of trees are very intensive - but it is clearly not the case here.

 

As for my loops - it is also more of an hack. it does not work 100%, since the conditions for the loop must be right (and I'd have to pay attention to the "loopability" during creation process - which is still something I need to do).

 

 

 

BTW, did you find an artist willing to work for royalties, or do you have a contracted artist ? I liked the art, for sure !

Share this post


Link to post
Share on other sites

I think you're right there, making loops I found very difficult.

Here's a really really early test I made in 2011, completely tree based and bottom up approach, and there's no loops.

 

http://phigameslib.org/prototypes/dungeon/

 

An interesting discussion for sure!

 

Regarding the art, it was made by Matthias Andre from bitgem3d.com

The assets I used for the prototype are royalty free from his portfolio, but he has agreed to do more art for me if we get funded.

Share this post


Link to post
Share on other sites

This topic is 1718 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Similar Content

    • By Redlime
      I am a game development student working on a 2.5D beat 'em up brawler game in Unity as my final year project and I've been working on the ai for the enemies in the game. However, I've been unable to get the enemies to working properly as the enemies would be constantly stuttering and jerking while trying to follow the player. I've created a foreach statement and added some conditions that call for the robots to spread out and stay away from the player if it is not in an engaging enum state. This has been an issue plaguing the ai for a while now, analysing the animator, it seems like the robot's movement is instantaneously stopping and going which might be the reason causing this stuttering. But I'm not sure how to prevent the robot's movement from stopping and going. If anyone knows the reason why this is happening to the robots it would be much appreciated as my project is due soon and I'm still unable to fix such a game breaking bug! I've included a few videos below showing what is happening to my robots and also the stuttering shown inside the animator. I've also included the full script for my robots.
       
      Robots Stuttering
      Robots Stuttering Animator
      Robot.cs
    • By red1m3n
      Hi I'm a hobbyist getting together a team to pursue game creation, we'll do both 2D and 3D games, we would definitely build different types of games, and hopefully have a great time doing it. you dont have to have much experience, just enough that you think you can fill the position. I have plenty of ideas for games that I'd love your help with, and am completely open to fulfilling your game ideas . As of right now this is a for fun project thing, but if me and my team are satisfied with our work it can be published to steam or other platforms. 
      The positions I'm currently looking to fill are:
      2D Pixel artist
      3D Modeler 
      C# programmer
      Musician/Sound engineer
      I am currently working on a project it is a 2D Merchant adventure game with survival elements. It does not have a name yet, that's because I'm bad with names. 
       
      If interested please feel free to leave me a PM or email at dealtavu@gmail.com so we can talk more about it..
    • By Aggrojag
      Hello!
      I'm working on a game that is quite personal to me. It touches on my own depression, obsessions, phobias, etc. It's a narrative driven dark comedy with some small aspects of platforming and puzzle solving. The project is rather small as well. It touches on topics such as suicide, mental illness, family, corruption, free-will, and redemption.
      First, I'm looking for a 2D animator that can compliment the style of the attached image. The player character's animations will be a bit more extensive than a typical platformer. There will be many death animations, and some other strange dealings with the character that will need animation. Other items will include some objects in the world that are in need of animation. All static pieces of art will be handled by the artist that drew the attached image.
      Second, I'm looking for a male voice actor. There will be at minimum two characters that will need to be brought to life through vocals. They are a very core part of the game, though they will never be shown on screen. As a reminder, this is a rather dark comedy, so be prepared for some insanity in your portrayal of these characters. The first voice is that of a game show host's voice, while the other will be a devilish voice (without SFX, I think it cheapens it, does not necessarily need to be a low voice, this is more about the portrayal than how the voice sounds).
      Last, I would love to have an editor on board. More than just avoiding disaster in the writing, I'm looking for someone that can elevate it. There is not a ton of writing that will be in the final project, but it's important enough of an aspect to be trying to bring someone in to help with it.
      To those interested:
      I have a crappy prototype that exists, along with a couple game design docs. More than anything, I'd like to present the project through a voice chat via discord to any interested. Discord - Bobdul Thundercuck#4590
      I do plan to post this on itch.io and wherever else I can put it that makes sense. I fully expect to make nothing off this project, as should you. However, in the case that money is made, a rev share model will be in place.

       
      Edit: Editor position has been filled, title has been changed to reflect this, and crossed out the section detailing this.
    • By William Edmeades
      Hey guys and girls,   Have you ever found yourself trying to apply for a job to be a game developer or a game artist? Maybe a sound engineer or a script writer? Only to not even get an interview due to lack of ‘experience’, teamwork projects or released game titles you have worked on? I have for sure. The game industry is hard and competitive to get into for someone new, especially when you might have a full time job or even have to support a family. So I have come up with an idea and I wanted to throw something out there to see if people could be interested in such an idea.   What if you could be part of a virtual game development company? A place where you can work on projects with a team of people from the internet, soon to be known as your colleagues, which could be from anywhere in the world all working at your own pace when you have time to do as little or as much as you want.   The idea is we can create the power of a company and release titles together. Not only do you then have a released game title you have worked on under your resume, but also work experience, team work skills, and the power of helping each other and learning from each other.    My dream idea is to create a solid place for people to join a party and develop ideas and create games and level up it experience points.   As far as money is concerned, the games would either be released for free or any money would go towards charity, it’s not about making money, it’s about building a career or justness having fun building games and socialising with like minded people.    I want to make something amazing, I think it would benefit me, and I think others who are serious would benefit greatly too.   I await your critasism on the ‘prototype’ idea, I just wanted to see how many people would be interested in such a concept. And if you are very much into the idea, let’s make it happen.   Thanks,   Will. www.feelingterrible.com
    • By NDraskovic
      Hey guys,
      Like the title says, I'm trying to find out if it's possible to automatically set which scenes will be built for different platforms. For instance, I have scenes that I want to include when building for PC, but exclude them for mobile platforms. Is it possible to do this automatically (by some settings file, or by coding some editor extension), or do I have to manually (de)select them each time I switch platforms?
      Google just keeps sending me to the documentation sites about the regular publishing, but I can't find information about this problem.
      Thanks in advance
  • Popular Now