beyond-all-reason / beyond-all-reason/RecoilEngine
GetUnitWeaponHaveFreeLineOfFire may no longer correctly detect terrain
- Dominant language
- C++
- Stars
- 679
- Forks
- 290
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 40
Description
Previously MCL sector code used a beamlaser weapon and `GetUnitWeaponHaveFreeLineOfFire` to check for terrain, and at some point it worked c.f. https://www.dropbox.com/scl/fi/vode1c0feaurnmubvbtgk/video1.avi?rlkey=rh00xotxslcva5yau1a6gphso&dl=0.
I discovered in the past few days that it no longer worked correctly vs terrain (on recoil_2025.06.21), and swapped for the new `TraceRayGroundBetweenPositions` function
https://github.com/SpringMCLegacy/SpringMCLegacy/commit/510680b124ffe255576de7807a0e3d2ab29ff95a
Caveats;
- The video is from 2016 and much has changed in the game and engine since then.
- The map and setup is different in the video to what I was testing recently (one enemy placed up on a cliff top with friendly at the bottom, moving close to the cliff should make enemy invisible as the cliff gets in the way, I can provide a demo if required)
However, given the minimal change in my commit above, basically just a 1-for-1 replacement it seems there is incongruency between a beamlaser i.e. scanhit weapon's `HaveFreeLineOfFire` and `TraceRayGroundBetweenPositions` when it comes to terrain, which I would not expect.
Contributor guide
Research direction
Start by locating GetUnitWeaponHaveFreeLineOfFire and TraceRayGroundBetweenPositions, then compare how each handles terrain intersection for beamlaser or scanhit weapons. Reproduce the described cliff-top scenario, using commit 510680b124ffe255576de7807a0e3d2ab29ff95a as context; done means line-of-fire terrain detection is consistent with the expected visibility behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100