Page 1 of 1

AI capabilities

Posted: Wed Aug 24, 2022 7:55 pm
by woolymuffler
I'm still trying to get a handle on the scripting; from the manual on AI scripting:

12.2.10. Diplomacy
This event handles AI diplomacy allocation on a turn-by-turn basis.
12.2.11. Research
This event handles AI research allocation on a turn-by-turn basis.

Does this mean that the AI does not do research or diplomacy without scripted events? I'm hoping this falls more under pushing the AI in certain directions and assistance for the AI rather than it not being able to do unscripted research and diplomacy.

Re: AI capabilities

Posted: Thu Aug 25, 2022 8:40 am
by BillRunacre
Without these scripts it won't undertake any diplomacy or research.

The reason being that the game's editor is so versatile that it's much better for it to be guided by scripts than for it to have an inbuilt logic in these areas, because that inbuilt logic could make sense for (say) our official campaigns but might not for some mods.

Re: AI capabilities

Posted: Thu Aug 25, 2022 11:20 am
by woolymuffler
Ah, extremely good information to know. Are there any other categories (like new unit purchases for instance) where the AI will only do scripted actions?

Re: AI capabilities

Posted: Thu Aug 25, 2022 1:00 pm
by woolymuffler
And following on from this, are research and diplomacy events discarded permanently (if the AI lacks the funds and SKIP_FUNDS_CHECK isn't active) or will it try again on later turns until it has the funds (assuming all trigger conditions are still met)?

Re: AI capabilities

Posted: Fri Aug 26, 2022 12:21 pm
by Hubert Cater
woolymuffler wrote: Thu Aug 25, 2022 11:20 am Ah, extremely good information to know. Are there any other categories (like new unit purchases for instance) where the AI will only do scripted actions?
The only things the AI will do on its own is OFFENSIVE and DEFENSIVE planning, but even these are on a tactical level based on map weighting, e.g. if the defender area is weak the AI will go on the offensive there, if the current AI area is weak, it will automatically go on the defensive on its own. In fact DEFENSIVE planning is always automatic, while OFFENSIVE planning can be overwritten with scripts as needed.

Everything else needs to be scripted for the reasons Bill described above, and these include all the AI script types, e.g. PURCHASES, RESEARCH, DIPLOMACY, TRANSPORT, AMPHIBIOUS, FLEET, GUARD planning and so on.

Re: AI capabilities

Posted: Fri Aug 26, 2022 12:22 pm
by Hubert Cater
woolymuffler wrote: Thu Aug 25, 2022 1:00 pm And following on from this, are research and diplomacy events discarded permanently (if the AI lacks the funds and SKIP_FUNDS_CHECK isn't active) or will it try again on later turns until it has the funds (assuming all trigger conditions are still met)?
Depends on the #TYPE= setting, e.g. 2 will keep on repeating, 1 will keep trying until it is successful and then it will be removed, 0 is a one time try and then removed.

Re: AI capabilities

Posted: Fri Aug 26, 2022 12:32 pm
by woolymuffler
Thanks! This is fantastic information.

Re: AI capabilities

Posted: Fri Aug 26, 2022 8:42 pm
by woolymuffler
Does the AI sack/replace generals without scripting?

I assume it is able to handle replacement of destroyed units without scripting as I don't see how that could be scripted (you don't know for sure which units will be destroyed).

Re: AI capabilities

Posted: Tue Aug 30, 2022 5:17 pm
by Hubert Cater
Right now the AI does not sack/replace generals and there are no scripts for it either.

Re: AI capabilities

Posted: Tue Aug 30, 2022 5:20 pm
by Hubert Cater
It does indeed handle the rebuild of destroyed units on its own, looking to purchase those before any other units as they are available at a discount and the AI tries to take advantage of that as well.