The Building Configuration File

The different types of Buildings are configured in a Building Configuration File which is referenced by the BuildingManager. To configure your own game you can update this XML file (or create a new one) to define new buildings, costs, activities and more.

 

The configuration file uses an XML format to store the data. The XML is a serialised representation of a List of BuildingTypeData.

 

 The following table lists the elements of the XML file. 

Parameter

Details

 Sample

id

Unique identifier for this building. Note that the ID should be unique across buildings AND occupants.

 

<id>SAWMILL</id>

name

Human readable name of the building.

 
<name>Sawmill</name>

description

Human readable description of the building. 

 
 <description>Used to gather resources from forests. Required for most other buildings.</description>

spriteName

Name of the sprite to use for this building. Looked up in the NGUI Atlas by this name so it muct match exactly.

 

isObstacle

Set this to true if the building is an obstacle that is cleared instead of being built.

<isObstacle>true</isObstacle> 

cost

Cost to build (or clear if this is an obstacle).

 <cost>20</cost>

buildTime

Time to build (or clear if this is an obstacle). Measured in seconds.

 <buildTime>60</buildTime>

allowIds

A list of strings containing ids of the buildings and occupants that this building allows. Note that allowIds is used for UI only, it is the requireIds field that prevents things being built.

 <allowIds>
  <string>BARRACKS</string>
</allowIds>

requireIds

A list of strings containing ids of the buildings and occupants required before this building can be built.

<requireIds>

  <string>BARRACKS</string>

</requireIds>

shape

The shape of the building defined by grid offsets from 0,0 that are occupied by this building.

Entries of (0,0), (1,0), (0,1), (1,1) would define a small square building.

<shape>
  <GridPosition x="-2" y="-2"/>
  <GridPosition x="-1" y="-2"/>
  <GridPosition x="-2" y="-1"/>
  <GridPosition x="0" y="-2"/>
  <GridPosition x="-2" y="0"/>    
  <GridPosition x="-1" y="-1"/>
  <GridPosition x="0" y="-1"/>
  <GridPosition x="-1" y="0"/>
  <GridPosition x="0" y="0"/>
</shape> 

activities

List of custom activities (defined by ID and loaded by the ActivityManager) that this building can do.

<activities>
  <string>GATHER</string>
</activities>   

generationType

Type of reward automatically generated by this building. Ignored if generation amount = 0.

For obstacles this is reward type for clearing.

<generationType>RESOURCE</generationType> 

generationTime

Time it takes to generate the reward (in seconds).

 <generationTime>2</generationTime>

generationAmount

Amount of reward to generate each time interval.

 

For obstacles this is reward amount for clearing.

 <generationAmount>1</generationAmount>

generationStorage

Maximum amount of generated reward to store in this building.

The acknowledgement indicator will appear once this value is reached.

 <generationStorage>50</generationStorage>

occupantStorage

The space for holding occupants.

Note that occupants size can be variable (for example a building could hold two tigers with a size of 1, but only one elephant which has a size of 2).

 <occupantStorage>2</occupantStorage>
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk