Re: [Freeciv-Dev] (PR#10216) AI Builds Too Many Transports

"Benedict Adamson" <[email protected]>
Newsgroups gmane.games.freeciv.ai
Message-ID <[email protected]>
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10216 >

I've done some further investigation of this problem. Initially I'd 
thought that the city code for emigrating settlers (function 
domestic_advisor_choose_build) was building transports for colonists too 
often. However, debugging with additional  assertions and logging code 
suggests that the military advisor is making the decision to build the 
numerous transports.

What seems to happen is this:

1) The military advisor (function military_advisor_choose_build) 
considers building a naval attacker (for example, a battleship) by 
calling ai_choose_attacker(pcity, SEA_MOVING).

2) When the military adviser examines whether it can use that attacker 
(by calling function kill_something_with), the code can select a land 
unit as the target. That is, it can choose a naval bombardment.

3) That code (kill_something_with)) then checks whether there is a path 
from the city (were the attacker will begin) and the target (the enemy 
land unit to be bombarded), using function goto_is_sane. That call is 
used to decide whether a land attacker needs a ferry; a land attacker 
will need a ferry if there is no valid (land) path from the city to the 
target. However, the function is also used for sea attackers. For those 
units, the kill_something_with function incorrectly concludes that the 
(naval!) attack unit will need a ferry (go_by_boat becomes TRUE). I 
guess it is not handling the 'overlap' needed for shore bombardment 
properly.

4) Consequently, the military adviser decides to build a transport for 
some (many?) cases when it should build a naval attacker.

Note that there is no feed back loop here: the completion of an 
additional transport will not diminish the desire to build more transports.

Does this analysis seem plausible? I'm investigating further, and 
testing a candidate fix.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.