LoneGazebo / Community-Patch-DLL

Community Patch for Civilization V - Brave New World
Other
285 stars 157 forks source link

AI neither uses nor evacuates Atomic Bombs #8950

Open saamohod opened 2 years ago

saamohod commented 2 years ago

1. Mod version, and DirectX version if reporting a graphical issue (X.Y.Z, e.g. 2.3.1, DX 10 & 11): 2.3.1

2. Mod list (if using Vox Populi only, leave blank): Really Advanced Setup

3. Error description:

Washington_0416 AD-1996.zip

AI fails to evacuate his atomic bombs stationed in a besieged city that is about to fall, nor does it try to shoot them at the enemy forces (me) despite those units presenting a perfect nuke target.

I also noticed the same behavior with regards to AI's bombers, i.e. they don't get evacuated and eventually get destroyed after the city capture.

ilteroi commented 2 years ago

AI players only target cities with nukes; also there is a random component to launching a nuclear attack.

the failure to evacuate is weird; should not happen if CvCity::IsInDangerOfFalling() is true but that check is not very accurate. i added some extra margin ... let's keep an eye on it

saamohod commented 2 years ago

AI players only target cities with nukes

Would it be possible to make AI target amassed enemy forces outside the cities? An invasion army in the ocean for example?

ilteroi commented 2 years ago

yes

saamohod commented 2 years ago

Nice, I'd love to see that happen. Current AI nuclear play is simply lacking. Out of several nukes produced by AI's in my current game, only one was ever used because the conditions for their use are too restrictive.

ilteroi commented 2 years ago

the code is in CvAIOperationNukeAttack::FindBestTarget(CvPlot** ppMuster) if anyone wants go ahead with this

there is also CvPlot::GetLocalUnitPower(...) which makes it easy to find clusters of enemy units.

a good exercise for new modders!