Balance Mod AI script deciphering questions |

Kwok, I'm doing my best to understand AI development so I can help make AI for BM.
I was curious about this line in AI Global Settings:
The function is function Set_Race_Design_Types
and the line is under the attack ships wanted area:
set num_wanted := Sys_Trunc(lng_Num_Attack_Ships * num_colony_spaces / 500)
How does this calculate the number of attack ships wanted? I see its based on number of facilities, but I am not sure how it computes. Can you give me an example? I guess I am not sure what the value of lng_Num_Attack_Ships is unless its the number of existing attack ships, which doesn't seem to make sense. Maybe my math is wrong, but it appears the result I return by hand is an ever-increasing number. Can you give me two examples of how this formula for wanted attack ships work? Thanks!
inigma

Re: Balance Mod AI script deciphering questions
Correct. Most design types have their base demand values calculated this way. The demand values are then typically modified by the state the AI is in.

Re: Balance Mod AI script deciphering questions
I didn't create any routine for the AI to mothball. I'm not even sure if the supporting function to call the mothball order would work anyway. It doesn't appear to work for calling the cloak/de-cloak order.
Re: Balance Mod AI script deciphering questions
In my mod, the AI goes for breathable planets first (exept when its resource income is running low, then it switches gears). This is actually one of the easier things to mod.
Open up Script_AI_Lists.txt.
Go to the AI_Generate_Lists function.
Go down to where it says:
call Sys_Prepare_For_Planet_Sort() call Sys_Add_Planet_Sort_Column(SORT_PLANET_BY_ENEMIES_PRESENT_IN_SYSTEM, TRUE) call Sys_Add_Planet_Sort_Column(SORT_PLANET_BY_SYSTEM_DISTANCE_TO_HOME_SYSTEM, TRUE) call Sys_Add_Planet_Sort_Column(SORT_PLANET_BY_HAS_GRANTED_TECH, FALSE) call Sys_Add_Planet_Sort_Column(SORT_PLANET_BY_BREATHABLE, FALSE) call Sys_Add_Planet_Sort_Column(SORT_PLANET_BY_PLANET_SIZE, FALSE) call Sys_Add_Planet_Sort_Column(SORT_PLANET_BY_TOTAL_PLANET_VALUE, FALSE) call Sys_Execute_Planet_Sort(sys_long_Player_ID, lst_AI_Colonizable_Planets)
Change this to:
call Sys_Prepare_For_Planet_Sort() call Sys_Add_Planet_Sort_Column(SORT_PLANET_BY_ENEMIES_PRESENT_IN_SYSTEM, TRUE) call Sys_Add_Planet_Sort_Column(SORT_PLANET_BY_HAS_GRANTED_TECH, FALSE) call Sys_Add_Planet_Sort_Column(SORT_PLANET_BY_BREATHABLE, FALSE) call Sys_Add_Planet_Sort_Column(SORT_PLANET_BY_PLANET_SIZE, FALSE) call Sys_Add_Planet_Sort_Column(SORT_PLANET_BY_TOTAL_PLANET_VALUE, FALSE) call Sys_Add_Planet_Sort_Column(SORT_PLANET_BY_SYSTEM_DISTANCE_TO_HOME_SYSTEM, TRUE) call Sys_Execute_Planet_Sort(sys_long_Player_ID, lst_AI_Colonizable_Planets)
That will move planet distance to lower in the priority list than the presence of special tech, whether it is breathable, its size, and its value.
"Only by being constantly at war with evil in all things, including yourself, can you truely know peace."
Download my mod here: GidMod

Re: Balance Mod AI script deciphering questions
There is no function to set a queue to emergency build via the scripts.
Re: Balance Mod AI script deciphering questions
So inigma the script that you have as of dec 3. Is that available for download?
would love to have an AI that might try brute force attacks and having to be pure defensive minded against it.




Re: Balance Mod AI script deciphering questions
I'm not familiar with the exact internal structure of the Balance Mod (I avoid looking at other people's work, so I don't end up unconciously copying them). However, if I were to wager a guess...
lng_Num_Attack_Ships looks like a Global Variable. I would look and see if it is defined in Script_Ai_Global_Variables.txt, and/or in the races' _Main.txt file.
"Only by being constantly at war with evil in all things, including yourself, can you truely know peace."
Download my mod here: GidMod