AI client not giving correct stealth info?

Problems and solutions for installing or running FreeOrion, including discussion of bugs if needed before posting a bug report on GitHub. For problems building from source, post in Compile.

Moderator: Oberlus

Post Reply
Message
Author
User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

AI client not giving correct stealth info?

#1 Post by MatGB »

This isn't the first time I've observed this but it's the first clear example.
Spectacle.J11063.png
Spectacle.J11063.png (185.58 KiB) Viewed 5999 times
The troop ship has been there for awhile, the AI cannot see that Setinon colony but has a troop ship there set to invade. It obviously can't because it can't see it.

I've also occasionally observed this for Furthest and in one case a Lembalalam colony. While the system should be highlighted if there's a homeworld there that you can't see, knowing what troops are needed, etc seems off.

Unfortunately it's a recent reload so no logs of any use but hopefully this can help? It's not game breakingly bad, obviously, but they're spending resources way too early and it's knowledge that shouldn't be there.
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

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

Re: AI client not giving correct stealth info?

#2 Post by Dilvish »

MatGB wrote:The troop ship has been there for awhile, the AI cannot see that Setinon colony but has a troop ship there set to invade. It obviously can't because it can't see it.
Right, that's one of those lingering inefficiencies we haven't fixed yet, though the AI code does have a couple related TODOs. I think the problem can get triggered in a couple ways, such as when a derelict momentarily grants the AI visibility of the stealthed planet, or the AI sees a planet that has been outposted by an AI but not yet had a stealthy colony established on it, and it starts thinking of it as an invasion target; the logic the AI tries using to decide if the planet has a permanent stealth effect is a bit weak (comparing last turn it had partial_visibility of the planet to the last turn it had partial_visibility of the system, there is a TODO to improve that). So it may think the planet is easy pickings and not realize the mistake until the troopships arrive and the code for aborting an in-progress invasion mission is just a placeholder at this point (also a TODO in place there).

To really handle this kind of thing well, I think we need to get AI access to the Universe.GetEffectAccountingMap() method/info that the human UI uses to display meter accounting info, which lets the human player figure out if a stealth effect is just temporary from an ion storm or whatnot, or apparently something more permanent.

In the meantime, we let the AI take a more aggressive, sometimes resource wasteful, approach, rather than foregoing valid invasion opportunities. We could think about flipping that decision, if you think that would be noticeably better (or maybe add enough logic to tie it to AI aggression), but I expect we'll get this shored up in the not too distant future, and I'll open an issue to help prompt us to improve the AI handling sooner rather than later.
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
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: AI client not giving correct stealth info?

#3 Post by Geoff the Medio »

Dilvish wrote:...I think we need to get AI access to the Universe.GetEffectAccountingMap() method/info...
I had a go, but I'm getting some errors from Python when trying to run a game... Not sure what the issue is:

Code: Select all

ArgumentError: Python argument types in
    MeterTypeAccountingInfoVecMap.__iter__(MeterTypeAccountingInfoVecMap)
did not match C++ signature:
    __iter__(struct boost::python::back_reference<class std::map<enum MeterType,class std::vector<struct Effect::AccountingInfo,class std::allocator<struct Effect::AccountingInfo> >,struct std::less<enum MeterType>,class std::allocator<struct std::pair<enum MeterType const ,class std::vector<struct Effect::AccountingInfo,class std::allocator<struct Effect::AccountingInfo> > > > > &>)

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: AI client not giving correct stealth info?

#4 Post by MatGB »

Dilvish wrote: In the meantime, we let the AI take a more aggressive, sometimes resource wasteful, approach, rather than foregoing valid invasion opportunities. We could think about flipping that decision, if you think that would be noticeably better (or maybe add enough logic to tie it to AI aggression), but I expect we'll get this shored up in the not too distant future, and I'll open an issue to help prompt us to improve the AI handling sooner rather than later.
This explanation makes perfect sense, thanks, and I'd forgotten there might've been a Derelict reveal.

At the moment, it's an edge case as there are a tiny number of really stealthed native species, but it might become more of an issue when we move on making stealth an interesting/viable strategy but we know the AI needs work for that anyway.

If we decide to add a fair few more stealthed natives then it's something to bear in mind but not many suggestions recently so not currently an issue.
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

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

Re: AI client not giving correct stealth info?

#5 Post by Dilvish »

Geoff the Medio wrote:I had a go, but I'm getting some errors from Python when trying to run a game... Not sure what the issue is
Hmm, it let you compile, and then you get a runtime error? For me on Ubuntu, it wouldn't even compile. At your end the problem might have only been an incomplete edit for the type of MeterTypeAccountingInfoVecMap, at my end there was also a symbol visibility issue. It seems to work OK for me now (at least compiling and running, I haven't yet tried having the AI actually use the info) and I have pushed my fix to the branch.
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
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: AI client not giving correct stealth info?

#6 Post by Dilvish »

p.s Geoff, Thanks for getting most of that taken care of.

On a related note, does anyone know whether the no-proxy rule for such exposures causes a shallow copy or a deep copy to be made? For me in this case, it was not necessary to have no_proxy set to true for AccountingInfoVec and MeterTypeAccountingInfoVecMap. I left those no_proxy specifications as-is to be conservative, but if the no_proxy for TargetIDAccountingMapMap is causing a deep copy anyways, then I think we could be quite a bit more memory efficient by not making AccountingInfoVec and MeterTypeAccountingInfoVecMap be no_proxy, especially if we really start using this info (there are more applications for it than just the stealthed invasion issue).
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
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: AI client not giving correct stealth info?

#7 Post by Geoff the Medio »

Dilvish wrote:Hmm, it let you compile, and then you get a runtime error?
Yes.

Post Reply