Technology template files use the JSON format and are put in simulation/data/technologies (see mod layout).

The technologies available to be researched from a building are defined by

<ProductionQueue> 
  <Technologies datatype="tokens"> 
    town_phase 
    city_phase 
    plough 
  </Technologies> 
</ProductionQueue>

If a technology is required for training or building then use

<Identity>
  <RequiredTechnology>town_phase</RequiredTechnology> 
</Identity>

The basic format is:

{
    "genericName": "Town Phase",
    "specificName": {
        "generic": "Generic Specific City Name",
        "hele": "Greek City"
    },
    "cost": { "food": 100, "wood": 100, "stone": 0, "metal": 50 },
    "requirements": { "class": "Village", "numberOfTypes": 2 },
    "requirementsTooltip": "Requires two village structures",
    "supersedes": "village_phase",
    "icon": "town_phase.png",
    "researchTime": 10,
    "autoResearch": false,
    "tooltip": "Advance to Town Phase",
    "modifications": [
        {"value": "ResourceGatherer/Rates/food.grain", "multiply": 15, "affects": "Spearman"},
        {"value": "ResourceGatherer/Rates/food.meat", "multiply": 10}
    ],
    "affects": ["Female", "CitizenSoldier Melee"]
}

specificName: The civ specific name will override the generic name if the player has that civ.

researchTime: This is the time it takes to research the technology in seconds.

supersedes: This is for techs which are in a sequence. The tech which it supercedes is a requirement (in addition to requirements). The GUI "stacks" the set of superceding icons so this tech will only be visible when the tech which it supercedes has been researched.

requirements: This defines what is required for the tech to be available for research. Currently (20/04/2012) the available requirements are:

  • { "tech": "town_phase"} - This tech must be researched
  • {"civ": "rome"} - The player must be this civ
  • { "class": "Village", "numberOfTypes": 2 } - this means that the player must own two different types of entity with the class Village, i.e. a house and a civil center meet the requirements but two houses does not.
  • { "all": [{...}, {...}, ...]} - All of the requirements in the list must be met.
  • { "any": [{...}, {...}, ...]} - At least one of the requirements in the list must be met.

requirementsTooltip: A human readable version of the requirements to be displayed in the tooltip.

icon: Icons should be placed in art/textures/ui/session/portraits/technologies.

autoResearch: If this is true then the technology will be instantly researched with no cost when the requirements are met. This could be useful for complicated technology setups or for civ specific bonuses. This is an optional field and if set then cost, researchTime etc. are not needed because it is not user visible.

modifications: This is an array of modifications that the technology makes. A modification specific affects attribute is pecific to this modification. The values to modify will be added on request. The available modifications are:

  • multiply - adds (multiply-1)*originalValue to the property. Note this is not cumulative.
  • add - adds this number to the property. Can be negative.
  • replace - this replaces the existing value (useful if no original value exists). The ordering of multiple replaces is not defined.

Note that the code does no validity checking for the modification, the technology writer is responsible.

affects: A list of sets of classes which determine which entities are affected by the modification. So the example above will affect females and melee citizen soldiers. So all of the classes within a string are required and it will affect an entity which matches any of the strings.

Note that it is possible to add one extra affects string per modification line. This string will be used as extra condition to apply the affect. The above modification would apply to "spearman females" (which don't exist) and "spearman melee citizen soldiers".

Technology Pairs

A technology pair has a pair json file which is added to the list of tokens in ProductionQueue. It has the following format:

{
    "genericName": "Tech Pair",
    "top": "techA",
    "bottom": "techB",
    "supersedes": "anotherTechPair"
}

Each of the technologies which are part of the pair should also have a "pair":"techPair" attribute linking them to the pair definition.

Last modified 4 months ago Last modified on Apr 14, 2014 5:12:55 PM