official-antistasi-community / A3-Antistasi

Antistasi Community Version - work in progress - Discord https://discord.com/invite/TYDwCRKnKX
https://antistasi.de
Other
225 stars 156 forks source link

[Change]: Patcom AI should respond faster to enemy fire #2962

Open jaj22 opened 11 months ago

jaj22 commented 11 months ago

Currently it's possible for patcom AI groups to stay locked in safe mode for an excessively long time after taking fire. Need to look into ways to speed this up without eating performance.

jaj22 commented 11 months ago

Tested a bit. There's definitely something odd going on with some contacts not showing up in targets. Haven't pinned it down yet though. Might be some kind of priority system so weaker targets get dropped if there are enough prominent ones, which would be acceptable.

jaj22 commented 11 months ago

Ok, I think it's fine to strip out the allUnits check. There are two common differences that I noticed:

  1. Occasionally a unit will turn up very briefly in the allUnits check and then disappear from it. Not sure what these are because they didn't stick around long enough to check in zeus.
  2. The targets check has a maxAge cap of 120 seconds (PATCOM_TARGET_TIME) while the allUnits check uses whatever's standard for knowsAbout falloff (IIRC 300 seconds), so you get some older targets in the allUnits list.
jaj22 commented 11 months ago

In retrospect I don't think it's as simple as speeding up the knownEnemies check and reducing the sleep time. Some of the patrol modes do other fairly expensive stuff on each call, notably the static manning. We do also need an additional mode for defensive combat, as there's currently nothing between safe patrol and attacking outside the garrison.