Friday, August 31, 2012

Really basic level generation

Level generation is, in my opinion, one of, if not the most important element of a Roguelike. Different methods of level generation produce levels that feel very different, ranging from box stamping to more organic tunnelling methods. To take advantage of this I want my game to use several different methods to generate the level, giving different areas different feeling that go with their theme.

This is my first, very basic attempt at level generation. All it does is stamp boxes into a grid map randomly, with no logic. It then tries to create corridors to connect up all of the room, simply by tunnelling through from one box until it reaches another. After that it cycles through the tile and creates doors in places where there are two tile between walls.

It doesn't do the interesting things yet, like place mob, item, treasure etc. Also I'm planning on using a tile editor programme to create a load of bespoke rooms with interesting layout which will then be randomly place. Still, I'm quietly happy with it so far and I'm hoping I can add to it and make something that can create genuinely cool dungeon layouts..

Give it a play, though be warned that it's all brute force computing, completely non optimized, so if you choose a huge map with lots of small boxes it may take a long time to finish. (the text on the top left is actually a button)


2 comments:

JC said...

Nice work.

Interesting approach, laying down the rooms and then working out how to join them.

Weirdly, I'd have gone for structure first, location second, but this looks a lot more straightforward.

Unknown said...

I think the fact it has no structure makes the levels it generates quite interesting. There really work as labyrinth, cave dungeon type layout, as least from a top down view - playing them may be different.

I'm planning on creating another couple of different level generator which will be more structured to simulate man made buildings and things like villages/towns. We'll see how that goes.