GAE/Resource XML

From MegaGlest
Revision as of 14:24, 26 March 2011 by Hofmic (talk) (Adding categories)
Jump to: navigation, search

Game resources are specified under the 'resources' directory of the tech tree. Each resource will have it's own subdirectory and a resource specification file with the same name as the resource, but ending in '.xml'.

Note that there are 4 types of resources and that only one of the below can be specified for a single resource.

Common Resource XML elements

<resource>
    <image path="images/image.bmp"/>    <!-- Icon image for this resource. --> 
    <type value="static"/>              <!-- Type of resource, see below. -->
    <display value="true|false"/>       <!-- Optional: default true. -->
</resource>

The image is used on the resource bar showing how much the players faction currently has, as well as in the display panel when 'tech' or 'tileset' resource types are selected. The four types of resource are each discussed individually. The display element is used to control whether this resource should be displayed on the resource bar, if omitted it will be displayed (if the faction uses it).

Resources by type

static

Static resources are generated once and then used as needed to build units or research upgrades. Static resources need to be produced with a unit (produced, built or morphed) or generated (by including a negative cost for the resource).

In the case of units the default behaviour on death is for the static resources to be 'recouped' back into the pool, to be used again. This behaviour can be overridden by setting recoup-cost to false. Static resources used for upgrades or generated resources can never be recouped.

<resource>
    <image path="images/aa_gun.bmp"/>
    <type value="static">
        <recoup-cost value="false"/>    <!-- Optional: default true --> 
    </type>
</resource>


consumable

Consumable resources are generated and consumed on an interval. The interval is specified in seconds and after each interval all units or generated products that have a negative cost for a consumable resource add that amount to the factions store, and all units with a positive cost subtract that from the store. If a positive cost can not be afforded, the units take damage equal to one third its max-hp each interval.

As with static resources, consumables need to be produced with units or generated.

<resource>
    <image path="images/food.bmp"/>
    <type value="consumable">
        <interval value="20"/>    <!-- Required: evaluation interval in seconds --> 
    </type>
</resource>

tech

Tech resources have their models defined in the model element. Tech resources must be included on the map and need to be harvested and stored. The default-amount is the starting amount for each tile.

Generally only 2 tech resources are used, as this is what virtually all maps provide, technically the engine supports up to 117 tech resources, though the map editor will only let you place 5.

<resource>
    <image path="images/stone.bmp"/>
    <type value="tech">
        <model path="models/stone.g3d"/>
        <default-amount value="1500"/>
        <resource-number value="2"/>
    </type>
</resource>

tileset

Much the same as tech resources, except the models come from the tileset. The tileset-number refers to the object type, see (Insert Link) elsewhere for the conventional interpretation of the tileset object numbers.

<resource>
    <image path="images/wood.bmp"/>
    <type value="tileset">
        <default-amount value="300"/>
        <tileset-object value="1"/>
    </type>
</resource>