Quote:
Imperator Fyron said:
Any chance of sharing some of your AI wisdom on the Wiki, Kwok? 
|
I'd like to do something like that eventually, but it's always a time issue. The latest beta patches alone take considerable time to reconcile with the Balance Mod AI. Too bad I need to waste so much time sleeping!
But here are a few beginner tips:
All the AI source scripts are found in the Utilities\ScriptParser\SE5EmpireScripts folder. The Script Parser itself is not a great editing tool, so use Notepad etc., but you'll need the Script Parser to compile AI files. Each empire has a Setup and Main script, which are the only files you every actually compile. The AI_Script_[xxxxxx] files contain functions that are included in the Setup/Main scripts.
The [Empire]_Setup_Script file is used only on player generation and chooses the racial traits as well as starting research. I suppose the most important note is that it uses the Script_AI_GlobalResearch file to pick starting techs, and not Script_AI_Research - which is used by the AI for choosing techs to research in-game.
The [Empire]_Main_Script is run for each AI every turn. It incorporates the functions of all the Script_AI_[xxxxxx] files, as well as sets most variables and tech choices for that Empire.
A brief synopsis of each file:
Script_AI_GlobalConstants sets various constants used in the other AI files.
Script_AI_GlobalVariables sets all sorts of variables (some of which are overwritten by an Empire's main scripts) used by functions in other files.
Script_AI_GlobalSettings sets all sorts of variables used by the other AI functions. This includes settings for vehicle design creation (such as number of engines or crew), extra components to add to designs, setting demand for vehicles to construct, and a bunch of politics settings which are used in calculations for diplomacy.
Script_AI_ColonyType contains the functions that determine the Colony Type the AI assigns to a new colony.
Script_AI_Construction contains the functions that add ships/units/facilities to the building queues.
Script_AI_DesignCreation contains the design algorithm for the AI. This is perhaps the most complex file to understand at first. A lot of settings from the GlobalSettings file are used here.
Script_AI_Intelligence contains the functions that choose what intel projects to run etc.
Script_AI_Lists contains a series of functions that compile lists for lots of different things like attack/defend locations, colonizable planets, resupply locations, etc. This list variables are used in many of the scripts, particularly in Script_AI_Orders_Ships.
Script_AI_Orders_Planets contains a few functions to give planets orders like launch mines.
Script_AI_Orders_Ships has all the functions that assign orders to ships. It often uses list variables set in Script_AI_Lists in its functions.
Script_AI_Politics contains all the functions that handle sending messages and diplomacy. Many of the functions refer to values that are set in Script_AI_GlobalSettings, such as the maximum anger level for a given treaty stipulation.
Script_AI_Research contains the functions used to pick research items for the AI during the game. It's just a list of tech areas to add to the research queue and set tech area requirements.
Script_AI_GlobalReseach is more or less the same as Script_AI_Research, but is only used by the Empire's setup script.
Script_AI_Restricted_SolarSystems doesn't do anything at this time.
Script_AI_StateChange has functions that determines the AI's state. It also has functions to determine whether to attack or not.