AI weird behaviours

AI development

Moderators: Grummel7, Committer

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

AI weird behaviours

#1 Post by Oberlus »

I was looking for a general thread to report weird/suboptimal AI decisions, but couldn't find one.




Version 9a15923

A Replicon AI decided to colonize a radiated world, then lost it in the following turns to rebels due to negative stability.

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

Re: AI weird behaviours

#2 Post by Grummel7 »

Losing a new colony after just one turn? Could it even have done something about it?

Anyway, if you send me a save from the turn it started builing the colony got finished, I can have a look at it. The new colonisation could tries to determine the stability the colony will have and should not build one, if it turns out to be negative, but of course the code is not perfect.

I am currently working on the colonisation code, after I observed a much weirder behaviour: An AI built an outpost, started building a colony on it, but at the same time put a colony ship in front of the production queue. Then it used the colony ship to settle the planet that contained the half finished colony building.

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

Re: AI weird behaviours

#3 Post by Oberlus »

Grummel7 wrote: Sun Aug 14, 2022 12:57 pm Losing a new colony after just one turn? Could it even have done something about it?

Anyway, if you send me a save from the turn it started builing the colony got finished, I can have a look at it. The new colonisation could tries to determine the stability the colony will have and should not build one, if it turns out to be negative, but of course the code is not perfect.
The AI lost the planet due to low stability in a supply-disconnected colony. It should have either not take it as a valid target for colonization (out of supply after colonization), or send first an outpost, or set the protection focus.

I attach saves for turn 16 (right before AI sees the planet, I believe) and turn 34 (two turns before my frig gets there to discover it was colonized and had negative stability). The planet is in the eastern border, Eguzky beta.
Attachments
AI_colonizes_disconnected_then_rebels.zip
(881.1 KiB) Downloaded 94 times

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

Re: AI weird behaviours

#4 Post by Grummel7 »

When I loaded the game, the colony was not lost, I guess the new bonus for good environment saved it.

Anyway, the reason it did not switch to protection focus was that the empire had a influence deficit. When you have a deficit, switching planet from influence to protection just makes it worse, it's better to lose colonies in this case.

It probably shouldn't have colonised it in the first place. The rating was below the threshold, but I have to change more than just the rating code.

Another things I can possibly implement is to prioritise orbital construction when the AI has connection problems. It would have solve the problem in this case.

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

Re: AI weird behaviours

#5 Post by wobbly »

Grummel7 wrote: Mon Aug 15, 2022 4:59 pm Anyway, the reason it did not switch to protection focus was that the empire had a influence deficit. When you have a deficit, switching planet from influence to protection just makes it worse, it's better to lose colonies in this case.
Is this happening often? If so it should probably be trying to avoid the deficit in the 1st place. Not sure how the AI handles influence, but it should probably be trying to keep a small buffer above 0 to handle sudden influence costs shifting.

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

Re: AI weird behaviours

#6 Post by Grummel7 »

wobbly wrote: Tue Aug 16, 2022 5:31 am Is this happening often? If so it should probably be trying to avoid the deficit in the 1st place. Not sure how the AI handles influence, but it should probably be trying to keep a small buffer above 0 to handle sudden influence costs shifting.
It is not happening too often, but it is not so easy to avoid. If the capital gets disconnected, a lot of planets get -1 at once. Also it may lose a good influence producing planet.

One problem the AI has is that it currently keeps bureaucracy, which means that when switching a planet to influence focus, the production first gets down and actual production only start 3 turns later. When I started working with the AI, stability was a big issue and using bureaucracy was an easy step forward, but now it should learn to use it selectively.

Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: AI weird behaviours

#7 Post by Ophiuchus »

Does the AI consider the extra influence cost of adding a colony yet? So that it knows it should only colonize the e.g. two best planets not more?
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

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

Re: AI weird behaviours

#8 Post by wobbly »

Grummel7 wrote: Tue Aug 16, 2022 6:55 am It is not happening too often, but it is not so easy to avoid. If the capital gets disconnected, a lot of planets get -1 at once. Also it may lose a good influence producing planet.
Yeah this... At some stage I suspect some consideration has to be put into whether this is a feature or whether the penalty is too harsh. My general feeling is it good that the tactic works, but the actual consequences are too high.

Now in multiplayer you can say to players, defend your capital supply properly or get wrecked. However in single player its going to be hard to get the AI to understand spatial concepts well enough. I'll do a test run soon, I suspect I'll be able to just casually wreck them with supply games.

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

Re: AI weird behaviours

#9 Post by drkosy »

The AI in general builds a lot of ships instead of expanding. That makes it hard to beat it early on but you can easy beat them later on. There should be more balance between growth and fleet.

This is not a strange behaviour but might be addressed as well.

In Version 0.4.10 I once saw a Trith AI colonizing a radiated planet with Exobots. This was long time ago and I didn't see it with later versions. Seems to be fixed :)
Want some fresh experience? Try Kosymod

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

Re: AI weird behaviours

#10 Post by drkosy »

In my recent game the AI puts combat ships in a system with nothing to fight.

It's Lynx Alpha (marked on screenshot). The fleet stays there for at least 30 turns and gets stocked up from time to time with ships from "D'nebag". Don't know what treasure they guard there...
Attachments
AI-Fleetorga.jpg
AI-Fleetorga.jpg (220.83 KiB) Viewed 2298 times
Want some fresh experience? Try Kosymod

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

Re: AI weird behaviours

#11 Post by Oberlus »

drkosy, AI team needs a save file.

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

Re: AI weird behaviours

#12 Post by drkosy »

Here you go. It is turn 212 while the screenshot is turn 210 but there is no change in behaviour.
Attachments
AI-Fleetorga.zip
(1.39 MiB) Downloaded 86 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

#13 Post by Grummel7 »

The AI tries to colonize the system, and thus protects it. It even has an outpost ship, waiting to fly to it, but your fleet at Azha β blocks the way.

Yes, the behaviour is stupid. First it could notice that protecting D'nebag would be enough and second it should either abandon the mission or try to attack your fleet. But this not so easy to fix and there are more important issues.

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

Re: AI weird behaviours

#14 Post by drkosy »

But this not so easy to fix and there are more important issues.
No doubt about that. As I see, the AI does a lot of things better than in 0.4.10 so great work!

One idea: The AI could changed to put more effort in supply connected colonies. That could lead to a more efficient fleet management or maybe it makes it even more worse...
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

#15 Post by Grummel7 »

drkosy wrote: Thu Aug 25, 2022 8:08 pm One idea: The AI could changed to put more effort in supply connected colonies. That could lead to a more efficient fleet management or maybe it makes it even more worse...
Actually it should do that, at least the new rating code checks if an outpost could close a supply chain gaps and that considerably increases its rating.

Post Reply