Data Structure for Maps

by Dale M.A. Johnson

 

created 3/31/06

updated 4/15/06

 

This document lays out the basic data structure maps should adhere to.

 

Basic Overview

Maps need to store the following data for each map tile: The terrain tile, the object, any naming over-rides, and the character or generic unit occupying it. The map must also hold data regarding its size and what tile set to use.

 

The Actual Structure and its Members

The following is a description of all the members in typedef struct stMap, which is used as the object, sMap. There only needs to be one sMap data Structure; having more than one would be a waste of memory because only one map needs to be open at a given time. All other maps should be saved, and then loaded up as need be.

 

struct stMap

proposed version 0.5

 

Header Data

 

string tName
The map's name.
string tAuthor
The name of the person who actually map this map.
string tDescription
A description of the map. Only shown for multiplayer maps, although it can be used for note taking by the map author for campaign maps.
int iMapVersion
Not the version of the individual map, but the version of the map data standard this map was saved with. This is used so that older maps can still be imported into newer editors.
int iSizeX
How wide, in tiles, the map is. 20 is the smallest this can be. 120 is the largest.
int iSizeY
How tall, in tiles, the map is. 15 is the smallest this can be. 120 is the largest.
int iTileSet
Which tile set to use.

 

Team Data

 

string tTeam[team]
The name of the given team. Added 4/13/06
string tVictoryCondition[team]
A short string of text that gives an overview of the team's goal and is displayed on the map screen whenever that faction's turn comes up. For example: "Defeat all Enemies." Added 4/13/06
bool bIgnoreVictory[team]
Whether or not this team is counted when checking who will win a given battle. Added 4/13/06

 

Faction Data

 

string tFaction[faction]
The name of this faction. Added 4/13/06
string tFactionDescription[faction]
A short description of the faction that can be viewed during battle. You can use this to list victory conditions for the player as well. Added 4/13/06
bool bHumanFaction[faction]
If true, then this team is controlled by the player. Otherwise, the computer will handle this faction. Added 4/15/06
int iFactionDifficulty[faction]
On a scale of 1-5, how "smart" this faction is to be. Five is the smartest. May or may not be supported in the final version. Added 4/15/06
 
int iFactionParty[faction]
The numeric ID of the party to assign to this faction slot. There are sixteen factions per map. The factions will inherit the party members and gold of the party given. Altered 4/13/06
int iFactionTeam[faction]
What team this faction is a member of. Added 4/13/06
int iBanner[faction]
The numeric ID of the banner image to apply to this faction. Added 4/13/06
int iFactionColor[faction]
What color scheme to give a faction.
int iMapMusic[faction]
What music will play for this faction. Added 4/13/06
int iBattleMusic[faction]
What music will play when this faction engages in a battle. Added 4/13/06
bool bUsePrepScreen[faction]
Whether or not this faction will use the preperations screen for this map.
int iSubFaction[faction]
What faction the given faction is a subfaction of. -1 means that it is not the sub faction of any faction. Added 4/13/06

 

(Victory Condition variables to be determained and added in a later version.)

 

Terrain Data

 

int iTerrain[x, y, layer]
The tile that is residing in a given map coordinate at the given layer. Altered 4/14/06
string tTerrainName[x, y]
An over-ride for terrain names. If this is left null (it generally will be), then the map will just use the default name for that terrain. This will give map authors more flexibility in creating maps, because it means that terrains that would normally only have one tile (like shops and forts) can occupy the same terrain slot in the tile set data, then be given a unique name for the map. One could even use this to, say, name individual houses: One house on the map could be called "Marth's House" in the terrain window. The possibilities are endless.

 

Conversations

 

string tTalkDesc[faction, conversation]
The "name" of the pre-battle conversation. There can be up to ten of these per faction. Added 4/13/06
int iTalkPreBattle[faction, conversation]
What scene to play for this conversation. Added 4/13/06
int iTalkImportance[faction, conversation]
On a scale of one to three, how "important" this conversation is. A different icon will be displayed depending on what number this is. Added 4/13/06
int iCharTalk[character 1, character 2]
The numeric ID of the scene to play when these two characters select the "talk" option from the action menu during their turn. Added 4/13/06
int iCharTalkAttack[character 1, character 2]
If one of these characters attacks the other, what scene to play. Added 4/13/06

 

Shops

 

bool bShop[x,y]
true if a shop is residing at a given map coordinate.
string tShopName[x, y]
The name of a given shop, ie what will be displayed on the unit's action menu when they move onto that space. For example "Armory." If this is null, it will just display plain "Shop."
bool bFactionCanEnterShop[x, y, faction]
Whether or not a given faction will get the "shop" option on their action menu when they arrive at this square.
bool bFactionCanUseShop[x, y, faction]
Whether or not, once they've entered a shop, the unit can actually buy or sell anything. If not, they will be shooed away by the shop keep.
int iShopKeep[x, y]
What face to use for the shop keep at this square.
int iItem[x, y, slot]
The items that this shop sells, in numeric item IDs. There are 20 slots per shop.
int iItemRepair[x, y]
Whether or not this shop will repair items for you. Added 4/13/06
int iPrice[x, y, slot]
The price of a given item.
int iPriceMarkup[x, y, faction]
What percentage to add to that faction's prices (for example, 10 will add 10% to the prices in this shop, and will take 10% away from the money you'll get for selling something here). Max is 1000, minimum is -1000 (which would greatly increase the money you get for selling something--useful for a hidden pawn shop, perhaps). If a price ends up veing smaller than 1 because of the markup/markdown, then the price will end up being exactly 1.
string tItemWelcome[x, y]
What the shop keep will say when a unit first enters a shop.
string tItemBuy[x, y]
What the shop keep will say if a unit looks over the merchant's goods.
string tItemSell[x, y]
What the shop keep will say if a unit looks over their his or her own inventory for something to sell.
string tItemConfirm[x, y]
What the shop keep will say, asking the unit if they are sure they want to make the transaction.
string tHurryUp[x, y]
If the unit is taking awhile on the buy or sell screen, the shop keep's dialogue will change to this.
string tItemThank[x, y]
What the shop keep will say if you buy something.
string tItemGoAway[x, y]
If a given faction is not welcome, this is what the shop keep will tell them.
int iShopItemRequired[x, y]
The numeric ID of the item that you must have in your inventory in order to have access to this shop--Otherwise it will not show up on the unit's action menu.

 

Faction (Prep Screen) Shops

 

bool bFShop[faction, shop]
Whether or not this faction has access to a shop at their preperations screen. Each faction may have up to four unique shops.
string tFShopName[faction, shop]
The name of this shop as it will appear on the preperations screen menu.
int iFShopKeep[faction, shop]
What face to use for the shop keep.
int iFItem[faction, shop, slot]
The items that this shop sells, in numeric item IDs. There are 20 slots per shop.
int iFItemRepair[faction, shop]
Whether or not this shop repairs items for you. Added 4/13/06
int iFPrice[faction, shop, slot]
The price of a given item.
string tFItemWelcome[faction, shop]
What the shop keep will say when a you first enter a shop.
string tFItemBuy[faction, shop]
What the shop keep will say if you look over the merchant's goods.
string tFItemSell[faction, shop]
What the shop keep will say if you look over a unit's inventory for something to sell.
string tFItemConfirm[faction, shop]
What the shop keep will say, asking the you if you are sure you want to make the transaction.
string tFHurryUp[faction, shop]
If you are taking awhile on the buy or sell screen, the shop keep's dialogue will change to this.
string tFItemThank[faction, shop]
What the shop keep will say if you buy something.
int iFShopCharacterRequired[faction, shop]
The numeric ID of the character that must be in the faction's army in order for this shop to appear. (Hint: If you want to do FE9-style shops where you must have NPCs in your party, simply add a dummy character to the faction's party, but set that character to "invisible" so that they don't show up on any of the party or item screens.)

 

Inns

 

bool bInn[x, y]
true if an inn is residing at a given map coordinate.
string tInnName[x, y]
The name of the inn, as it will appear in the unit's action menu.
int iInnKeep[x, y]
The portrait to use for the inn keeper.
int iInnFlatPrice[x, y, faction]
The set price to stay at that inn, for each faction.
bool bFactionCanEnterInn[x, y, faction]
Whether or not the faction's units will get the inn listed in their action menu when they arrive at this square.
bool bFaction CanUseInn[x, y, faction]
Whether or not the inn keep will actually let them stay, or tell them to leave.
int iInnPricePerHP[x, y, faction]
How much the inn will charge per HP to heal a unit. This is in addition to the flat price, if applicable.
int iInnPricePerMP[x, y, faction]
Similar to the above, only for MP instead of HP. Added 4/13/06
string tInnWelcome[x, y]
What the inn keep will say to the unit when they arrive.
string tInnGoodnight[x, y]
What the inn keep will say if the unit chooses to stay.
string tInnNotEnoughMoney[x, y]
What the inn keep will say if the unit doesn't have enough money to stay at the inn.
string tInnGoAway[x, y]
What the inn keep will say if the faction is not welcome at this inn.
bool bAutomatic[x, y]
Whether or not the inn is "automatic." If this is true, then the option to stay at the inn won't show up on the unit's action menu. Instead, at the beginning of the next turn, if the unit is standing here and they are allowed to use the inn, their HP will be refreshed and any money needed will be taken out of the faction's account. (This setup is similar to the little chapels in Genealogy of the Holy War.)

 

Events

 

int iEvent[x, y, faction]
The event ID that is residing at a given map coordinate. Villages are a type of event. Because events are faction-dependant, you can have different events for each faction (one faction can visit a village, while another faction will raze it). The actual events are not stored with the map data.
bool bEventIsAutomatic[x, y, faction]
A boolean operating corresponding to a given iEvent coordinate. If this is true, the unit will end its turn, and the event will occure as soon as the unit steps on the tile (for example, a trap).
bool bEventIsAFlag[x, y, faction]
Similar to bEventIsAutomatic. The difference is that even though this is triggered simply by the unit moving over it, it won't stop the unit, and it isn't actually triggered until the unit the unit has ended its turn.
string tEventName[x, y, faction]
The "name" of the corresponding iEvent coordinate. This is the name that will show up as an option in the unit's action menu. For example, you would name a village "Visit" so that the word "Visit" shows up on the unit's action menu, letting you select it and trigger the event (in this case, letting the unit visit the village). If left blank, then the event will be triggered by the unit ending their turn in this square.

 

Characters and Units

 

int iGeneric[x, y]
The generic unit that will start in this square.
int iCharacter[x, y]
The character unit that will start in this square. Generic units and characters may not occupy the same square. If this character is dead then they will not appear unless the bForce flag for this square is set to true.
int iFaction[x, y]
What faction will have control of the unit or portal in this square.
int iStrategy[x, y, catagory]
What strategy this unit should adhere to. There may be different catagories that you can assign strategy to. Altered 4/13/06
bool bPortal[x, y]
If true, then there will be a portal in this square that the faction in control of the square can assign a character to during their preperations screen phase.
bool bForce[x, y]
If true, then even if the character in this square is dead, they will be forced to appear anyway.
bool bImportant[x, y]
If true, then if the unit in this square dies, then this faction automatically loses. Remember to set this for your lords!
string tCharName[x, y]
The name to apply to this unit (overrides the set "real" name). Added 4/13/06
int iCharMusic[x, y]
What music to play when going into battle with this unit. Over-rides both the faction battle music, and the music set to any equiped items on either side. Added 4/13/06