AI vs Capturable and Bombarder flag

What would you like to see in Freeciv? Do you have a good idea what should be improved or how?
Wahazar
Hardened
Posts: 201
Joined: Mon Jul 02, 2018 1:49 pm

AI vs Capturable and Bombarder flag

Postby Wahazar » Tue Jul 03, 2018 12:10 pm

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.

User avatar
JTN
Elite
Posts: 462
Joined: Wed Jan 30, 2013 12:15 am

Re: AI vs Capturable and Bombarder flag

Postby JTN » Tue Jul 03, 2018 8:19 pm

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).

Wahazar
Hardened
Posts: 201
Joined: Mon Jul 02, 2018 1:49 pm

Re: AI vs Capturable and Bombarder flag

Postby Wahazar » Fri Aug 24, 2018 10:23 am

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?

nef
Hardened
Posts: 154
Joined: Mon Jun 25, 2018 5:01 pm

Re: AI vs Capturable and Bombarder flag

Postby nef » Mon Aug 27, 2018 2:14 pm

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).

Wahazar
Hardened
Posts: 201
Joined: Mon Jul 02, 2018 1:49 pm

Re: AI vs Capturable and Bombarder flag

Postby Wahazar » Tue Aug 28, 2018 2:08 pm

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.

User avatar
Corbeau
Elite
Posts: 984
Joined: Mon Jan 13, 2014 11:13 pm

Re: AI vs Capturable and Bombarder flag

Postby Corbeau » Wed Aug 29, 2018 1:30 pm

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

Akechi
Posts: 32
Joined: Thu Dec 07, 2017 12:17 pm

Re: AI vs Capturable and Bombarder flag

Postby Akechi » Wed Aug 29, 2018 2:49 pm

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."

Wahazar
Hardened
Posts: 201
Joined: Mon Jul 02, 2018 1:49 pm

Re: AI vs Capturable and Bombarder flag

Postby Wahazar » Thu Aug 30, 2018 12:00 pm

Thanks for clarification, so generally bombardment code assume, that unit is airborne.

nef
Hardened
Posts: 154
Joined: Mon Jun 25, 2018 5:01 pm

Re: AI vs Capturable and Bombarder flag

Postby nef » Sun Sep 02, 2018 3:34 pm

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.

Wahazar
Hardened
Posts: 201
Joined: Mon Jul 02, 2018 1:49 pm

Re: AI vs Capturable and Bombarder flag

Postby Wahazar » Wed Sep 05, 2018 10:55 am

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.