Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AutoTarget ignoring frozen actor bot targeting hack #20978

Merged
merged 1 commit into from
Jul 30, 2023

Conversation

PunkPun
Copy link
Member

@PunkPun PunkPun commented Jul 27, 2023

The behaviour mismatch can cause an AI unit which has attack range longer that vision range to freeze in place. The check added in db2fded made the bug less common, but as #20257 was merged the checks now hide the bug in way fewer cases

The fix is to mirror these checks to AutoTarget

// Bot-controlled units aren't yet capable of understanding visibility changes
if (viewer.IsBot)
{
// Prevent that bot-controlled units endlessly fire at frozen actors.
// TODO: Teach the AI to support long range artillery units with units that provide line of sight
if (t.Type == TargetType.FrozenActor)
{
if (t.FrozenActor.Actor != null)
return Target.FromActor(t.FrozenActor.Actor);
// Original actor was killed
return Target.Invalid;
}
return t;
}

Mirrors check of the function Recalculate which is found it TargetExtensions class
@PunkPun PunkPun added this to the Next Release milestone Jul 27, 2023
@PunkPun
Copy link
Member Author

PunkPun commented Jul 27, 2023

Reproducing the bug may prove difficult, I just confirmed it by seeing that the replay containing the bug got out of sync the exact moment when the bug was supposed to happen

@Mailaender Mailaender merged commit d4e6815 into OpenRA:bleed Jul 30, 2023
3 checks passed
@Mailaender
Copy link
Member

Changelog

@PunkPun PunkPun deleted the Fix-AutoTarget branch July 30, 2023 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants