AI Script Flow Chart |

Does anyone know the associated files required to input a custom unit type into the AI script so it becomes selectable by the AI?
I'm assuming there are several files required to do this, just would like a list of the required ones to look/edit the required variables and constants.
Also looking for the same information to input a new tech area into the AI selectable arena.
Anyone have a flow chart of how the data files are inter-related?

Re: AI Script Flow Chart
One way to get a feel for how the AI script comes together is look at "Main" function in any of the Found in [RaceName]_Main_Script files. It's calls off a series of functions that if you follow through, you'll get a good idea of how it all fits together.
Briefly as it pertains to the stock AI files:
// Base values for this AI
call Set_AI_Script_Values() - Found in [RaceName]_Main_Script; Sets variables to values specific to that race
// Generate lists for AI use.
call AI_Generate_Lists() - Found in Script_AI_Lists - Makes a bunch of lists for the AI's use
// Compute any state changes.
call AI_StateChange() - Found in Script_AI_StateChange - Determines the AI's state (attack, explore, etc)
// Set this races preferences
call AI_Set_Vehicle_Sizes() - Found in Script_AI_GlobalSettings; Makes list of vehicle sizes for use
call Set_Race_Research_Spending() - Found in [RaceName]_Main_Script; Sets race-specific research spending levels
call Set_Race_Research_Areas() - Found in [RaceName]_Main_Script; Sets race-specific tech areas to research (and weapons to use)
call AI_Set_Race_Design_Types() - Found in Script_AI_GlobalSettings; Makes list of design types to design
call Set_Race_Overall_Spending_Percentages() - Found in [RaceName]_Main_Script; sets construction spending levels
call Set_Race_State_Preference_Values() - Found in [RaceName]_Main_Script; sets race-specific for fleet formations etc.
call Set_Race_Political_Settings() - Found in [RaceName]_Main_Script; calls functions to set anger values for events etc.
call Set_Race_Colony_Type_Percentages() - Found in [RaceName]_Main_Script; Sets race colony type percentages
// Execute AI Controls.
call AI_SetColonyTypes() - Found in Script_AI_ColonyTypes; Assigns colony types to colonies without one
call AI_EnemyAnalysis() - Found in Script_AI_EnemyAnalysis; Does nothing in stock
call AI_Restricted_SolarSystems() - Found in Script_AI_Restricted_SolarSystems; Does nothing in stock
call AI_DesignCreation() - Found in Script_AI_DesignCreation; Runs the AI's design creation minister
call AI_Research() - Found in Script_AI_Research; Runs the AI's research minister
call AI_Intelligence() - Found in Script_AI_Intelligence; Runs the AI's intelligence minister
call AI_Construction() - Found in Script_AI_Construction; Runs the AI's construction minister
call AI_Politics() - Found in Script_AI_Politics; Runs the AI's politics minister
call AI_Orders_Planets() - Found in Script_AI_OrderPlanets; Runs the AI's construction minister
call AI_Orders_Ships() - Found in Script_AI_OrderShips; Runs the AI's ship ministers




Re: AI Script Flow Chart
Here's kind of a brief answer:
If you're working from the stock scripts look at Script_AI_GlobalConstants_VehicleSizes. Add two new constants for the unit's name and size.
The function "Set_AI_Vehicle_Sizes" in Script_AI_GlobalSettings is where a list is made of all the vehicles that the AI might use. You'll want to add new entries for you unit.
Next, the function "AI_Set_Race_Design_Types" in the same file makes a list of the design types the AI will attempt to design. You'll want to add a new design type for your unit and then set the size choice to your new unit's size constant.
During design creation, the AI runs through its list of design types and tries to make a design for each. It will look at the vehicle size wanted for that design type from its list and then cross checks its list of vehicle sizes. If a match is found, it looks at the name for that list position and picks that vehicle.
Space Empires Depot | SE:V Balance Mod