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
Elite
Posts: 362
Joined: Mon Jul 02, 2018 1:49 pm

AI vs Capturable and Bombarder flag

Post 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.
Augmented2 ruleset/modpack for freeciv2.6: http://forum.freeciv.org/f/viewtopic.php?f=11&t=91047
User avatar
JTN
Elite
Posts: 473
Joined: Wed Jan 30, 2013 12:15 am

Re: AI vs Capturable and Bombarder flag

Post 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).
Wahazar
Elite
Posts: 362
Joined: Mon Jul 02, 2018 1:49 pm

Re: AI vs Capturable and Bombarder flag

Post 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?
Augmented2 ruleset/modpack for freeciv2.6: http://forum.freeciv.org/f/viewtopic.php?f=11&t=91047
nef
Elite
Posts: 324
Joined: Mon Jun 25, 2018 5:01 pm

Re: AI vs Capturable and Bombarder flag

Post 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).
Wahazar
Elite
Posts: 362
Joined: Mon Jul 02, 2018 1:49 pm

Re: AI vs Capturable and Bombarder flag

Post 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.
Augmented2 ruleset/modpack for freeciv2.6: http://forum.freeciv.org/f/viewtopic.php?f=11&t=91047
User avatar
Corbeau
Elite
Posts: 1291
Joined: Mon Jan 13, 2014 11:13 pm

Re: AI vs Capturable and Bombarder flag

Post 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
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
Akechi
Posts: 34
Joined: Thu Dec 07, 2017 12:17 pm

Re: AI vs Capturable and Bombarder flag

Post 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."
Wahazar
Elite
Posts: 362
Joined: Mon Jul 02, 2018 1:49 pm

Re: AI vs Capturable and Bombarder flag

Post by Wahazar »

Thanks for clarification, so generally bombardment code assume, that unit is airborne.
Augmented2 ruleset/modpack for freeciv2.6: http://forum.freeciv.org/f/viewtopic.php?f=11&t=91047
nef
Elite
Posts: 324
Joined: Mon Jun 25, 2018 5:01 pm

Re: AI vs Capturable and Bombarder flag

Post 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.
Wahazar
Elite
Posts: 362
Joined: Mon Jul 02, 2018 1:49 pm

Re: AI vs Capturable and Bombarder flag

Post 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.
Augmented2 ruleset/modpack for freeciv2.6: http://forum.freeciv.org/f/viewtopic.php?f=11&t=91047
Post Reply