AI doesn't attack player

Describe your experience with the latest version of FreeOrion to help us improve it.

Moderator: Oberlus

Forum rules
Always mention the exact version of FreeOrion you are testing.

When reporting an issue regarding the AI, if possible provide the relevant AI log file and a save game file that demonstrates the issue.
Post Reply
Message
Author
o01eg
Programmer
Posts: 2004
Joined: Sat Dec 10, 2011 5:46 am

AI doesn't attack player

#1 Post by o01eg »

I've tried to run game test (https://github.com/freeorion/freeorion/pull/2050) with 3 maniacal AI and 400 turns.

When I opened latest save I found out AIs don't capture my capital and even they don't attack my ships.

Is it intended to don't allow AI to attack human player capital or there some bugs prevents them?
test_ai.png
test_ai.png (439.54 KiB) Viewed 1472 times
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-03-15.b3de094.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

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

Re: AI doesn't attack player

#2 Post by Dilvish »

o01eg wrote:I've tried to run game test (https://github.com/freeorion/freeorion/pull/2050) with 3 maniacal AI and 400 turns.
When I opened latest save I found out AIs don't capture my capital and even they don't attack my ships.
Is it intended to don't allow AI to attack human player capital or there some bugs prevents them?
No, at least not for Maniacal or Aggressive AIs which should have been all you had (maybe for Beginner, I don't recall at the moment). And I have certainly had plenty of AI test games where I am just observing the AIs and they definitely will come capture my capital once they come across it.

But this PR you link is the one for only running one turn and then quitting? It does look like the you got to turn 400 and the AIs advanced a fair bit, so I'm puzzled how that fits with this PR, but anyways, check if you encounter this behavior with master or only with your PR.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

o01eg
Programmer
Posts: 2004
Joined: Sat Dec 10, 2011 5:46 am

Re: AI doesn't attack player

#3 Post by o01eg »

Dilvish wrote: But this PR you link is the one for only running one turn and then quitting? It does look like the you got to turn 400 and the AIs advanced a fair bit, so I'm puzzled how that fits with this PR, but anyways, check if you encounter this behavior with master or only with your PR.
The test accepts environment variables to manage number of turns and AIs.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-03-15.b3de094.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

Gault.Drakkor
Space Floater
Posts: 40
Joined: Sat Jul 01, 2017 4:54 am

Re: AI doesn't attack player

#4 Post by Gault.Drakkor »

I have experienced similar issues, AI in late game often becomes unaggressive.

Currently playing:
2018-04-30.2146fa3 + some custom changes(essentially higher production ATM)

Multiplayer games with 3 AI, 1 moderator, 100 or so systems
Trigger seems to be something like two AI's have doom stacks with 2K attack+def. I believe there is some threshold of defending doom stack size. If the defender doesn't have doom stacks, it just gets swallowed.

They just start bogging down and become timid fleet fiddlers. Just Churning ships around not sitting on enemy worlds more then turn or two.
I have seen this in multiple games, multiple different recent branches in the code. The weaker AI's turtle - reasonable. The strongest AI just slows right down and becomes extremely cautious. invasion rate drops to near zero. Not what I would expect from maniacal AI with clear advantage.

Hypothesis: AI decides that the defending doom stack is too tough, targets something 'behind' the doom stack, but then not enough remaining defence to protect against if defending doom stack should attack. So sits and waits for more offence to be built.

I suspect there are problems with issue_fleet_orders_for_fleet_missions but after looking at it for a short bit. That will not be easy for me to figure out what it is doing.

Example:
In my current game turn 388
leading AI has 5x production of second place 375 ships, something like 10-20x the estimated fleet strength
second place AI 120 ships
3rd is at 36 production... 1 colony 2 worlds but has residual fleet of 110 ships 7.3k attack 6.5k def

lead has 40K attack 60k def 1200 troops worth of ships within 3 jumps of the 3rd place empire's two planets two systems.
second place has 7 colonies 1k attack 1k defence in 5 jumps from said world.
second places primary (and only) doom stack is 12 jumps away with 21k attack 13k def

Hmm both defending doom stacks are sitting on their respective home worlds.... could be related, but hope not.

Additional problem that makes it difficult to test, turns take a long time:

first place AI
21:03:41.697570 [debug] python : timers.py:46 - Timing for timer:
21:03:41.697674 [debug] python : timers.py:47 - ======================================================
21:03:41.697922 [debug] python : timers.py:50 - survey_universe 81 msec
21:03:41.698633 [debug] python : timers.py:50 - find_best_designs_this_turn 5730 msec
21:03:41.698880 [debug] python : timers.py:50 - calculate_priorities 3797 msec
21:03:41.699105 [debug] python : timers.py:50 - assign_scouts_to_explore_systems 56 msec
21:03:41.699414 [debug] python : timers.py:50 - assign_colony_fleets_to_colonise 218 msec
21:03:41.699514 [debug] python : timers.py:50 - assign_invasion_fleets_to_invade 147 msec
21:03:41.699602 [debug] python : timers.py:50 - assign_military_fleets_to_systems 400 msec
21:03:41.699689 [debug] python : timers.py:50 - generate_fleet_orders_for_fleet_missions 1344 msec
21:03:41.699789 [debug] python : timers.py:50 - issue_fleet_orders_for_fleet_missions 65867 msec
21:03:41.699863 [debug] python : timers.py:50 - generate_research_orders 1267 msec
21:03:41.699924 [debug] python : timers.py:50 - generate_production_orders 1045 msec
21:03:41.699983 [debug] python : timers.py:50 - generate_resources_orders 2653 msec
21:03:41.700038 [debug] python : timers.py:52 - ------------------------------------------------------
21:03:41.700114 [debug] python : timers.py:53 - Total: 82613 msec
21:03:41.702438 [debug] python : timers.py:45 -
21:03:41.702548 [debug] python : timers.py:46 - Timing for bucket:
21:03:41.702613 [debug] python : timers.py:47 - ===============================
21:03:41.702689 [debug] python : timers.py:50 - Server_Processing 24927 msec
21:03:41.702754 [debug] python : timers.py:50 - AI planning 124106 msec
21:03:41.702811 [debug] python : timers.py:52 - -------------------------------
21:03:41.702884 [debug] python : timers.py:53 - Total: 149033 msec


3rd place AI
21:05:17.796516 [debug] python : timers.py:46 - Timing for timer:
21:05:17.796609 [debug] python : timers.py:47 - ======================================================
21:05:17.796737 [debug] python : timers.py:50 - survey_universe 36 msec
21:05:17.796840 [debug] python : timers.py:50 - find_best_designs_this_turn 91 msec
21:05:17.796940 [debug] python : timers.py:50 - calculate_priorities 1946 msec
21:05:17.797038 [debug] python : timers.py:50 - assign_scouts_to_explore_systems 46 msec
21:05:17.797139 [debug] python : timers.py:50 - assign_colony_fleets_to_colonise 156 msec
21:05:17.797250 [debug] python : timers.py:50 - assign_invasion_fleets_to_invade 172 msec
21:05:17.797353 [debug] python : timers.py:50 - assign_military_fleets_to_systems 122 msec
21:05:17.797456 [debug] python : timers.py:50 - generate_fleet_orders_for_fleet_missions 887 msec
21:05:17.797581 [debug] python : timers.py:50 - issue_fleet_orders_for_fleet_missions 21103 msec
21:05:17.797704 [debug] python : timers.py:50 - generate_research_orders 96 msec
21:05:17.797796 [debug] python : timers.py:50 - generate_production_orders 328 msec
21:05:17.797887 [debug] python : timers.py:50 - generate_resources_orders 884 msec
21:05:17.797974 [debug] python : timers.py:52 - ------------------------------------------------------
21:05:17.798105 [debug] python : timers.py:53 - Total: 25872 msec
21:05:17.798751 [debug] python : timers.py:45 -
21:05:17.798876 [debug] python : timers.py:46 - Timing for bucket:
21:05:17.798981 [debug] python : timers.py:47 - ===============================
21:05:17.799097 [debug] python : timers.py:50 - Server_Processing 130536 msec
21:05:17.799205 [debug] python : timers.py:50 - AI planning 39607 msec
21:05:17.799294 [debug] python : timers.py:52 - -------------------------------
21:05:17.799404 [debug] python : timers.py:53 - Total: 170143 msec

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

Re: AI doesn't attack player

#5 Post by Dilvish »

Hmm, I could easily see them getting stuck in a kind of positive feedback loop, each getting overfocused on their opposing doomstacks. I've got a thought on something to try for it, I'll try to put a PR up soon.
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