As I work on my RPG project, I'll use this blog as a notebook to track my thought process and ideas.
What kind of information do I want to store about a given tile within my map?
For starters, I need to know what kind of tile it is (is it solid stone, a wall, a door, a floor, grass, a road, water, etc.) So here's a preliminary stab at a list of Tile types:
public enum TileType { Desert, DoorClosed, DoorOpen, Floor, Grass, Hill, Ice, MountainClimbable, MountainUnclimbable, Road, SecretDoor, Stone, Volcano, Wall, Water };
I'll also need to include information about Traps. Not all tile types can contain traps, but dungeons certainly will, so off the top of my head, I'll add the following:
public enum TrapType { Sleep, Stone, Fire, Pit, Shock, Confusion };
I'll worry about implementation of the traps later on. For now it's good enough to know if one exists on a given tile, and what kind it is.
For some maps, like dungeons, there will be special tags that "help" other routines work properly, so I need to distinguish certain areas, such as rooms and passages, as more than just the walls and floor that make them up. Also, Chambers are a type of Room that has special features:
public enum RegionType { Chamber, Room, Passage };
So at this point, I've got some basic info about the tile, but I also need to store information about any creature(s) that inhabit this space. I haven't decided yet if the game will support multiple creatures (monsters) per tile in addition to the hero. As creatures are created and destroyed in game, they will be managed by a master list, so we only need to store the ID of the creature(s) that occupy the tile. I'll go ahead and create a List to handle this, even if I only put one thing in it.
In addition to creatures, I need to store the IDs of any items (treasure or otherwise) that can be found at this tile, so I'll create a list for this as well.
This gives me a structure that looks basically like this:
public struct MapTile
{
TileType tileType;
TrapType trapType;
RegionType regionType;
List<int> itemList;
List<int> monsterID;
}
I'll use this structure as the type for my map array. I'll return this array when I call the CreateDungeon() routine, as shown here:
public static MapTile[,,] CreateDungeon()
{
MapTile[,,] map = new MapTile[DUNGEONWIDTH, DUNGEONHEIGHT, DUNGEONDEPTH];
// blah blah Do Stuff here...
return map;
}
As this project progresses, I'm sure more will be added (and some things removed) so I'll update these accordingly.