I’ve updated the code to support variants of Tiles to provide a bit of variety to the map.  Here’s what it looks like:

Every Tile can have variants; in the above image, the existing Floor and Wall tiles were updated to have a few variants each.  Variants are defined in the Tile definition file as a child element of the base Tile.  Each variant defines the likelihood that it will be chosen; if none are chosen, then the base tile is used.

Here’s what the new Terrain tile definition file looks like:


<?xml version="1.0" encoding="utf-8" ?>
<xml>
 <Tile Type="Terrain" Name="Empty" TileFile="Terrain.png" X="144" Y="48" Width="48" Height="48"/>
 <Tile Type="Terrain" Name="StoneFloor" TileFile="Terrain.png" X="48" Y="0" Width="48" Height="48">
     <TileVariant Name="StoneFloor2" TileFile="Terrain.png" X="0" Y="0" Width="48" Height="48" Likelihood=".05"/>
     <TileVariant Name="StoneFloor3" TileFile="Terrain.png" X="96" Y="0" Width="48" Height="48" Likelihood=".2"/>
     <TileVariant Name="StoneFloor4" TileFile="Terrain.png" X="144" Y="0" Width="48" Height="48" Likelihood=".0125"/>
 </Tile>
 <Tile Type="Terrain" Name="StoneWall" TileFile="Terrain.png" X="0" Y="48" Width="48" Height="48">
     <TileVariant Name="StoneWall2" TileFile="Terrain.png" X="48" Y="48" Width="48" Height="48" Likelihood=".25"/>
     <TileVariant Name="StoneWall3" TileFile="Terrain.png" X="96" Y="48" Width="48" Height="48" Likelihood=".25"/>
     <TileVariant Name="StoneWall4" TileFile="Terrain.png" X="144" Y="48" Width="48" Height="48" Likelihood=".25"/>
 </Tile>
 <Tile Type="Terrain" Name="OpenedDoor" TileFile="Terrain.png" X="240" Y="0" Width="48" Height="48"/>
 <Tile Type="Terrain" Name="ClosedDoor" TileFile="Terrain.png" X="192" Y="0" Width="48" Height="48"/>
</xml>

This required a bit of refactoring (and cleanup) of the Cell classes, since now every derived Cell could have an instance-specific Tile (variant).  Among other things, I’ve collapsed CellBase and CellType into one class (appropriately titled CellBaseType).  I’ll writeup the Cell/CellBaseType relationship in a later post…

Updated executable: http://wanderlinggames.com/files/dungeon/DungeonEXE-3-15-11

Source code: http://wanderlinggames.com/files/dungeon/Dungeon-3-15-11

Advertisements