AI Processes (research.txt & purchase.txt)
Posted: Thu Oct 08, 2026 4:48 pm
I am curious as to how the AI actually processes each of these AI scripts.
Does the AI:
- sequentially go down the list, giving preference to earlier listed techs and unit types,
- or does it randomly roll somehow (like, 'oh carrier is first roll - miss; fighter is chosen as second roll')
Then there is how it addresses it over a number of turns-
I am really wondering if it will keep pumping out, say, infantry each turn until infantry has reached the build limit and then go down the line to armor, air, and naval units?
A few examples of how I imagine it might work (using TRP types here, but it doesn't matter):
Ex. A:
; HQ
#UNIT_ID_0= 10 [1]
; Garrison
#UNIT_ID_1= 10 [1]
; Pillbox
#UNIT_ID_2= 50 [1]
In this example, I would imagine it rolls for HQ, and let's say it hits 13; then skip to Garrison, roll for Garrison. Miss, so skip, then roll for Pillbox - hit, thus queue.
If, however:
Ex. B:
; HQ
#UNIT_ID_0= 0 [1]
; Garrison
#UNIT_ID_1= 100 [2]
; Pillbox
#UNIT_ID_2= 50 [1]
Since Garrison = 100%, would it keep pumping out Garrison until build limit, forgetting the rest of the list?
All of this would, in essence, also apply to the way stuff works with researches, I guess.
And a general question - can multiple different unit types and/or research titles be chosen in one turn?
That's a lot, but it would also give a lot of clarity. Thanks for you attention to this subforum!
Does the AI:
- sequentially go down the list, giving preference to earlier listed techs and unit types,
- or does it randomly roll somehow (like, 'oh carrier is first roll - miss; fighter is chosen as second roll')
Then there is how it addresses it over a number of turns-
I am really wondering if it will keep pumping out, say, infantry each turn until infantry has reached the build limit and then go down the line to armor, air, and naval units?
A few examples of how I imagine it might work (using TRP types here, but it doesn't matter):
Ex. A:
; HQ
#UNIT_ID_0= 10 [1]
; Garrison
#UNIT_ID_1= 10 [1]
; Pillbox
#UNIT_ID_2= 50 [1]
In this example, I would imagine it rolls for HQ, and let's say it hits 13; then skip to Garrison, roll for Garrison. Miss, so skip, then roll for Pillbox - hit, thus queue.
If, however:
Ex. B:
; HQ
#UNIT_ID_0= 0 [1]
; Garrison
#UNIT_ID_1= 100 [2]
; Pillbox
#UNIT_ID_2= 50 [1]
Since Garrison = 100%, would it keep pumping out Garrison until build limit, forgetting the rest of the list?
All of this would, in essence, also apply to the way stuff works with researches, I guess.
And a general question - can multiple different unit types and/or research titles be chosen in one turn?
That's a lot, but it would also give a lot of clarity. Thanks for you attention to this subforum!