Page 1 of 2

AI vs Capturable and Bombarder flag

Posted: Tue Jul 03, 2018 12:10 pm
by Wahazar
I noticed, that AI have no clue, how to maintain units with "Capturable" flag. I had this flag enabled for catapults, cannons etc, AI spammed my cities with dozens of catapults, without assistance - I captured them all and realised, that they behave like Trojan Horses (lot of maintenance costs, town started to revolting), fortunately there is disband option.
Is it possible to fix AI, which should accompany capturable units?

Similar issue with "Bombarder" flag (I set it also for catapults/artillery), AI pushes only artilery, which is still bombarding, but no other units, which would to conquer city.

Re: AI vs Capturable and Bombarder flag

Posted: Tue Jul 03, 2018 8:19 pm
by JTN
I confirm that the AI code shows no sign of understanding the Capturer, Capturable, or Bombarder flags -- it doesn't look for them at all. So yes, it's going to be stupid with them.

The AI does have a bodyguard system (aiguard.c), so it might be relatively simple to teach the AI that Capturable units (a) probably need one (b) probably don't make good guards. I guess there may need to be some calls to aiguard_request_guard() added to military tasks, and or places like dai_gothere_bodyguard() need to be modified to account for the danger of capture. I'm not very familiar with the AI though (this is the first time I've looked at this code).

Re: AI vs Capturable and Bombarder flag

Posted: Fri Aug 24, 2018 10:23 am
by Wahazar
Once more issue with Bombarder flag.
Unit with such flag, if has also and attack_non_native flag,doesn't bombard units attacked on non-native tile (for bombarder) - instead this, classic duel occurs.
Not sure, if it is bug or intended feature?

Re: AI vs Capturable and Bombarder flag

Posted: Mon Aug 27, 2018 2:14 pm
by nef
JTN wrote:I confirm that the AI code shows no sign of understanding the Capturer, Capturable, or Bombarder flags -- it doesn't look for them at all. So yes, it's going to be stupid with them.
These flags worked well enough in fc2.4 but only for me - the AI obviously didn't get any memo. With civ2civ3 (fc2.5) now using them one would hope that somebody could tell the AI someday soon.
Wahazar wrote:Once more issue with Bombarder flag.
Unit with such flag, if has also and attack_non_native flag,doesn't bombard units attacked on non-native tile (for bombarder) - instead this, classic duel occurs.
Not sure, if it is bug or intended feature?
Is this something to do with bombarders having a normal attack against sea units? This issue will probably go away with fc3.0 (using action enablers).

Re: AI vs Capturable and Bombarder flag

Posted: Tue Aug 28, 2018 2:08 pm
by Wahazar
nef wrote: Is this something to do with bombarders having a normal attack against sea units?
Yest, it is the most frequent case.
Or bombarders attacking something on mountain.

Re: AI vs Capturable and Bombarder flag

Posted: Wed Aug 29, 2018 1:30 pm
by Corbeau
Can someone clarify, then? If a unit with a "Bombarder" flag attacks non-native terrain, it doesn't act as "Bombarder" and is basically risking destruction?

So, a Cannon bombarding a ship at sea (if enabled) can die, and also a Battleship bombarding a ground unit (if enabled) can die?

Is there any way to reverse the effect? So

Re: AI vs Capturable and Bombarder flag

Posted: Wed Aug 29, 2018 2:49 pm
by Akechi
Corbeau wrote:Can someone clarify, then? If a unit with a "Bombarder" flag attacks non-native terrain, it doesn't act as "Bombarder" and is basically risking destruction?
Bombard combat occurs when all of following condition are satisfied:
1. Terrain class of target tile is Land.
2. At least 1 enemy unit exists in target tile.
3. Attacker unit has bombarder unit flag.
4. Attacker unit is not transported.

if 1, 2 or 3 are not satisfied, then normal combat resolution occurs.
if only 4 is not satisfied, then output error message: "This unit is being transported, and so cannot bombard."

Re: AI vs Capturable and Bombarder flag

Posted: Thu Aug 30, 2018 12:00 pm
by Wahazar
Thanks for clarification, so generally bombardment code assume, that unit is airborne.

Re: AI vs Capturable and Bombarder flag

Posted: Sun Sep 02, 2018 3:34 pm
by nef
Wahazar wrote: so generally bombardment code assume, that unit is airborne.
I had no problem with all the usual suspects (as per Civ III I believe) bombers, ships, siege weapons (catapults -> howitzers); plus I also had archers. This was fc2.4. I am not aware of any regression but I have only tried civ2civ3 in fc2.5.

Akechi's rule 1 refers to "land" not "attack_non_native". The confusion may be due to coincidence of the two cases. Rule 2 is new to fc2.5 (as a fix to 2.4 where it definitely did bombard an empty (city) tile - but I am not entirely sure I agree with this change).
So to be more specific, as I understand it:
Corbeau wrote: a Cannon bombarding a ship at sea (if enabled) can die, and also a Battleship bombarding a ground unit (if enabled) can die?
First is always a normal attack. Second is a bombard attack if flag is set.

Re: AI vs Capturable and Bombarder flag

Posted: Wed Sep 05, 2018 10:55 am
by Wahazar
I found bug related with "Capturable" flag, if assigned to sea transport:
http://www.hostedredmine.com/issues/772516
Seems, that whole stack is captured, and captured land units cause assertion fail.