Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...

Feature #658896

Restore AI ability to build Fighters (fuel = 1 units)

Added by Marko Lindqvist about 4 years ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Category:
AI
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)

Description

During 2.6 development AI was made never to build fuel = 1 units. The reasoning given for that was that due to shortcoming in pathfinding code AI is unable to handle them well enough.
Now I tried to read through the cited tickets, and as far as I can see, there was no REGRESSION caused by pathfinding refactoring. OTOH AI's inability to build Fighters at all seems like a quite a serious regression - it has handled them adequately as far as I remember. It might have not been realized that AI Fighters have been returning to base quite reliably even though they don't do it as part of beforehand planned mission. There's the autorefuel code kicking in on turn change in case Fighter has stopped after its attack.

So I'm about to test if we could simply revert the change to prevent AIs from building fuel = 1 units.

Revert4927.patch (2.46 KB) Revert4927.patch Marko Lindqvist, 2017-05-09 07:12 PM
Revert4927-S2_6.patch (2.61 KB) Revert4927-S2_6.patch Marko Lindqvist, 2017-05-09 07:12 PM
reenable-fighters.patch (27.9 KB) reenable-fighters.patch v.2.6 Alexandro Ignatiev, 2021-03-13 09:24 PM
3.1-restore-ai-fighters.patch (2.79 KB) 3.1-restore-ai-fighters.patch Alexandro Ignatiev, 2021-06-07 12:52 AM
2.6-aiair-restore-fighters (3.05 KB) 2.6-aiair-restore-fighters Alexandro Ignatiev, 2021-06-09 11:21 PM
3.0-aiair-restore-fighters.patch (2.94 KB) 3.0-aiair-restore-fighters.patch Alexandro Ignatiev, 2021-06-11 10:52 PM

Subtasks

Bug #924327: aiair.c: deprecated code makes unnecessary moveClosedMarko Lindqvist

Actions
Feature #924328: Don't rebase air units if it disturbs repairingClosedMarko Lindqvist

Actions

Related issues

Related to Freeciv - Feature #924224: Fuel pathfinder: hand attack possibility consideration to player/AINew

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>
Blocked by Freeciv - Bug #923677: Fuel pathfinder: bug of always waiting in departure airdromeClosed

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

History

#1 Updated by Jacob Nevins about 4 years ago

  • Priority changed from Normal to High

#2 Updated by Jacob Nevins about 4 years ago

  • Sprint/Milestone changed from 2.6.0 to 2.6.0-beta1

This was disabled in gna patch #4927, commit:cdc5f1e1ea.

I think we should re-enable this for 2.6.0-beta1, so that we have a chance to find out if there really is pathfinding trouble during beta testing.

#3 Updated by Marko Lindqvist about 4 years ago

I've not yet managed to get conclusive results from autogame testing. It might (I really need more data to say it for sure) be that like "Coast" units (Bug #682452), those Fighters are never leaving the city they are built at (never attack anybody). So they would only eat up AI resources without providing anything in return.

#4 Updated by Marko Lindqvist about 4 years ago

  • Priority changed from High to Normal
  • Sprint/Milestone changed from 2.6.0-beta1 to 3.0.0-beta1

Marko Lindqvist wrote:

So they would only eat up AI resources without providing anything in return.

It's not 100% waste, but it can use them in such rare circumstances only (in latest autogame less than one in every fifty Fighters built ever attacked anybody) that it's better not to enable them in S2_6. Let's re-evaluate in S3_0.

#5 Updated by Marko Lindqvist 7 months ago

  • Status changed from In Progress to New

#6 Updated by Marko Lindqvist 5 months ago

  • Sprint/Milestone changed from 3.0.0-beta1 to 3.1.0

Situation has not changed in S3_0.

#7 Updated by Alexandro Ignatiev 5 months ago

Actually, I have a patch for improving aviation in 2.6. I tested it on an improved civ2 ruleset, AI uses fighters quite well (but I have not seen it building bombers, or attacking with them if provided, maybe the unit costs are overvalued). There is a problem in fuel pathfinder not covered by this patch (units with over 255 total move fragments with "Missile" or "OneAttack" flags get wrong costs for attacks on the map), maybe it is related, but I don't think I've broken anything more in it.

#8 Updated by Alexandro Ignatiev 4 months ago

  • Blocked by Bug #923677: Fuel pathfinder: bug of always waiting in departure airdrome added

#9 Updated by Alexandro Ignatiev 4 months ago

One more stupidity worth fixing before we let the birds out is that rebasing does not consider the unit's health. I've observed a unit that was stuck at low hp for dozens of turns due to bunny hopping between cities. Likely, we should allow rebasing (if the unit has not full hp, has not moved and is on a refuel point) only if in one turn spent there it would get more hp then in two turns here, or something.

#10 Updated by Alexandro Ignatiev 4 months ago

  • Related to Feature #924224: Fuel pathfinder: hand attack possibility consideration to player/AI added

#11 Updated by Alexandro Ignatiev 2 months ago

Seems like we have fixed the things that turned fighters for AI into waste. AI seems to use fighters sanely if I provide them to it in editor (rarely builds them itself even if I remove the prohibitions but it's another question maybe solvable by ruleset fiddling). Now, can we remove the code that prevents AI from building them? (Probably we should though retain the lines that prevent considering fuel=1 non-missile units as paratroopers since I doubt AI will return them in time.)

#12 Updated by Marko Lindqvist 2 months ago

Is the patch here up to date, or should I wait for a new version before starting testing it?

#13 Updated by Alexandro Ignatiev 2 months ago

Nope, it's just a draft of what is done or to be done with other patches. I'll try to publish the actual one later today. Idk if the "Revert*" patches are up to date. I say, we likely need to keep it yet for paratroopers.

#14 Updated by Alexandro Ignatiev about 2 months ago

Tested: 2.6 patch can be applied (but see above), for 3.x we need a new patch that I put here. The patch works but it is difficult to find a ruleset where AI will build aviation (e.g. in civ2civ3 Fighter is 60sh/20hp/4att and Cruiser is 80sh/30hp/6att and AI would better build Cruiser vs sea target or Marine vs land one).

#15 Updated by Alexandro Ignatiev about 2 months ago

2.6 patch without paratroopers. Tested with Aviation ruleset though I seemingly have not got a single fighter in an autogame (the land and sea units are too toug for the planes and air units don't hang around in the open)...

#16 Updated by Marko Lindqvist about 2 months ago

  • Sprint/Milestone changed from 3.1.0 to 2.6.6

#17 Updated by Marko Lindqvist about 2 months ago

3.1 version applies to master too, but neither 3.1 nor 2.6 version applies to S3_0.

#19 Updated by Marko Lindqvist about 1 month ago

  • Status changed from New to Resolved
  • Assignee set to Marko Lindqvist

#20 Updated by Marko Lindqvist about 1 month ago

Pushed to master, S3_1, and S3_0. Waiting for the 2.6.5 release before pushing to S2_6.

#21 Updated by Marko Lindqvist about 1 month ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF