ShipDesignAI.optimize_design issue

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Message
Author
User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: ShipDesignAI.optimize_design issue

#16 Post by Dilvish »

biza wrote:hi, maybe im posting in wrong topic, but i noticed AI sending fleet of asteroid hull ships with 1.00k of troops. Biggest defensive troops on planets are cca 50 on turn 200, why build 1000 in just one fleet (and send it without any firepower)?
Build 2015-07-13.c343b42. Sorry for interrupting your discussion :)
Hmm, yes, sounds like trouble. AI troop ship management has not been significantly changed, not for quite a while, back when troop needs tended to be much less, so it probably hasn't gotten vetted as closely as it really needs. It *should* already be plenty able to split up the fleet into smaller ones to use as it needs, but apparently something is going wrong. Could you please post a save file (or link to a hosting site with one) that shows that case? Ideally it would be xml format serialization so I can use it in Linux. To make that you go into Options->Other and uncheck Binary Serialization, then restart the game and load your existing save file (which will be binary format, but you will be able to load it fine), and then save that; this new file will now be in xml format. You will probably then want to change back your serialization, since binary format is more efficient.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
biza
Space Squid
Posts: 67
Joined: Wed May 29, 2013 6:48 pm

Re: ShipDesignAI.optimize_design issue

#17 Post by biza »

OK, savegame is on https://www.dropbox.com/s/3b1c7hx5kfh5q ... 2.sav?dl=0 hope it will work.

First i noticed it as coalition AI had it cca turn 210, but i don't have savegame as auto savegame keeps only last 10 turns :(. Im on turn 241 so i clicked end turn until i noticed it again on turn 252. This time Aristocracy AI and fleet is 1.2k big (Steren delta), they are both using heavy asteroid hull as troop ship.

I hope this helps

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: ShipDesignAI.optimize_design issue

#18 Post by Dilvish »

biza wrote:I hope this helps
Yes, that helps a ton, thanks much. It's quite amusing to see, at this point, since I have time to fix it. The code the AI uses for calculating its orbital invader troop needs is old, from before troop pods could be anything other than 2 per pod, and from before the ShipDesigner. So it was just assuming that its orbital invaders were all colony base hulls with a single 2-troop pod in them, and calculating on that basis. The planet has 66.2 defenders, so it figured it needed 68/2 = 34 orbital invaders. But really what the ShipDesigner has it making here for orbital invasions is Heavy Asteroid Hulls filled with 4-troop pods, so 36 each. 36 x 34 = 1.2k :lol:
At least it wasn't a total waste, unlike regular orbital invaders these ships are mobile and I see them moving around and taking over other targets.

I've pushed the fix, and the revised file is also attached in case git is not convenient for you.

That was a great catch, thanks.
Attachments
InvasionAI.py.zip
(6.76 KiB) Downloaded 81 times
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Post Reply