Jump to content
  • Advertisement

Simple organic and brute force dungeon generation

thecheeselover

3377 views

Subscribe to our subreddit to get all the updates from the team!

Last month, I made a pretty simple dungeon generator algorithm. It's an organic brute force algorithm, in the sense that the rooms and corridors aren't carved into a grid and that it stops when an area doesn't fit in the graph.

Here's the algorithm :

  1. Start from the center (0, 0) in 2D
  2. Generate a room
  3. Choose a side to extend to
  4. Attach a corridor to that side
  5. If it doesn't fit, stop the generation
  6. Attach a room at the end of the corridor
  7. If it doesn't fit, stop the generation
  8. Repeat from steps 3 to 7 until enough rooms are generated

It allowed us to test out our pathfinding algorithm (A* & String pulling).

Here are some pictures of the output in 2D and 3D : 

image.png.dafb5543cdae1b79e649594f55aad082.png

image.png.6b6cb66f79e5b1a5e31511a013f9edda.png

image.png.ae5b44775ec786d45db01bd5915e7e4f.png

image.png.580ea4450a67146562b48c626b5d92ab.png



4 Comments


Recommended Comments

Looks pretty effective!

Any plans to add branching or loops?

Share this comment


Link to comment
14 hours ago, jbadams said:

Looks pretty effective!

Any plans to add branching or loops?

 

Thanks! 

We'll brainstorm on that in before the end of May I think. We have many ideas and libraries / algorithms we could use. For exemple, Paul Speed from the jMonkey Engine forum did the same thing as I but more complex. See https://hub.jmonkeyengine.org/t/april-2018-monthly-wip-screenshot-thread/40292.

 

We could also use Noise4J to generate a noise based dungeon.

dungeon-tiny.png

 

There are so many algorithms and ways of doing it that it's bound to be incremental and evolve over time.

Edited by thecheeselover

Share this comment


Link to comment
On 4/26/2018 at 6:19 PM, thecheeselover said:

 

Thanks! 

We'll brainstorm on that in before the end of May I think. We have many ideas and libraries / algorithms we could use. For exemple, Paul Speed from the jMonkey Engine forum did the same thing as I but more complex. See https://hub.jmonkeyengine.org/t/april-2018-monthly-wip-screenshot-thread/40292.

 

We could also use Noise4J to generate a noise based dungeon.

dungeon-tiny.png

 

There are so many algorithms and ways of doing it that it's bound to be incremental and evolve over time.

Wow! It's cool. I'm going to need this later but I want to get the terrain fully function first.

Share this comment


Link to comment

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
  • Advertisement
  • Advertisement
  • Blog Entries

  • Similar Content

    • By Purple Spelly
      Hiya! i'm Jason, And i want to reach everyone here who's excited about making games! And as the Title says, I'm looking for either GMS2 Programmers Or Godot Programmers.
      I want to invite you to my Game Creation Of Imagistory, A Beautiful 2D RPG game with Plot twists, Corky Characters and an amazing story.
      Here is some spoliers:
      Long ago, A mystical Comet Flew throughout the universe.
      Legends say that one day this comet will create a brand-new galaxy.
      A little scientist named Brown tried to fly to space to see the comet in action.
      His Friends, the Wizards, went with him to see the explosion.
      Until…
      A Vortex Pulled them into a strange portal. They all scattered in different locations.
      What will Brown Do?
       
      And Here is Some Art:
      I'm Ciao Gelato #7986 on discord and my email is is imagistory2500@gmail.com, if you want to contact me there.
      I'm Looking For Free/Revshare Workers, Please!   Stay Creative!!!
    • By sevenfold1
      I'm looking for a open source PBR rendering engine that I can use.  Basic requirements are Windows (C/C++) and free to use type license.

      The first two hits I get on Google are:

      Filament
      https://github.com/google/filament/

      LuxCoreRender
      https://luxcorerender.org/

      Does anybody have any experience using any of these, or do you recommend something else that's better?
      Thanks.
      Pluses: Active development, easy to compile, zero dependencies.
    • By HappyCoder
      What is the game like
      I'm working on a game where the main mechanic is the player creates their own spells. They create spell using a sort of visual programming language
      Here is a diagram showing how the spell system would work

      The top spell would shoot fire out of the casters hand
      The second spell would shoot a projectile in a straight line until it hit something with no other effects
      The third spell would shoot a projectile and when it hits, explodes in a fireball
      Armed with only their knowledge of magic the player must navigate through caves and dungeons looking for artifacts and spells to allow them to become a master of the magic arts.
      What I have so far
      I prototype of the spell creation system. The user can draw symbols using an oculus touch controller in the air. The computer recognizes the symbol and the user can then move the symbols around to construct spells.
      List of spells I have working at the moment
      Fire - does damage, burns wood, and can light torches Wind - pushes objects and puts out torches Levitate - causes the target to become weightless, when used with wind you can push even heavy objects Light - a bright light used to light up dark areas What I need
      It would be great to have an artist to work with. I am going ahead doing the artwork on my own but having somebody who could take that too let me focus on the other aspects would be of great help
      I would also like if somebody would take on the role of designing levels. I think this game will rely on having many different interesting encounters to force them to come up with clever solutions to problems using their magic. It would be helpful to have somebody to collaborate with for ideas in the category and to focus on trying different levels out to help me focus on the programming.
    • By Sneikyz
      Hello,  
      I'm an amateur digital artist looking for a beginner-level project. I'd like to be a part of a team that wants to learn to create games. It might be a simple idle, mini, simulation game or a visual novel.
      I'm still a beginner at backgrounds and I usually draw females but I'm willing to learn.
      Time invested to the game creation might differ every week mostly because of my work and will be discussed separately.
       
      Here's my DA : https://www.deviantart.com/sneikyz
    • By jb-dev
      This is a picture of a regular room. 
      Each rooms has a chance to have props with a certain layout.
      If a rock is spawn the player can try to break it by exploding it. These can spawn common collectibles like money and such...
      There are many different type of layout possible, including a totally random one.
      The generator simply picks a shape, an anchor position and the type of prop to be generated.
      The process itself is simply a 2D boolean array. We simply draw on that array like we would in a bitmap using traditional image manipulation algorithms.
      Once the array is set, then we simply add a given prop for each true cell of the array 
      We then finally remove every props that are either outside its room or obstructing an entry/exit point.
      Right now, only two types of props can be generated, although the algorithm itself is kinda flexible.
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!