Overview
One of the most common things you can do with a Tuning Pack is changing the stats of a unit.
In this continuation of the spearman example, we will be changing a number of the spearman's stats, including Build Time, Movement Speed, Health, and Population Cost.
These workflows are broadly applicable to any unit stats you wish to change.
1) Change Build Time
The Build Time of a unit is located in the time_seconds field. This is how long, in seconds, the unit takes to build.
In this example for the spearman, we are changing the build time to 15 seconds.
2) Change Movement Speed
To change movement speed, navigate to extensions > moving_ext > speed_scaling_table.
The default_speed of the unit controls its normal speed. Movement speed is listed in meters per second (a meter is 1/4th of a tile).
Note that the max_speed value refers to the maximum speed the unit can move when affected by buffs and any other modifiers that increase it's speed.
The maximum speed should never be set to exceed 8. Exceeding this limit may cause errors in the game.
In this example, we will change the spearman's movement speed from 5 to 6.
3) Change Unit Health
To change a unit's health, open the health_ext node.
There are three primary attributes within this node, including: Armor, Health, and Health Regeneration.
Armor allows you to individually tune a unit's resistance vs fire, melee , and ranged damage under armor_scaler_by_damage_type.
Health is straight forward and found under the hitpoints node. The value found here will determine how much health a unit will have.
Health Regeneration is a rare stat most units do not possess, which allows them to slowly regenerate health at a constant rate. The Regeneration stat determine how much health units regenerate per tick, with ticks occurring 8 times each second.
4) Change Population Cost
Population Cost is located in the same place as the other unit resource costs, located in the personel_pop field.
Enter in your desired population cost here. In this example for the spearman, we are leaving it at 1 population
By default, most human units cost 1 population, while siege units and naval ships typically cost more.
5) Sight Range
A unit's sight range is contained in the sight_ext node.
The sight range of units in Age of Empires 4 have numerous factors, depending on their elevation and surrounding terrain, as visualized in the "lampshade" graphic below.
The Sight "Lampshade"
The shape of a unit's vision in Age of Empires IV can be described as a "lampshade" shape. Understanding how this "lampshade" works is critical to accurately controlling a unit's sight.
The "lampshade is visualized in the diagram below, with the unit projecting vision represented by the central purple dot.
- Inner Radius: The base value of the unit's sight that "floats" above the unit. This determines the maximum radius of vision the unit gains when looking up a hill or cliff.
- Inner Height: The maximum height of the origin of the unit's sight, which determines how far up a hill or cliff the unit can see. This is additive with the elevation of higher ground.
- Ground Plane: The cutoff where the ground usually is. This is the unit's normal sight radius, with a distance somewhere between the Inner and Outer radius sight radii.
- Outer Height: The maximum depth of a unit's vision, which determines how far down a hill or cliff the unit can see.
- Outer Radius: The maximum range the unit's sight is increased by being at higher elevation. This determines the maximum radius of vision the unit gains when looking down a hill or cliff.
The distance a unit can see on flat ground is represented by the Ground Plane, which does not have a set value. Instead, the Ground Plane gains its sight value as a value somewhere between the Inner Radius and the Outer Radius.
This mid point can be controlled using the Inner Height and Outer Height values, which will move the Ground Plane up or down, depending where their values are set.
If both the outer and inner radius are the same value, the unit's line of sight in all situations would be identical. When the outer radius is larger than the inner radius it creates a slope, which means the unit can see further downhill and less far uphill.
Modify Sight Value
To modify a unit's sight, open the sight_package node to modify these sight values.
This values here are measured in Meters. Distance in the game's UI is measured Tiles. There are 4 Meters in each Tile.
In the example below, the spearman's sight range has been set to 12 meters on lower ground and up to a maximum of 36 meters when on higher ground.
Stealth Forests
Stealth forests block sight using the sight height mechanic, and have a height of 500. This means a unit needs to have an inner height of greater than 500 to see into stealth forests.
High ground is added to a unit's vision height, which can sometimes cause it to exceeds 500 when the unit is on a hill or cliff looking down into a stealth forest.
Continue?
To continue this tutorial, proceed to: Example 5 - Hardpoints and Damage