Rise of Nations Wiki

unitrules.xml is a game file which holds all unit parameters like resource cost, combat stats and speed.

For vanilla Rise of Nations, it is located in the \data\ subfolder. With the expansion installed, a new file is used, located in the \data\ of where the expansion is installed to.

Editing the file[]

The file can be edited with any text editor, like Windows' built-in notepad, or a dedicated XML editor such as Notepad++. The file's header holds some information on the parameters (see below).

Warning: Back up the file before editing! Also be aware that in multiplayer games, all users must use the same version of data files, otherwise the session will abort due to loss of synchronization.

Parameters description[]

Note: This list is still incomplete.

Entries beginning with a ☀ are simple copy/paste of the info in the unitrules.xml file.

NAME - Internal name of the unit. Do not change! Edit name in typenames.xml instead.

GRAPH - ☀ External lookup name of unit, used to find entries in unit_graphics.xml, help.xml, and so forth.

TYPENAME - ☀ Display name of unit (lookup via typenames.xml for foreign language localization).

OBJ_MASK - Upper case letters and numbers used. These are "flags" that determine the unit's damage multipliers (defined in balance.xml) or a specific property such as Z (detects stealth/hidden).

Common to both units and buildings.

FLAGS - Lower case letters used. These give the unit specific properties or behaviours such as o (hidden unit) or v (can fire while moving).

Only shared by units. Buildings have different properties for lower case letters.

A list of all available OBJ_MASK and FLAGS is given together with basic explanations in the unitrules.xml file.

WHERE - Production site of this unit. E.g., barracks, factory, etc.

ATTACK - How much damage the unit deals per attack, divided by the number of sub-units per unit. Shown in-game as strength. Does not reflect damage multipliers such as OBJ_MASK or number of projectiles per attack per unit. Minimum damage is always 1.

HITS - Default hit points, or HP. How much damage the unit can sustain before being destroyed.

MOVES - Speed of the unit. Modified by UNIT_MOVE_SPEED in rules.xml.

COST - Base resource cost, multiplied by 10 (UNIT_COST_FACTOR in rules.xml), with a letter to define the type of resource: f=Food, t=Timber, g=Wealth, m=Metal, o=Oil, k=Knowledge).

Example: 2f means the unit costs 20 Food. Two or more resources are possible by using the form 5g/6m/5o (the order doesn't matter).

See also: SUPPORT for ramping cost.

SUPPORT - Additional unit cost per unit when building more units of the same type. Note this value is not multiplied by 10 (so 2f actually is 2 Food). Make sure to use the same types of resources as for COST. Formatting is the same as with COST, but with support added.

Only two resources can be ramped per unit. The game simply ignores all but the first two resources.

See also: PROGRESSION below on how ramping cost should be calculated for this unit.

JOB_TIME - Base production time in frames (15 frames = 1 second). E.g., 225 = 15 sec. However, because of rules.xml, the actual base production time is 1.2x of this value.

PREQ0/PREQ1/PREQ2 - Research requirements (preq=prerequisites) to built this unit, up to three possible. Possible values are any technology (e.g. Enlightenment Age, Mercenaries or Steel), or none. For tech names, the default ones need to be used, as defined in the techrules.xml file.

Example: The Horse Archer has Classical Age as PREQ0 and Mercenaries as PREQ1, meaning both need to be researched to be able to built Horse Archers. PREQ2 is not defined in this unit, thus simply not used.

PREQ0 and PREQ2 are absolute values. If PREQ0>Finance<, you will always need to research the fifth Commerce.png Commerce tech to unlock it.

PREQ1, if a library "color" tech, scales depending on the starting/ending ages of the scenario/game.

FROM - Name of the unit this one upgrades from (NAME value of the preceding unit).

JUMP - Name of the unit this one upgrades to (NAME value of the succeeding unit).

GRAFT - Name of the unit this one replaces (NAME value of the replaced unit). Used with unique units and alternative variant units such as the different tanks and fighter planes, which replace the standard ones.

RANGE - Minimum and maximum distance the unit can fire, in tiles.

LOS - Line of Sight, the unit's default vision range, in tiles. See also SCIENCE_LOS.

SCIENCE_LOS - Additional Line of Sight gained with each Science.png Science technology researched at the library. By default only used for Scouts and scouting towers (Lookout, stationary AA defenses). Suggested to be used sparingly.

FLY_HIGH - The chance to hit a "high flying" (not attacking, just moving) air unit, in %.

FLY_LOW - The chance to hit a "low flying" (attacking/engaging a target) air unit, in %.

RECHARGE- Delay between two instances of firing. Value is given in frames not seconds, so 15 = 1 sec, 60 = 4 sec, etc.

ARMOR - Amount subtracted, AFTER calculating damage multipliers, from the incoming damage from an attack. The minimum damage sustained is always 1.

DOMAIN - Whether the unit is a land, sea or air unit.

TO_HIT - Accuracy. Chance to hit the target, in %. Numbers ≥100 mean the shot will always hit the unit and deal damage.

ATTENUATE - Amount of accuracy added or subtracted per tile of distance between attacker and target.

A unit with TO_HIT>100< and ATTENUATE>-10< would mean 100% accuracy at 0 range, 90% at 1 tile distance, 80% at 2 tile distance, etc. Apparently also depends on target unit's TARGET_SIZE.

CAT - Mainly for AI and unit formations.

PROGRESSION - Determines how the Ramping Cost is calculated. There are four possible values (0-3), though only 0 and 3 of them are ever used

  • 0 = Ramp linearly based on # of units of the same type. By default used for all civilian units, support/special units, artillery, and aircraft.
  • 1 = Ramp linearly based on # of units of the group (e.g. "Barracks Units"). By default not used at all.
  • 2 = Ramp progressively based on # of units of the same type. By default not used at all.
  • 3 = Ramp progressively based on # of units of group (e.g. "Barracks Units"). By default, used for most units trained at the Barracks, Stable/Auto Plant and Dock.

SPLASH - Area of effect radius of an attack, in tiles.

SPLASH_PERCENT - How much % of the base damage is transferred onto each consecutive "ring" of tiles.

A unit with SPLASH>5< and SPLASH_PERCENT>90< would lose 10% damage per tile away from the projectile's impact location until 50% damage done 5 tiles away from the impact and 0 damage on tiles further away.

AMMO_PER_ATT - How many projectiles are fired per shot. Damage and damage/armor interaction is distributed between projectiles. Mainly for machine guns, air units and ships but also some vehicles, mamelukes and, interestingly, British and Korean unique archers which fire two projectiles per attack sequence.

E.g., a unit with ATTACK>33< and AMMO_PER_ATT>6< attacking target X with ARMOR>6< does 5.5 damage per projectile for a total of 33 damage per attack sequence, then target X will subtract 1 damage from each projectile for a total of -6 per attack sequence. In the end 27 damage is applied to target X.

Note that sometimes changing this value can be incompatible with a unit's specified firing animations as specified in unit_graphics.xml. For most units this isn't an issue, but in some cases (e.g. the Brig) it can cause an incorrect number of attacks to occur if the animations do not support the specified AMMO_PER_ATT value.

TURN_SPEED - How fast the unit can turn to face a different direction. Higher numbers mean faster turn speed. Does not apply to stopped Foot and Mounted units which turn instantly (FLAGS>b<). Modified by UNIT_TURN_SPEED and UNIT_PACK_TURN_BONUS (for pack/unpack units) in rules.xml.

PROJ_SPEED - For units that have range, how fast the projectile moves. Also affects projectile's arc: slower speeds give higher arcs.

CARRY_SIZE - Legacy value

POP - The amount of Population points this unit takes up. By default this is 2 for all artillery units and most ships, and 1 for all other units.

RESEARCH_PREMIUM_TIME - The research time of the unit is its JOB_TIME multiplied by this value.

RESEARCH_PREMIUM_COST - The research cost of the unit is its COST multiplied by this value.

JOB_EXTRA_TIME - Ramping cost for JOB_TIME when building more units of the same type. With each unit created this fraction of JOB_TIME will be added to the next unit. E.g., 1/10tsx = 10% extra time.

MANA - The amount of Mana the unit has. For generals, scouts, airplanes, etc.

TRIBE_MASK - Determines which nations have access to the unit. Each digit "slot", from far left (Persians) to far right (Aztecs), represents a nation. 1 = can build, 0 = cannot.

CARRY - Legacy value

GUY_SPACING - Horizontal distance between individual sub-units in a 3-soldier single unit.

X_SPACING - Horizontal distance from other units in a formation.

Y_SPACING - Vertical distance from other units in a formation.

CIRCLE_RADIUS - How large the circle drawn is around a selected unit, in tiles.

BLOCK_RADIUS - How large the unit is for purposes of collision with other units, in tiles.

TARGET_SIZE - Area around the unit in which it will be considered "hit" if a projectile lands there, in tiles.

UBER_SIZE - How many individual sub-units the unit is made of. 3 for most infantry, 1 for most other units.

CREW_SIZE - How many individual "crew members" the unit has. Mainly for siege units.

GRID_X - X coordinate (horizontal) for the unit on its creation building's lower left panel.

GRID_Y - Y coordinate (vertical) for the unit on its creation building's lower left panel.

UPGRADE - Legacy value

PUSH_SIZE - ☀ For units that "push" (ie siege, supply wagons, boats), their collision profile is described by a number of circles (specified by push_circles) of radius push_size. These circles are spaced evenly along the "forward to back" axis of the unit (ie, the length of a boat), each circle tangential to the next.

PUSH_CIRCLES - ☀ For units that "push" (ie siege, supply wagons, boats), their collision profile is described by a number of circles (specified by push_circles) of radius push_size. These circles are spaced evenly along the "forward to back" axis of the unit (ie, the length of a boat), each circle tangential to the next.