Jump to content
  • Advertisement
Sign in to follow this  
cheeselottery

How does this dungeon generator work?

This topic is 5462 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

see here: http://www.irony.com/mkdungeon.html I like the results of this generator, but I'm not sure how I would go about producing similar results. It looks like the map is divided into 4x4 sections, each of which may or may not contain a room. Each section might also contain a 'street' grid piece, which is shaped like this:
#.##
....
#.##
#.##

There are more street passages than are necessary to connect all the sections. Of the sections that do contain street pieces, not all of them contain all the 'spokes' leading up, down, left, and right. One sticking point: How one go about picking and choosing which sections will have street pieces, and among those, how does one decide which street passages to keep and which to delete? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Well, this is how I would do it.

1.) Initialize a 2d array to be empty
2.) Write the entire street grid section to the 2d array
3.) generate N random boxes such that they always
hit a grid section and write them to the array.
Where the box hits the 'street' or another box, generate
a door.
You might want to add constraints so that your random boxes
are well distributed an not too clustered.
4.) Iterate through each street segment (horizontal and
vertical) and check whether there is anything intersecting
it. If not, remove the entire segment.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!