AI weird behaviours

AI development

Moderators: Grummel7, Committer

Message
Author
User avatar
Grummel7
Space Dragon
Posts: 335
Joined: Mon Oct 09, 2017 3:44 pm

Re: AI weird behaviours

#31 Post by Grummel7 »

drkosy wrote: Sun Jan 29, 2023 3:04 pm I have other weird behaviours in one game:
One AI put a colony ship in the middle of my empire with several planets to colonize but it just stopped in an empty system and doesn't do anything. (see screenshot 2)
Another AI sends ships to Soror Alpha (see screenshot 1) even if the passage is blocked by a monster that eats up the ship.

Edit: The scout got to Soror while 2 warships attacked the monster.

Version is 0.5+ build 2022-12-22
Regarding the second case: What monster is this and are you sure, the AI knew about it?

If you haven't restarted the game, you could upload the AI logs, so I can have a look at them.

But the behaviour may not be so weird, except perhaps that it fly the colony ship back if a plan was abandoned. But that is indeed not been implemented. It will only fly the ship somewhere when it has a new plan that the ship could be used for, IIRC (didn't check the code).

User avatar
drkosy
Space Dragon
Posts: 367
Joined: Sat Jul 11, 2020 9:41 am

Re: AI weird behaviours

#32 Post by drkosy »

What monster is this and are you sure, the AI knew about it?
It's a sentinel guarding anciend ruins. The AI should know about it because they wasted several warships there and got a scout pass through while some of the warships are attacked by the monster.
If you haven't restarted
I haven't restated the game but I have to reload the save and let one turn pass. I edit the post when I'm done with it.
perhaps that it fly the colony ship back if a plan was abandoned
That is quite possible. I settled one planet and the other one has warships of another AI in the system. But none of this is in scanner range of the AI so it shouldn't know about it.

Edit: Added the AI-Log for yellow (AI 4)
Attachments
AI_4.log
(460.51 KiB) Downloaded 58 times
Want some fresh experience? Try Kosymod

User avatar
Grummel7
Space Dragon
Posts: 335
Joined: Mon Oct 09, 2017 3:44 pm

Re: AI weird behaviours

#33 Post by Grummel7 »

drkosy wrote: Mon Jan 30, 2023 1:21 pm
What monster is this and are you sure, the AI knew about it?
It's a sentinel guarding anciend ruins. The AI should know about it because they wasted several warships there and got a scout pass through while some of the warships are attacked by the monster.
Not much information in the log, but at least I found that there is code to calculate a threat based on lost ships.

You could try to restart it again and before starting change line 450 in AIState.py to verbose = True, that should make the AI log some debug information about the threat calculation.

User avatar
drkosy
Space Dragon
Posts: 367
Joined: Sat Jul 11, 2020 9:41 am

Re: AI weird behaviours

#34 Post by drkosy »

change line 450 in AIState.py to verbose = True
I did as you said, reloaded the game and let one turn pass. The Log is attached.
Attachments
AI_4.log
(489.08 KiB) Downloaded 61 times
Want some fresh experience? Try Kosymod

quarague
Space Floater
Posts: 31
Joined: Thu Jan 05, 2023 8:00 pm

Re: AI weird behaviours

#35 Post by quarague »

If a colony of an AI looses supply connection the Ai doesn't seem to do anything about it.

What happened: AI has a colony in a system one jump away from its empire capital, system has no ships in it. I'm playing as Laenfa, I send a colony ship to the system and settled another planet in the system. My colony has a higher supply rating so system switches to my supply range and AIs colony gets disconnected from supply.

The AI has a bunch of military ships in the empire capital so I expected it to just send some over to reestablish supply connection. It did no such thing over a bunch of turns until happiness on the colony turned negative.

As I am Laenfa the AI couldn't scan my colony so maybe it doesn't know why it's supply got disrupted (if a colony ship arrives in your system and then a planet turns from empty to unscannable you can make a guess what happened but that may be tricky for the AI) but even if the AI doesn't know why supply got disrupted, it should know that it got disrupted and that sending a military ship there should fix the issue.

User avatar
drkosy
Space Dragon
Posts: 367
Joined: Sat Jul 11, 2020 9:41 am

Re: AI weird behaviours

#36 Post by drkosy »

I have observed another disadvantage in AI behaviours (it's not really weird):
As you see in the screenshot the AI (Fluver) built an outpost on Salpeter II. I guess it's because of the +1 supply range. The same effect they would get if the build a colony ship and put a Fluver colony on Salpeter I. They could save the cost of the outpost ship.
The supply range bonus of small planets seems to be very high rated. Perhaps it's possible to create a check if the bonus could be reached another way.
Attachments
AI-Settling.jpg
AI-Settling.jpg (255.07 KiB) Viewed 1608 times
Want some fresh experience? Try Kosymod

quarague
Space Floater
Posts: 31
Joined: Thu Jan 05, 2023 8:00 pm

Re: AI weird behaviours

#37 Post by quarague »

I tried to look into the AI code trying to understand why it didn't do anything about loosing supply. I might be wrong but to me it looked like the AI first checks its own supply range and then checks the enemy supply range by looking through the various systems. That has a high chance to be incomplete because supply range can easily go beyond your scanning range and enemies might have planets that you can't scan because of insufficient scanning power. This could explain my observed behaviour because the AI still thinks the colonies are supply connected and hence doesn't do anything although they are not.

I feel the AI should just query the general supply status from the game. That is computed using information the AI doesn't have but the result is given to the human player as well so I don't see an issue here.

User avatar
Grummel7
Space Dragon
Posts: 335
Joined: Mon Oct 09, 2017 3:44 pm

Re: AI weird behaviours

#38 Post by Grummel7 »

quarague wrote: Mon Feb 06, 2023 6:57 am I tried to look into the AI code trying to understand why it didn't do anything about loosing supply. I might be wrong but to me it looked like the AI first checks its own supply range and then checks the enemy supply range by looking through the various systems. That has a high chance to be incomplete because supply range can easily go beyond your scanning range and enemies might have planets that you can't scan because of insufficient scanning power. This could explain my observed behaviour because the AI still thinks the colonies are supply connected and hence doesn't do anything although they are not.

I feel the AI should just query the general supply status from the game. That is computed using information the AI doesn't have but the result is given to the human player as well so I don't see an issue here.
Can you point me to the code where you think you found this logic?

Not so long ago I started added code to the AI that used the server calculated supply groups. But I have hardly worked with the military code. Maybe that calculation can be replaced easily.

quarague
Space Floater
Posts: 31
Joined: Thu Jan 05, 2023 8:00 pm

Re: AI weird behaviours

#39 Post by quarague »

Grummel7 wrote: Sun Feb 26, 2023 6:57 pm Can you point me to the code where you think you found this logic?
I don't know Python, I just clicked around in the various files under default/python/AI for a while. I thought I found the supply calculations under turn_state/_supply_state.py but this just seems to call a function for the actual computation which I haven't found anywhere. I was more hoping that someone who was involved in the AI programming would just know how the AI figures out its supply connections and whether it is supposed to do something when it looses supply.

User avatar
LienRag
Cosmic Dragon
Posts: 2148
Joined: Fri May 17, 2019 5:03 pm

Re: AI weird behaviours

#40 Post by LienRag »

Thing is, there isn't really anymore "someone involved with AI programming". The original AI team (which I don't really know) more or less disappeared a while ago, and Grummel recently decided to get a shot at it (and had made great improvements) but doesn't know the code base entirely well, if i'm not misunderstanding things.

wobbly
Cosmic Dragon
Posts: 1879
Joined: Thu Oct 10, 2013 6:48 pm

Re: AI weird behaviours

#41 Post by wobbly »

The AIs research choices are atrocious in multiple ways. I could fix some of these choices, though I'm not entirely sure what is desired here.

It seems beginners find the AI challenging enough, should I be special casing any fix for maniacal?
The AI uses 8 variants of the research list, but realistically all 8 paths are identical with minor order variance, should the variants be more interesting?

Anyway I could name a lot of things wrong with its choices but I'll start with just a few that stick out:
  • Over prioritizes Nascent and Algorithmic Elegance. Likely left over from previous versions. Not ideal, but not completely terrible.
  • Under prioritizes 2nd hull. Very noticeable in game, with a 2nd tier hull you'll just roll the nearest neighbor if you go straight for them. At the point you finish the history analyzer there is very little you can build that isn't a ship (technically there's military command). The incubator takes 8 turns, organics are 8 turns later then the tech. If you compare how many medium hulls to match a robot hull in combat, or the production costs for organic outpost to medium hulls, its equivalent to a large production boost.
  • AI is capable of adopting design simplicity, but will not research mind in the void until it needs it as a prerequisite for enclave of the void. This occurs after its already reached titans.
  • Over prioritizes research in the early game. Logic is "high research at beginning of game to get easy gro tech and to get research booster Algotrithmic Elegance". My logic says a production species shouldn't be switching to research unless it has at least finished the history analyzer, at least for the AI (experienced players can make their own choices here).

wobbly
Cosmic Dragon
Posts: 1879
Joined: Thu Oct 10, 2013 6:48 pm

Re: AI weird behaviours

#42 Post by wobbly »

wobbly wrote: Sun Jul 16, 2023 6:29 am [*]AI is capable of adopting design simplicity, but will not research mind in the void until it needs it as a prerequisite for enclave of the void. This occurs after its already reached titans.
[/list]
The quick and dirty fix for this would be to replace 1/2 the architectural psychologies with mind in the void. So 1/2 the AIs open the 2nd social slot with this instead.

wobbly
Cosmic Dragon
Posts: 1879
Joined: Thu Oct 10, 2013 6:48 pm

Re: AI weird behaviours

#43 Post by wobbly »

wobbly wrote: Sun Jul 16, 2023 6:29 am [*]Under prioritizes 2nd hull. Very noticeable in game, with a 2nd tier hull you'll just roll the nearest neighbor if you go straight for them. At the point you finish the history analyzer there is very little you can build that isn't a ship (technically there's military command). The incubator takes 8 turns, organics are 8 turns later then the tech. If you compare how many medium hulls to match a robot hull in combat, or the production costs for organic outpost to medium hulls, its equivalent to a large production boost.
There's also a quick and dirty fix I could put in here, on turn 1 where it queues planet ecology, if galaxyMaxAgression = 5 queue symbiots. I'd have to test, but rushing symbiots shouldn't slow its economic progress significantly (its low cost, long research time). That's not 100% efficient but it's likely more efficient then what its doing now.

Edit: Perhaps check the AIs specific aggression, so only the maniacal empires do it. That'd give some variance, and room for comparison.
Edit2: There's also the option of a 50 - 50 sub hab then robotic, or symbiot

User avatar
Oberlus
Cosmic Dragon
Posts: 5715
Joined: Mon Apr 10, 2017 4:25 pm

Re: AI weird behaviours

#44 Post by Oberlus »

Your work here is so much appreciated, wobbly. I'm longing for better AIs.

Maybe we could try and gather a set of early research strategies (from players), and give AIs this or that depending on empire species (or species traits, maybe more general) and chance.

wobbly
Cosmic Dragon
Posts: 1879
Joined: Thu Oct 10, 2013 6:48 pm

Re: AI weird behaviours

#45 Post by wobbly »

Oberlus wrote: Sun Jul 16, 2023 11:10 am Maybe we could try and gather a set of early research strategies (from players), and give AIs this or that depending on empire species (or species traits, maybe more general) and chance.
Yeah if someone has a better path that is still simple enough for the AI to use, that'll work. Current structure is to follow a list: This than that, than that, than that etc.. On turn 2 it puts them all in 1 big list. Then it has a bunch of rules to accelerate a tech. So if it has an asteroid it'll move micrograv and asteroid hulls forward in the list. If it finds ancient ruins it moves xenoarch forward in the list etc.

Post Reply