ZeroK-RTS / Zero-K

Open source RTS game running on the Spring/Recoil engine
https://zero-k.info
GNU General Public License v2.0
683 stars 204 forks source link

CAI is cheating vs Eraser #1140

Closed aeonios closed 8 years ago

aeonios commented 8 years ago

I noticed that the CAI sends units to directly attack snipers if they fire within its LOS, and upon inspecting the code it doesn't use projectileCreated to do this, so I can only assume that it's broken/cheating. Worse yet I've also seen it track an eraser-cloaked unit with fight move when it shouldn't have been able to see the unit at all (the unit was out of los behind terrain and also cloaked).

Anarchid commented 8 years ago

There is only one place where CAI clears units it has spotted: https://github.com/ZeroK-RTS/Zero-K/blob/master/LuaRules/Gadgets/ai_CAI.lua#L2729

This occurs in gadget:UnitLeftLos.

Since 4dd56876146389062038726d57498d8bb1ed2513, all units firing inside another team's LOS will be temporarily revealed, but this should not affect snipers.

To check: whether units re-hidden after firing inside enemy LOS trigger UnitLeftLos for CAI (and possibly for native AI's)

Anarchid commented 8 years ago

Another possibillity: spotEnemy marks spotted units with nonzero range to the enemyMobileAA list; this entry is not cleared on UnemyLeftLos

GoogleFrog commented 8 years ago

CAI does not send attack orders so it is not sending attack orders on cloaked snipers.

CAI spots the attacking unit in UnitDamaged and can send a distress signal to send nearby combat units to fight towards the aggressor. It does so here https://github.com/ZeroK-RTS/Zero-K/blob/master/LuaRules/Gadgets/ai_CAI.lua#L2676

This is an intended approximation because it is cheaper and easier than using projectileCreated and in most situations if you notice a unit hit by a projectile you have a rough idea of where the projectile came from and which unit type made it.

Give an example of the Eraser situation.

GoogleFrog commented 8 years ago

No replay was given. The issue is probably a disagreement about the cheating nature of the UnitDamaged check.