Order of AI processing

Post Reply
woolymuffler
Posts: 25
Joined: Tue Dec 26, 2017 4:48 pm

Order of AI processing

Post by woolymuffler »

What order does the AI process AI and Events scripts? I'm guessing AI first and then Events. Within each category, is there a set order (diplomacy first, then research, then units etc.)?

And are all scripts processed before the AI gets to movement/replacement/combat phases? It seems like some scripts fire after they have ended their turn (before it calculates supply leading into my turn).

The reason I ask all this is I'm trying to reorder and tweak events in my personal mod of Call to Arms to reduce AI"cheating" a bit. Specifically the bit where the AI gets hundreds of MPPs worth of free research and diplomacy on Turn 1 (when they have no money (Central Powers) or virtually no money (Allies).

But I want to do this without completely breaking the AI of course, so my thought is to push the dates on these early research and diplomacy events to Turn 2 or later and space them out over multiple turns so the AI has at least some of the money for them (and I don't completely break their ability to fund replacements and purchases on those turns).

My hope is this won't delay the AI research too badly as I've changed to 3 day alternating turns (with start date of Aug 14th when first large scale battle of the war began (Battle of Lorraine)) meaning there are far more 1914 turns to spread the events out over.
User avatar
Hubert Cater
Posts: 6101
Joined: Mon Jul 22, 2013 11:42 am
Contact:

Re: Order of AI processing

Post by Hubert Cater »

That is a bit of a complex answer, but I'll do my best to paint a picture.

Events - POPUPS, DECISION, can be flagged to fire at the beginning of a turn, all others will fire at the end of a turn. However, if there is a beginning of a turn DECISION it may have any number of other event types associated with it, and then those will fire (if applicable) right after a DECISION event yes or no has been decided, so in this case they may also fire at the beginning of the turn.

AI - GUARD, OFFENSIVE, TRANSPORT, AMPHIBIOUS etc scripts are run throughout the AI turn, e.g. at the beginning and then double checked throughout the turn during different internal phases to see if new opportunities have opened up if conditions have changed during the turn.

AI - PURCHASE, RESEARCH and DIPLOMACY are essentially run at the end of the turn (in that order) followed by a final round of attempting to upgrade units if sufficient funds exist to do so.
woolymuffler
Posts: 25
Joined: Tue Dec 26, 2017 4:48 pm

Re: Order of AI processing

Post by woolymuffler »

Once again, great information.

It sounds like my idea of trying to make the AI pay for its purchases may not work though if purchases/research/diplomacy are at the end of the turn, as I assume it will have spent most of its money on reinforcements and operating by that point.

Although I suppose this is more of a 1914 issue as the number of MPPs grows over the course of the game.
Post Reply

Return to “MODS and Scenarios”