Jump to content
  • Advertisement
  • entries
  • comments
  • views

Simple organic and brute force dungeon generation



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 : 






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?



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.



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

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

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!