This section explains several issues related to the game mechanics. It describes the contents of the following files:
AI: \tactical\configs\game\listofai.txt
Observation: \tactical\configs\game\tactconfig.txt
Difficulty: \strategic\configs\listofdifficulty.txt
Bases: \strategic\configs\geosphere\listofbase.txt and \strategic\configs\geosphere\basesownership.txt
Phases: \strategic\configs\game\listofphase_content.txt
AI basically tries to level all of unit's needs (to reach a balanced state) which are of four types (grouping, tiredness, protection and aggressiveness). Every game tick a small number is added (or subtracted) to a parameter representing state of each need (DELTA) so that it will try to get to some specified value (DEFAULT). AI's goal is to ultimately get all these parameters to unit's balanced state (AIDEFAULT).
Of course it could be impossible to succeed (i.e. unit can be always aggressive and will always attack). The parameters can be also modified by one-shot actions (i.e. unit has been hit, so some value will be subtracted from its aggressiveness) or by lasting actions (i.e. unit is attacking, so it is satisfying its aggressiveness and thus some small number can be subtracted each tick). When it is necessary to decide what unit should do, AI system will try some actions (i.e. move here, move over there, attack, stay here) and will choose the one that will possibly bring the parameters closest to balanced state. Please note that some actions like reloading or picking up weapons from ground are treated as attacking.
Also there are some "hacks" which are basically hard-coded multipliers depending on the a state of the attacked unit (i.e. when the unit is trying to attack an unconscious unit it will satisfy its aggressiveness less than if it was attacking a conscious opponent). The lasting actions are usually multiplied not only by 1 (usable basically only when asking if unit is walking) but also by a number specifying how much given action is in effect (i.e. when we are closer to enemies ENEMYNEAR will affect our needs more, it depends on quality of cover how much will COVERED affect our needs, etc...).
The overall structure is:
LIST_OF_AI
AI
//opens AI definition
CREATURE LITTLE_BIRD
//name of the creature, see below
SUB_AI
//opens configuration for one type of need
GROUP
//can be GROUP, TIRED, PROTECTION, AGGRESION, HELP (HELP is not supported)
MIN -10.0
// mimimal value of "need parameter" (it can't get below this number)
MAX 10.0
// maximal value of "need parameter" (it can't get above this number)
//the next three keys define the unit's behavior when it does not see an enemy. The meaning of keys is explained above.
DEFAULT0 7.0
DELTA0 0.01
AIDEFAULT0 0.0
//the next three keys define the unit's behavior when it can see an enemy. The meaning of keys is explained above.
DEFAULT1 5.0
DELTA1 0.01
AIDEFAULT1 0.0
MULTIPLIER 1.0
//this multiplier is applied to every subtraction or addition to "need parameter"
//following parameters are one-shot actions which will add x to "need parameter" when something happens
IMATTACKED 0.0
//add number when a bullet enemy shot got to your proximity (it doesn't need to be a hit)
IMWOUNDED 0.0
//add number when you're wounded (x is multiplied by severity of wound)
IATTACKED 0.0
//add number when a bullet you shot got to a proximity of enemy (it doesn't need to be a hit)
IHIT 0.0
//add number when you wounded an enemy (x is multiplied by severity of wound)
ENEMYSPOT 0.0
//add number when you have spotted one enemy
FRIENDHIT 0.0
//add number when your friend is wounded (x is multiplied by severity of wound)
FRIENDDEAD 0.0
//add number when your friend has just died
ENEMYDEAD 0.0
//add number when an enemy has just died
ENEMYHIT 0.0
//add number when another enemy is wounded (x is multiplied by severity of wound)
SLOWPROJLAUNCHED 0.0
//add number when you see an enemy which has just fired from a rocket launcher
//following parameters are lasting actions which will add x (usually modified) to "need parameter" when something is happening. They are also used (unlike one-shot actions) in decisionfunction.
ENEMYNEAR 0.0
//number is modified by your closeness to enemies (it is exactly 1.0f - Mult(i)(1.0f - 1.0f/sqrtf((nx(i) - x)^2 + (ny(i) - y)^2))) where x, y is your position and nx(i), ny(i) is a position of i-th enemy you see.
FRIENDNEAR -0.045
//number is modified by your closeness to a friend (equation is similar to above)
COVERED 0.0
//number is modified by a percentage of how good this field is good for cover (is not used in nature!)
ATTACKING 0.0
//number*0.75 when attacking somebody
WALKING 0.0
//when walking or running
ENEMYSEEN 0.0
//not used
END_OF_SUB_AI
...
END_OF_AI
//end of AI configuration for one creature type
...
END_OF_LIST_OF_AI
When calculating who can see whom, we do it in several steps:
1. For each pair of observer/target we calculate the value of cover. This depends on the intervening obstacles and on the stance but not on any skills.
2. We calculate the increase of the observer's awareness of the target. This is done by the following formula:
Where A, D1, D2, E1, E2, E3 are some constants, defined in the configuration file.
Angle_coef takes into account the angle between observer's facing and direction toward the target. It depends on the observer's movement mode and it is determined by this formula:
Standing: angle_coef = 1
Walking: angle_coef = (W1 + cos(alpha)) / W2
Running: angle_coef = (R1 + cos(alpha)) / R2
W1, W2, R1 and R2 are constants defined in the configuration file.
Targ_visib_coef is the target's own visibility or conspicuousness. It is calculated as:
Where conspicuity is determined by the value in the eponymous key in the file ListOfCreature, move_coef depends on the target's movement mode and it is 4, 2, 1, 0.5, and 0.2 for running, walking, standing, kneeling and lying prone respectively. Light_intensity is a property of the square the target occupies and B1(Stealth) is 1.125^(Stealth – 2), i.e. for target with Stealth Average, B1(Stealth) = 1, for Good it is 1.125, etc.
If the value of increase is too small, the observer's awareness is not increased.
2a. If the observer cannot see the target, his awareness of the target slowly decreases:
decrease = threshold / 35 * 1/B1(Intelligence)
Where threshold is the spotting threshold calculated as:
Here thresh_basic is the value of THRESHOLD key in the ListOfCreature.txt.
3. Finally we compare the observer's awareness of the target to his observation threshold. If the threshold is crossed, the observer spots the target.
LIST_OF_DIFFICULTY
DIFFICULTY
LEVEL 0
//0 is Easy, 1 is Normal, 2 is Hard
RESEARCH_TIME 0.7
//all R&D times are multiplied by this
DAMAGE 1.35
//multiplies the damage the player does to enemy
EQUIP 1.5
//multiplies the number of weapons player gets when he captures a base
RESOLUTION 1.2
//multiplies a chance an auto-resolved mission will go in the player's favor
ADAMAGE 0.75
//multiplies the damage the enemy does to the player
ENEMIES 0.8
//multiplies the number of enemies in mission
AIRCRAFT 1.3
//multiplies the chance to win an air combat
END_OF_DIFFICULTY
...
END_OF_LIST_OF_DIFFICULTY
The information about bases is in several files: the first, ListOfBase.txt defines the basic properties of bases, the other three, baseownership.txt, baseownership_eu.txt and baseownership_as.txt define the starting bases for start in America, Europe and Asia respectively.
LIST_OF_BASE
BASE
LEVEL_20 TRUE
//ignored
LEVEL_40 FALSE
//ignored
LEVEL_60 FALSE
//ignored
NAME_OF_BASE "Anchorage"
//unique ID, to change the name of base, modify your localization pack.
LOCATION "Alaska"
//ignored
EQUIPMENT "US"
//preferable equipment type
COORDINATES_LATTITUDE 61.17 n
//base postion
COORDINATES_LONGITUDE 149.98 w
TYPE "M"
//base type, see below
END_OF_BASE
...
END_OF_LIST_OF_BASE
A base can be of the following types:
M | Military |
B | Anti-biomass |
S | Scientific |
T | Engineering |
The game goes through twelve phases. The file that defines how the game changes in different phases has the following structure:
LIST_OF_PHASE_CONTENT
PHASE_CONTENT
PHASE 1
//phase number
UFO_MISSION_PATROL 0 0
//frequency and strength of this UFO mission type
UFO_MISSION_TRANSPORT 0 0
UFO_MISSION_INTRUDE 0 0
UFO_MISSION_PLANTING 0 0
UFO_MISSION_BASEATT 0 0
PROBIAS 0.85
//influences the spread of missions around the player's territory. Must be from 0 to 1.
ENEMIES_TRANSGENANTS 0
//strength of enemies, see ListOfEnemy
ENEMIES_BIOMASS 0
ENEMIES_RETICULANS 0
ALIEN_WEAPONS ""
//ignored
ALIEN_ARMOUR ""
//ignored
TECH_LEVEL 1
//technology level for equipment found in bases
PEOPLE_MIN 2
//minimum number of soldiers in player's team
PEOPLE_MAX 4
//maximum number of soldiers in player's team
STRENGTH 2 1
//ignored
AGILITY 2 1
//ignored
DEXTERITY 2 1
//ignored
WILLPOWER 2 1
//ignored
INTELLIGENCE 2 1
//ignored
PERCEPTION 2 1
//ignored
LEVEL 12
//level of the reinforcements
END_OF_PHASE_CONTENT
...
END_OF_LIST_OF_PHASE_CONTENT
There is also a file that defines the conditions for going from one phase to the next, listofphase_progress.txt.
LIST_OF_PHASE_PROGRESS
PHASE_PROGRESS
NAME 1
//phase number
MIN_LENGTH 1
//minimum length of the phase, in days
SUB_PHASE_PROGRESS
//opens definition of the condition of the end of the phases
CONDITION TECH
//can be either TECH or BASE
VALUE UFO_DETECTION
//if CONDITION is TECH, this is an ID of a Technology (see ListOfTech.txt)
END_OF_SUB_PHASE_PROGRESS
SUB_PHASE_PROGRESS
//another condition, or conditions have logical OR between them
CONDITION BASE
VALUE 4
//if CONDITION is BASE, this is number of bases
END_OF_SUB_PHASE_PROGRESS
…
END_OF_PHASE_PROGRESS
…
END_OF_LIST_OF_PHASE_PROGRESS
Prev: Your people | Next: Specification of 3D format | Up: Home |