Summary: Allow AI paths with intermediate actions
                 Project: Freeciv
            Submitted by: persia
            Submitted on: Fri 11 Jul 2014 05:54:17 AM JST
                Category: ai
                Priority: 5 - Normal
                  Status: Need Info
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 



Patch #4889 removed the calculation of the cost of an attack, instead using a
flat value of SINGLE_MOVE.  The attached patch correctly charges units so that
the remaining moves for a continued path in the same turn may be calculated.

Unfortunately, this isn't sufficient to allow the AI to be able to use
Fighters effectively (or, in fact, any non-UCF_MISSILE fuel=1 unit), because
if any action is performed on any tile, that tile is set to TB_IGNORE, so
pathfinding shows that the unit would go to the tile, attack, and then stop,
not being able to return to base.  Similarly, if an Armor is escorting a
Howitzer, the Armor doesn't believe it can reach the Howitzer if it stops
along the way to kill something (even though it has an extra move available).

I'm not sure of the right way to solve this, because when an action is
performed on a tile, the unit only advances to the tile if the target tile is
native (not required for many actions), the action is an attack, occupychance
is set > 0, and a random number is higher than occupychance.  Where this
combination of events occurs, it is perfectly reasonable for a unit to
consider a path through other units, but pathfinding can't be sure this will
work (even if all other conditions are met and occupychance==100, the
defending unit may not be destroyed or the move_rate may be adjusted
unpredictably as a result of the combat).

It would be interesting to be able to construct a validated path that involved
going somewhere, killing something, and returning to base in a single turn
(Fighter leaving base to destroy enemy Bomber adjacent to nearby City), or
continuing to escort something with a passing attack along the way (Chariot
escorting Catapult killing adjacent enemy Horsemen before following it's
charge).  This probably needs some mechanism to indicate if and where passing
actions were performed (and is complicated by the occupychance issues
mentioned above).  Note that humans are capable of these activities (and
regularly do so: Fighters aren't so good for much else, and a Chariot
escorting a Cannon being chased by enemy Horsemen may be committing suicide by
not acting as described).


File Attachments:

Date: Fri 11 Jul 2014 05:54:17 AM JST  Name:
charge-higher-attack-costs-for-single-attack-units.patch  Size: 3kB   By:



Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to