Simple organic and brute force dungeon generation

Published October 02, 2018
Advertisement

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

6 likes 4 comments

Comments

Rutin

Very cool! :)  

April 24, 2018 04:29 PM
jbadams

Looks pretty effective!

Any plans to add branching or loops?

April 26, 2018 04:15 AM
bdubreuil
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.

April 26, 2018 03:19 PM
Gnollrunner
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.

May 30, 2018 04:17 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement