AI Params file

### **Contents of AIPARAMS.CSV File**:

&&BUILDSEQUENCE - the equipment classes which will be built by the AI and Ministers, with options for Offense/Mixed/Defense preference

&&UNITWEIGHTING - the weights given to different unit stats when the minister is considering building new units. There is an offensive and defensive preference (mixed will average the two)

&&MISSILEWEIGHTING - same format as &&UNITWEIGHTING

&&AIREQRESPONSE - the classes of units used when responding to different unit requests (such as garrison, attack, air support, etc)

&&AIPARAMS - contains a multiple AI related sets of data

aibuildarray - list of facilities the AI will use when building bases or production

aiforcesize - 5 presets for AI response sizes (default 7/14/21/28/35 units)

aiprireqtype - list of AI request types to be used by the AI ruler at 7 planet request types and 7 space request types. ( 7 slots for planet low priority -> planet high priority, 7 slots for space low priority -> space high priority)

aiunitbuildreserve - 5 threshold values (uses military difficulty as index) that if reserve personnel is less than will trigger autobuild class masking, matches aiunitbuildreservemask[]

aiunitbuildreservemask - 5 class bitmasks (uses military difficulty as index) that if matching aiunitbuildreserve threshold is met, will not autobuild classes that match the bitmask

aiunitbuildmilgoods - 5 threshold values (uses military difficulty as index) that if military goods sustainable days is less than will trigger autobuild class masking, matches aiunitbuildmilgoodsmask []

aiunitbuildmilgoodsmask - 5 class bitmasks (uses military difficulty as index) that if matching aiunitbuildmilgoods threshold is met, will not autobuild classes that match the bitmask

aiunitbuildpetrol - 5 threshold values (uses military difficulty as index) that if petroleum sustainable days is less than will trigger autobuild class masking, matches aiunitbuildpetrolmask []

aiunitbuildpetrolmask - 5 class bitmasks (uses military difficulty as index) that if matching aiunitbuildpetrol threshold is met, will not autobuild classes that match the bitmask

### **How the file gets loaded:**

AIPARAMS.CSV is loaded by the *ALLLOAD.INI* file. This has two different ways of being loaded:

> 1) For scenarios, sandboxes and campaigns that ship with the game, it is specified in the .scenario file.
>
>

> 2) For Modded games, it is loaded based on the file name specified in an "inclfile:" line in the .scenario file. All of our .scenario files do not have this line, and so the default - "ALLLOAD.INI" is used.
>
>

If you replace the ALLLOAD.INI or the AIPARAMS.CSV with a custom version that has values for additional regions, the file will be used for ALL the existing sandbox/scenario/campaign games and save games the player starts. The data in this file is NOT stored in a cache or save game. This means that you need to take extra steps to make sure it is loaded with save games - and if a save game file is emailed to someone else, they will use the default file if they don't have your file on their system.

For Multiplayer Games, this data \*should not\* be sync critical - that means different players can use different AIPARAMS files without causing sync errors. This has not been well tested, and may not in fact be true. In Multiplayer games, each local player uses their own AIPARAM files, and all the AI regions use the file of the host machine.

### **How to specify a different file in your sandbox/scenario:**

You will need to provide your own custom file to replace ALLLOAD.INI. I suggest you don't overwrite the existing one, unless your intention is to change all the existing sandboxes/scenarios/campaigns that ship with the game. Otherwise, to use a different file, simply add the following to the bottom of your .scenario file for your custom game:

inclfile: "MYFILE"

By default, this file will be loaded from the \INI directory. There is a limit of 18 characters to this file name, so it is not feasible to add a directory override to the file name. This file is a list of non-cached data files, one of which is "AIPARAMS.CSV". If you create a custom MYFILE.INI, make sure you still load all the other elements that are in the default file !

In this file you can specify a full path for your stuff, so you can do something like:

#include "MYAIPARAMS.CSV", "SCENARIO\\CUSTOM\\MYMOD\\"

### **How to specify AIPARAMS for different regions**

First of all, every game MUST have those sections for default regions - which means the region number is 0 or blank. Any region without its own custom section will use the default section.

To add new custom sections per region, just do it the same way as the default sections but add the region number at the end of the && line, for example:

&&AIREQRESPONSE 1188

That specifies region 1188, SR1936 Germany

Again this data is not stored in a cache or save game, and so these sections cannot be included in the Region Data (CVP) file, they must be added to the existing AIPARAMS or added to the ALLLOAD or 'inclfile'.

The AI Parameters File (AIParams.csv) is stored in the \INI\ directory and contains the following sections:

##### &&BUILDSEQUENCE

This determines the AI's sequence of building different classes of units when Ministers or AI Rulers use 'Autobuild' at military bases. Each cell refers to the Unit Class to be built, with the following values added to the class number to specify additional features:

* + 2048 : GR/SRNG: Carrier Capacity Preference
* + 1024 : For GR Space Units: Dropship Preference
* + 512 : For GR Space Units: Colonization Preference
* + 256 : For GR Space Units: Survey Preference
* + 128 : 'mobile preference' (avoid walking or towed units) For GR Space Units: 'ftl preference'
* + 64 : 'missile preference' (prefer units with missile capacity)
* + 32 : 'engineer preference' (prefer units with engineering capabilities) For GR Space Units: Space Engineer Preference

There are three lines each for Land, Air, and Naval, with the first line of each group being Defense priority, the middle being mixed, and the last being Offense priority. This priority is set by the human player or the AI ruler.

##### &&BUILDSEQUENCE2

This is the new BuildSequence system for *Galactic Ruler* and *SRNG.*

* BuildSequence2 still contains Four Sections by btype:
	+ land/air/naval/space
* And Three Lines for Each:
	+ (Defense / Mixed / Offense priorities)

32 Columns - one column for each UNIT CLASS

In each unit class column - a FLOAT value indicating %age of builds that should be in that class.  All the percentages should add up to 1.0 for this to work.

##### &&BUILDSEQUENCE3

This is the new BuildSequence modifier system for *Galactic Ruler* and *SRNG.*

BuildSequence3 contains a line FOR EACH CLASS

And Three Lines for Each:

* (Defense / Mixed / Offense priorities)

32 Columns - one column for each SPECIALTY FLAG

In each specialty column, a %age indicating how often that specialty should be requested.

* For example, Engineer at 0.5 indicates 50% of the units in that class should get the engineer preference requested.

Current preference flags - these would be each a column in the specialty section *(+number indicates bitflag value in old system)*

1. + 32 : 'engineer preference' (prefer units with engineering capabilities) For GR Space Units: Space Engineer Preference
2. + 64 : 'missile preference' (prefer units with missile capacity)
3. + 128 : 'mobile preference' (avoid walking or towed units) For GR Space Units: 'ftl preference'
4. + 256 : For GR Space Units: Survey Preference
5. + 512 : For GR Space Units: Colonization Preference
6. + 1024 : For GR Space Units: Dropship Preference
7. + 2048 : GR/SRNG: Carrier Capacity Preference

##### &&UNITWEIGHTING

For each Unit Class this provides the weighting of different specs to determine what unit should be built from the available designs.

There are 52 entries in this category, 2 for each unit class. It is in the format of Defensive then Offensive.

Entry Type Order Example
 Infantry
 Recon
 Recon

This continues for every unit class available.

##### &&MISSILEWEIGHTING

As above except for this is for the production of missiles; the lines refer to the types of missile targets being prioritized.

##### &&AIREQRESPONSE

This section specifies the units to be used by the AI or Minister to respond to situations and hotspots on the map. The lines, in order, represent the type of AI military request. The first ten of these are also an exact match to the Hotspot-Request types that the human player can issue; the last six are used by the AI only.

* 0 AIREQGARRISON Request to Garrison a hex for defense
* 1 AIREQDEFENSE Request defensive-oriented units for area
* 2 AIREQASSISTANCE Request 'assistance', for instance if a battle is going badly
* 3 AIREQSUPPLIES Request resupply
* 4 AIREQAIRSUPPORT Request air support for ground units
* 5 AIREQLANDTRANSPORT Request transport units to be dispatched
* 6 AIREQSEASUPPLY Request Sea resupply
* 7 AIREQSEAATTACK Request Naval attack units
* 8 AIREQATTACK Request (on land) attack units
* 9 AIREQBATTLESUPPORT Request support for a land battle (not used by AI at present)

AI (both minister and AI-player) use only:

* 10 AIREQCITYRESCUE Requested by Cities taken over if loyalty is to us
* 11 AIREQAIRINTERCEPT Request intercept of airspace violation
* 12 AIREQCITYLOST City was lost, request attempt to retake it
* 13 AIREQBASELOST Base was lost
* 14 AIREQINDUSTRYLOST Industrial complex was lost
* 15 AIREQLANDLOST Land in general was lost

*For Galactic Ruler, the following additional AI Request Types are implement for SPACE Levels (System / Galaxy)*

* 16 AIREQSGARRISON Request to Garrison a hex for defense
* 17 AIREQSDEFENSE Request defensive-oriented units for area
* 18 AIREQSASSISTANCE Request 'assistance', for instance if a battle is going badly
* 19 AIREQSSUPPLIES Request resupply
* 20 AIREQSSUPPORT Request support (tbd)
* 21 AIREQSTRANSPORT Request transport units to be dispatched
* 22 AIREQSSURVEY Request Survey of Planet/location
* 23 AIREQSCOLONIZE Request Colonization units
* 24 AIREQSATTACK Request attack units
* 25 AIREQSBATTLESUPPORT Request support for a battle (not used by AI at present)

AI (both minister and AI-player) use only:

* 26 AIREQSPLANETRESCUE Requested by Planets taken over if loyalty is to us
* 27 AIREQSINTERCEPT Request intercept of owned space violation
* 28 AIREQSPLANETLOST Planet was lost, request attempt to retake it
* 29 AIREQSBASELOST Base was lost
* 30 AIREQSRESVD30
* 31 AIREQSSPACELOST Space ownership in general was lost

For each of the scenarios, eight sets of three columns give details on the types of units that should respond to the request.
* Ground units: 1 means 'mobile units only', meaning no walking infantry or towed artillery; 0 (or 'N') mean any units.
* Air units: 1 means mission-type (fixed wing) units only, 0 (or N) mean any types including helicopters.
* Space units: not defined.
* For ground/air/space units, adding 2 to the value means 'don't check attack strength', since ordinarily the AI will look for stronger units as its first choice of responders. Since attack strength is not a requirement for resupply units, for instance, those types have the 2 added to this column.

Each request has an importance attached to it by the AI (or the human in case of hotspots), which determines how many units will respond to a request; units are requested in column order, after all 8 columns are done it loops back to column 1.

Note: the contents of the AIParams file were edited and updated as part of recent updates, so when modding it make sure you start from the latest version.

##### &&AIPARAMS

aibuildarray - This is a list of facility/upgrade ID numbers that the AI will use when building facilities.

36 entries:

ore collector/energy collector/defense platform/orbital storage, resv/resv/resv/resv, land/air/sea/mis production, 12x Terrain Prod, 12x Synth Prod

aiforcesize - This is a list of force size for responses to use

5 entries:

very small, small, medium, large, very large

aiprireqtype - This is a list of requests to use for each priority level

14 entries :

Planet Extremely Low Priority / Planet Very Low Priority / Planet Low Priority / Planet Medium Priority / Planet High Priority / Planet Very High Priority / Planet Extremely High Priority

Space Extremely Low Priority / Space Very Low Priority / Space Low Priority / Space Medium Priority / Space High Priority / Space Very High Priority / Space Extremely High Priority

aicolonydefaults - This is a list of bitmask values for the default cabinet minister priorities when establishing a new colony or changing colony focus in the manage region popup

24 entries:

6 Cabinet Ministers x 4 Named Focuses

autobuildbypopmin - Used in the calculation of when to stop autobuilding new military units

5 entries:

Indexed by military difficulty

autobuildbypopmax - Used in the calculation of when to stop autobuilding new military units

5 entries:

Indexed by military difficulty