Saturday, August 15, 2009

Behind door number one

Dungeons are build primarily out of, believe it or not, rooms. There are big rooms and small rooms. Rooms at the top of towers, and rooms at the bottom of crevices. Some rooms have monsters, some have treasure, and some are regretfully empty.

My current challenge in my game, whose working title is TinyGame, is to find a way to figure out what the spaces are for each room.

My world is divided up into tiles, nostalgia from old rogue-likes i suppose, and each tile can either be a movable space, or a piece of terrain that can't be moved through (yet). Oh sure, there's items and creatures and so on, but this is about the rooms themselves.

Right now I generate the rooms like this:

I find a spot somewhere in the bottom middle of my map. That becomes the main doorway for the dungeon. From there I generate a width, and a height and draw my walls just inside that, leaving the middle empty. This is the atrium for the building, and it's always one of the largest rooms in the place. Sure, not every type of dungeon needs an atrium, but I'm starting simple here.

From the atrium, I randomly decide how many rooms are off the side, one, two or three. One room is off the top, two rooms is off to the side, and three rooms is all the way around. The size of these rooms is a factor of how big the atrium is. And each of them has up to two side-rooms, too. The back room's rooms are on the side, the side room's rooms are further to the side, or to the top - which can overlap with the top-rooms's side rooms.




But now, they're just walls and spaces. I need to remember them as rooms themselves, so I can do things with them, like add monsters and delicious treasure.

No comments:

Post a Comment