Dungeon generation 2d array

Hello guys. I need help with my game again. I am currently trying to figure out how to create randomized dungeons. I currently know how to tile map games and what I really want to know is how to create dungeons. Please give me some steps on how to do it. Or some code will be nice.

What have you looked at so far? Because there are a whole lot of resources out there that I can find if I simply google the first two words of your post. It’s easier to help if there’s a starting point, i.e. some actual code you’ve started to write or an algorithm you’re interested in.

Well I don’t have an actual code for random dungeon generation. Usually when searching through google i see most dungeons using BSP trees. The one thing I am really wondering is if BSP trees are compatible with 2D arrays…

Why don’t you try it? :wink:

Yeah, “hello guys” returns 152 000 000 results!

But seriously;

If you hit walls with trying that BSP tree method then ask, maybe we can be of further help. (Well, others, I’m not really smart when it comes to random dungeons.)

Here’s some stuff i wrote up about dungeon generation:

http://old.cokeandcode.com/node/1363
http://old.cokeandcode.com/node/1444

And some source code:

http://old.cokeandcode.com/node/1445

Anywhere you get a 404 just change www.cokeandcode.com to old.cokeandcode.com

Cheers,

Kev

If I were to do it, I’d generate a random number between x and y equal to the number of “rooms” initially to fit in the array. Then I’d loop through for each room and pick a random size (maybe in tile units), accounting for the number of rooms I have to fit. At that point it’s up to you to generate each room based on your game.

Or, as another option, you could have a 2d DungeonRoom array. Before you generate each specific room, place them in the array first (randomly of course ^_^), so that when a room is being generated it knows that there might need to be doors placed on a particular wall.