Trajectoryheight HaveFreeLineOfFire fix #944
Merged
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.
trajectoryheight
missiles have been using a quadratic trajectory assumption forHaveFreeLineOfFire
checks.However, this assumption was poor for missiles with acceleration, and was poor for firing at different elevations.
This causes multiple false positives, blocking fire in some cases
#869
Or false negatives, causing friendly fire or firing missiles into cliff faces requiring game-side workarounds
beyond-all-reason/Beyond-All-Reason#1796
This PR acknowledges that
trajectoryheight
missiles follow a Pursuit curve path, and uses a simple numerical ordinary differential equation (ODE) solver method (Heun's method) to obtain the approximate path.[Other methods, such as trying to fit the
trajectoryheight
missile curve to a cubic equation, were tried and did not work]This has been performance tested, with wallclock time, to ensure no negative performance impact.
BAR corban firing at max range, with 1 friendly unit under the trajectory.
Base engine, 0.53 seconds to perform 100,000
HaveFreeLineOfFire
checks.With PR, 0.51 seconds to perform 100,000
HaveFreeLineOfFire
checks.