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

preaim at blocked targets #977

Draft
wants to merge 4 commits into
base: BAR105
Choose a base branch
from

Conversation

KyleAnthonyShepherd
Copy link
Collaborator

@KyleAnthonyShepherd KyleAnthonyShepherd commented Aug 29, 2023

Currently, a HaveFreeLineOfFire check is performed during autotarget sweeps, and during weapon Update.
Targets that fail this check during the autotarget sweep are excluded, and targets that fail this check during Update are dropped as a valid target before aim scripts are called.

This causes behavior problems for units that "deploy" into a different configuration when they acquire a target. No matter if the deployment is as complicated as unfolding a missile tube, or as simple as raising a cannon barrel to correctly angle a shot.
If the HaveFreeLineOfFire check fails in the neutral, stowed away position, the unit AimWeaponX is never called and the unit never deploys their weapon into the configuration that may allow them to fire.
Previous examples in BAR include:
Sniper not raising rifle if there are small terrain obstructions.
beyond-all-reason/Beyond-All-Reason#1857
corvroc not raising their missile tube due to blocking friendly units.
image
Plasma bot in the back cannot fire over its friend because its guns are still flat, while the Plasma bot in the front can fire because it has previously angled up its guns
image

In addition, there are situations where you know the blocked target will be non-blocking soon, such as:
Rounding the corner around friendly walls,
image
A square of retreating units and the rear units could die soon, giving a free line of fire to the units in the middle
image
But no pre-aiming can occur due to the engine dropping blocked targets.

This PR adds a UnitDefWeapon boolean preaimAtBlockedTargets to allow those weapons to acquire and keep blocked targets. Actual weapon firing is still blocked by the relevant HaveFreeLineOfFire check, and non-blocked targets are only aimed at if there is no goodTargetUnit or badTargetUnit available, and if a goodTargetUnit or badTargetUnit becomes available, the next SlowUpdate Autotarget sweep will select that new target.

Video of bottom armrock with preaimAtBlockedTargets = true and corstorm without
https://github.com/beyond-all-reason/spring/assets/44480662/40bfce8d-8b0f-42c5-a12b-551540786e6a

@lhog
Copy link
Collaborator

lhog commented Feb 21, 2024

Good change. Are any concerns to keep the PR in the draft state?

@TheSilverHornet
Copy link

+1 for needed functionality. I realise engine is in mothballs atm, but is there a possibilty to resurrect this PR?

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

3 participants