- Edited
Hi all, I've spent this weekend working on a simple 2D dungeon generator and figured I'd share the result with everyone.<br>It's pretty simple, basically the code works like this:<br>
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 <a title="Link: http://%22https://bitbucket.org/signalsin/godot-dungeon-generator/src%22" href="http://%22https://bitbucket.org/signalsin/godot-dungeon-generator/src%22" target="blank" rel="nofollow">find the source here.</a><br><br>I've attached a couple images of example dungeons generated by this script.<br><br>The tiles come from <a href="http://%22http://www.retinaleclipse.com/%22" target="blank" rel="nofollow">Agnes Heyer</a> via <a href="http://%22https://forums.tigsource.com/index.php?topic=14166.0%22" target="_blank" rel="nofollow">this forum post</a>.<br>