List of AI Script Files (AKA, Road Map to Madness)...
For my first blog entry, I thought I would post a list of the stock AI script files, and what they do. To help new scripters find their way around the files.
If you see a word enclosed by %'s then this is a wild card. For instance, %mod_name% means whatever name you give your mod. So, that would be "BadassMod", not "%mod_name%".
This blog entry will not be going over the details of each file. Each file is generally complex enough to warrant its own blog entry (some of them might warrant several).
Well, enough of that Emo crap, on with the list!
SE5EmpireScripts -- Contains files used to compile the AI. Files compiled from this directory go in each empire's directory under Gametypes\%mod_name%\Empires\%race_name%
SE5MainScripts -- Contains files used to compile event actions which occur at the end of a round. Currently holds Intel events, and everything BUT Intel events. Files compiled from this directory go in Gametypes\%mod_name%\Data
Every race has one set of the following two files. When you compile, you compile these two, and they reference all the others.
%race_name%_Main_Script.txt -- This file is processed every round on the AI's turn. References many other files, and performs some processing on its own. Contains much information as to how the AI does things, like what percentage of a ship is weapons, and how many of each type of colony to build.
%race_name%_Setup_Script.txt -- This file is processed ONCE, at the creation of the game. References many other files, and performs some processing on its own. Variables used in or by this file or files included by this file are not persistent for use by anything else, but it can be used to set external values in the game database (like what Racial Abilities a race has), which ARE persistent after they are set.
All of the files with the words "GlobalConstants" in their title are used to set constants which are called up by other script files, but which can be used outside of individual functions, and are persistent across whatever files call them (so they are Global...clever, no?). Constants have a fixed value, and should not be changed like a variable. No processing is performed in these files, think of them as ingredients that other files use to do things. There is no strict rule regarding this, but it is best to stick to the established design ethic, as it will help keep you from getting lost.
Script_AI_GlobalConstants.txt -- Defines general constants. The data in this file is largely present in other GlobalConstants files, so this file is rarely used, if ever.
Script_AI_GlobalConstants_Components.txt -- Defines constants for use with components.
Script_AI_GlobalConstants_DesignTypes.txt -- Defines constants for use with ship and unit design types. (Attack Ship, Troop Transport, etc.)
Script_AI_GlobalConstants_General.txt -- Defines constants for general use, such as colony types.
Script_AI_GlobalConstants_Politics.txt -- Defines constants for use in politics.
Script_AI_GlobalConstants_RacialTraits.txt -- Defines constants used to call up racial traits.
Script_AI_GlobalConstants_Tech.txt -- Defines constants used to reference technologies.
Script_AI_GlobalConstants_VehicleSizes.txt -- Defines constants used to reference ship and unit sizes and types. (Frigates, Destroyers, etc.)
The rest of these files do the grunt work for the AI. This is where things get down and dirty.
Script_AI_ColonyType.txt -- Controls how the AI assigns a type to a colony. (Mining Colony, Farming Colony, etc.)
Script_AI_Construction.txt -- Handles the construction of all things by the AI.
Script_AI_DesignCreation.txt -- All ships, stations, and units are designed through this file.
Script_AI_EnemyAnalysis.txt -- Analyzes enemy empires. Currently is empty and unused.
Script_AI_GlobalResearch.txt -- Is used by %race_name%_Setup_Script.txt to set up initial research for the AI, before game start.
Script_AI_GlobalSettings.txt -- Controls many very important settings for the AI, including, but not limited to: Vital ship stats (how much life support is required, etc), how many of each vehicle (bases, ships, AND units) the AI wants, and the disposition value of each action and treaty taken by the player and the AI.
Script_AI_GlobalVariables.txt -- Defines variables which can be called on and set by any other file. The values in these variables is persistent between files and functions, hence the Global title.
Script_AI_Intelligence.txt -- Controls how the AI spends its Intel points, and on whom it spends them.
Script_AI_Lists.txt -- Generates lists for other files, such as the objects a race can see, its colony list, the list of visible enemy units for a race, etc.
Script_AI_Orders_Planets.txt -- Controls what orders are given to planets and objects in a planet's cargo bay.
Script_AI_Orders_Ships.txt -- Controls what orders are given to ships and objects in a ship's cargo bay.
Script_AI_Politics.txt -- Manages the disposion of each AI towards each other and the player. Also deals with Alliances. This file is grown enormously in complexity in the last few patches.
Script_AI_Research.txt -- Controls how the AI researches things during the game turn, NOT during setup before a game.
Script_AI_Restricted_SolarSystems.txt -- Defines and manages Solar Systems with the Restricted flag. Currently empty and unused.
Script_AI_StateChange.txt -- Changes the state of the AI between Explore and Expand, Infrastructure, Attach, Defend, and Not Connected. State is used by other files to help control AI action.
There are Constants files here, as well. These are not shared between each file, though they could be.
Script_Main_ExternalEvents_Const.txt -- Defines constants for use by Script_Main_ExternalEvents.txt.
Script_Main_Intelligence_Const.txt -- Defines constants for use by Script_Main_Intelligence.txt.
These next two files are the ones you compile. They reference the constants files above here.
Script_Main_ExternalEvents_Const.txt -- Controls all random events in the game universe. Is processed at the end of the game turn, after all players have had their turns.
Script_Main_Intelligence_Const.txt -- Generates events based on Intel (like espionage and sabotage). Script_AI_Intelligence.txt controls how the AI spends its Intel points, this file generates results based on how the AI spent those points. I think this is processed at the end of each players' turn, but I could be wrong.