Dungeon Prefabs are Ready


I always intended to have support for some form of custom rooms in my dungeon generator. The idea is similar to Angband’s vault system, but a lot more generalized. Instead of using custom rooms or prefabs for vault encounters, I wanted to supplement the dungeon generation with custom built rooms or sets of rooms.

These dungeon prefabs required me to implement a file format in XML that would represent the prefab structure. My schema allows me to set up the layout, specify light sources, and connectors.

The function of the connectors tag is to give the dungeon generation algorithm some guidance in placing the prefab within the dungeon. The algorithm will try to place a prefab with each connector located next to a corridor within the dungeon. Locations with no connected connectors are rejected.

The added benefit of the prefab implementation is that I now have serialization for most of my dungeon data. This means that I can easily save a generated dungeon which will be useful for save files in the future.

I hacked the prefab generation into my existing dungeon generation code, but it soon became a mess. This led me to revisit the room and door generation code.

The room and door generation code now has a nice set of unit tests. The algorithms for each are also a bit more purposeful in terms of placing rooms and creating doors in an intelligent manner.

I am not 100% happy with it yet, but its a substantial improvement. I will need to implement some form of maze (or dungeon) solving algorithm to make it smarter.

There are still a few issues with the lighting system, but I want to implement some new functionality before I continue tweaking. It’s really boring running around dungeons without any monsters.

I hope to have a new tech-demo ready for download in the next few days. I am just doing some Linux testing before I upload.

Advertisements

2 thoughts on “Dungeon Prefabs are Ready

  1. Thats very similar to the method that I was going to use for my roguelike but I ended up cutting it due to time. I figured adding some custom rooms into the mix could be good for auto-generating some random quests because you can force object x and monster y to be in a room.

  2. I agree, prefabs add a lot of possiblities in terms of setting up specific encounters. I still have to implement a lot of “game” features before I can get to experimenting a bit more.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s