AI - Remove IgnoreWeakerTargetsRatio from attackforceai target logic #4461
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes
This PR removes some bad logic from the GetBestThreatTarget function which the attackforceai uses.
The logic in question created a target acquisition failure loop in the late game. The platoon would try and search for a target. It would get a primary or secondary threat. Then it would check for enemy threat in the positions.
If the enemy was weaker or there was no intel to provide Land/Antisurface threat numbers back then the platoon would deem itself too powerful and ignore the position. Then the platoon would merge into a larger platoon and perform the same check.
It would eventually enter an endless cycle of deeming all other threat unworthy depending on what the enemy was doing and end up with large groups of units bunched up at a base position.
To simplify the explanation. If you put a diamond in a room the AI would only want to steal it if you had armed guards that were similar to its heist team. Else they wouldn't bother stealing it.
Testing changes
This test would need to be confirmed using replays. But it is a bit of a pain to setup the scenario.
You would need to have the AI in a position where its enemy is weakened and is not generating much threat while the AI has attackforceai platoon with many T3 units etc propping up its platoon threat into the 100s.
Once this happened the platoons would start ignoring targets due to lower enemy threat at those positions.
p.s in team games this also relies on PR 4460 to make sure dead enemies are never selected as the current enemy else the
if (baseThreat <= IgnoreThreatLessThan) then
statement would go true due to a strange interaction of Overall threat being present but all other threat types being zero.