Data Structures

The Game Map

I found a map of Inca Curse online and this really helped with the creation of the game map.
This is the Location class:
public class Location
{
    public int LocationID { get; set; }
    public string Description { get; set; }
    public byte North { get; set; }
    public byte East { get; set; }
    public byte South { get; set; }
    public byte West { get; set; }
    public byte Up { get; set; }
    public byte Down { get; set; }       
}
And here is the data:
(1, "I AM IN A JUNGLE CLEARING |EXITS ARE SOUTH"
    0, 0, 2, 0, 0, 0),
(2, "I AM ON THE TEMPLE STEPS |EXITS ARE NORTH"
    1, 0, 0, 0, 0, 0),
(3, "I AM IN THE TEMPLE |EXITS ARE NORTH"
    2, 0, 0, 0, 0, 0),
(4, "I AM IN THE HIDDEN HALL |EXITS ARE DOWN,NORTH,EAST AND WEST"
    3, 5, 0, 8, 0, 15),
Each location has a number that identifies the location (LocationID) and a description (Description). There are also six fields that allow the player to move to a new location.

Using this structure, the game engine can check if a move is valid.
For example: Location 1 (the Jungle Clearing) has only one valid movement (South) which will take you to Location 2 (the Temple Steps).

The Objects

Adventure games without objects to pick up and carry around are no fun. We used the following class to store the game objects and some of their properties:
public class Item
{
    public int ItemID { get; set; }
    public string Description { get; set; }        
    public int LocationID { get; set; }
    public bool CanTake { get; set; }
    public byte Command { get; set; }
}
We keep track of where the item is found in the LocationID .
When we are carrying the item we store a special number in the locationID which simply means that we are carrying it with us.
Finally we also have a flag that determines if we can pick an item up or not (we cannot pickup a door) and another field (Command) will help us link a command to this particular item.

Here is the data:
(7, "A MAGIC BLANKET", 6, true, 20),
(8, "A HIEROGLYPHIC TRANSLATOR", 10, true, 22),
(9, "A GOLD BAR", 16, true, 27),
(10, "A ROPE", 17, true, 28),
(11, "A SMALL BOAT", 19, false, 75),
Notice that the Magic Blanket is found in location 6, that it CAN be picked up and that for instance the Boat cannot be picked up.
Having the data structures into place, we can now concentrate on the game engine.

Next - The Game Engine