Skip to content

Line of sight performance - #1834

Merged
nstlaurent merged 11 commits into
devfrom
line-of-sight-performance
Oct 7, 2026
Merged

nstlaurent merged 11 commits into
devfrom
line-of-sight-performance

Conversation

@nstlaurent

Copy link
Copy Markdown
Collaborator

Checks per block instead of doing the segment split. I originally thought that per block checks would give incorrect results. Given the blockmap segment iterator runs from near to far blocks and it's only checking lines it works out correctly. This wouldn't work with hitscan traversal because it checks both lines and entities. You can hit a line in a closer block and hit an entity that is closer in a different block, so that was left alone.

Before:

Method Mean Error StdDev
LineOfSight2D 162.2 ms 2.18 ms 2.04 ms
Method Mean Error StdDev
LineOfSight3D 110.1 ms 2.03 ms 2.17 ms

After:

Method Mean Error StdDev
LineOfSight2D 66.67 ms 0.381 ms 0.318 ms
Method Mean Error StdDev
LineOfSight3D 42.92 ms 0.309 ms 0.274 ms

~60% faster with an ~85% improvement in the standard deviation, making this much more stable as well.

@nstlaurent
nstlaurent merged commit fd22723 into dev Oct 7, 2026
1 check passed
@nstlaurent
nstlaurent deleted the line-of-sight-performance branch October 7, 2026 16:00
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.

1 participant