Skip to main content

Module cai

Module cai 

Source
Expand description

Writer of the campaign AI’s state (CAI_INTERFACE).

Every AI object (a mirror of a world object, a map region, an analyser…) has a component with an id from a single counter, in the order the game creates them, and AI records refer to each other by those ids. The writer first plans every id (plan::CaiPlan), then writes each list with its references.

Modules§

factions
Writer of the AI’s factions (CAI_WORLD_FACTIONS), technology trees (CAI_WORLD_TECHNOLOGY_TREES) and technologies (CAI_WORLD_TECHNOLOGIES).
interface
Writer of the AI state (CAI_INTERFACE): the world mirror, the central pool of analysers, the faction managers and their AI levels, the director’s pool, the high-level pathfinder and the influence maps. Also writes the campaign director (CAMPAIGN_DIRECTOR), which refers to the director’s pool.
lists
Writer of the AI’s smaller world lists: trade route segments, international trade routes, region boundaries, provinces and the factions’ parts of them, the factions’ views of the seas, governorships and government posts.
managers
Writer of the AI faction managers (CAI_INTERFACE_MANAGERS).
map
What the campaign AI reads from the map files: the regions of map_data.esf (land regions, then seas), their areas and connections, and the high-level pathfinder nodes of hlp_data.esf.
mobiles
Writer of the AI’s characters (CAI_WORLD_CHARACTERS), mobiles (CAI_WORLD_RESOURCE_MOBILES: forces, and agents moving on their own) and units (CAI_WORLD_UNITS).
pathfinder
The AI’s high-level pathfinder graph (CAI_HIGH_LEVEL_PATHFINDER, from the map’s hlp_data.esf), and the distances between regions the AI derives from it.
plan
Component ids of every AI object, in the order the game creates them.
regions
Writer of the AI’s theatre (CAI_WORLD_THEATRES), regions (CAI_WORLD_REGIONS) and their HLCIs (CAI_WORLD_REGION_HLCIS): one region per map region (land, then seas), each split into HLCIs, the connected groups of its areas.
settlements
Writer of the AI’s settlements (CAI_WORLD_SETTLEMENTS) and building slots (CAI_WORLD_BUILDING_SLOTS: the settlements’ slots, then the horde armies’ slots).
stances
Wars and stance re-evaluation marks the AI starts with.
technologies
The technologies of each faction’s tree, in the order the game builds it.
world
Writer of the AI’s mirror of the world (CAI_WORLD), from what the AI writer works out of a campaign.
world_view
What the campaign AI mirrors of a written WORLD record: its factions, characters, forces, regions, provinces and seas, with their runtime ids, read through the record layouts.

Constants§

CAI_PATH
Path of the AI state.
CAI_WORLD_PATH
Path of the AI’s mirror of the world.