AI Processes (research.txt & purchase.txt)

Strategic Command WWII World at War Tech Support
Post Reply
SittingDuck
Posts: 1211
Joined: Sat Aug 31, 2002 9:08 pm

AI Processes (research.txt & purchase.txt)

Post by SittingDuck »

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!
User avatar
Hubert Cater
Posts: 6124
Joined: Mon Jul 22, 2013 11:42 am
Contact:

Re: AI Processes (research.txt & purchase.txt)

Post by Hubert Cater »

Hi,

Unit purchases are considered in a randomized order whereby the engine shuffles the unit types, then checks each type against its specified percentage.

Being listed first in the PURCHASE script does not give that unit type priority, e.g. a successful purchase also does not stop the engine from considering the other types.

Research however is considered in research-ID order, and I've considered having this random as well, but I'd be hesitant to experiment with this now only because the categories themselves lean towards a priority order so to speak, so it feels in our games at least like it works out more or less optimally over the course of the game.

Hope this helps,
Hubert
SittingDuck
Posts: 1211
Joined: Sat Aug 31, 2002 9:08 pm

Re: AI Processes (research.txt & purchase.txt)

Post by SittingDuck »

That does help, Hubert - thanks. I would not have guessed they worked differently, but very good to know.
Post Reply

Return to “Tech Support”