In the process of porting my old dungeon generation code over,  I went ahead and implemented dungeon themes.  These allow me to specify how levels should be generated.  As with everything else, the fields are manipulated in excel and then serialized (at design time) via LinqToExcel and Protobuf-net.

I start with defining a theme in excel:

excel

Right now I’m just using the default floor and wall cell fields, but you can imagine specifying level-specific things like ambient sounds, which monsters should appear, what type of adornments to add, etc.  I think this will come in most handy when I add DCSS-esque themed mini-dungeons; imagine defining an “Orc Caves” mini-dungeon without having to touch the code.

“floor1” above refers to a CellDefn.  CellDefns are defined in the xls as follows:

celldefns

And in that, “TileId” refers to a Tile that is defined in the TileDefn sheet, as follows:

tiledefns

The TX/TY coordinates are references into the cells spritesheet, which is pretty empty so far:

cells

Connect all of those dots, and you’re able to specify themes via data.  Now when I specify that a level should use the “dungeonTheme”:

dungeontheme

I see this:

dungeon

And when I change that to use the “blueWallTheme” like this:

bluewall

I see this:

checkerboard

The floors and walls have changed to a different theme. It’s a subtle effect here, but it demonstrates the infrastructure.  The hope is that this will allow me to easily (and safely) increase variability a great deal by creating a bunch of different themes without touching code.

Advertisements