GDquest has started a new kickstarter campaign to create a professional tutorial for Godot, focused on 2d games.
"Learn to create 2d games with the award-winning, Open Source engine Godot 3. Free daily tutorials on Youtube during the campaign!" "You will learn to create your own top-down game inspired by Zelda"

2D Dungeon Generator

halfwaywronghalfwaywrong Posts: 2Member
edited August 2016 in Resources
Hi all, I've spent this weekend working on a simple 2D dungeon generator and figured I'd share the result with everyone.
It's pretty simple, basically the code works like this:
  • Fill the world with tiles.
  • Add rooms to an array, discarding any that overlap.
  • For each room in the array, carve it out of the map.
  • For each room in the array, carve a horizontal corridor leading from the centre of the room, to the centre of the next room.
  • While still looping, carve a vertical corridor from the end of the horizontal corridor to the centre of the next room in the array.
  • Finally, run neighbour aware function over every tile to make sure the correct one is displayed.
You can find the source here.

I've attached a couple images of example dungeons generated by this script.

The tiles come from Agnes Heyer via this forum post.

Tags :


Sign In or Register to comment.