Skip to content

Conversation

@LordMidas
Copy link
Member

@LordMidas LordMidas commented Mar 4, 2025

Instead of the other PR of adding actors within distance functions (#344) which has overlap with the vanilla ::Tactical.queryActorsInRange, causing us to not include that PR, I present to you the other important part of that PR which should be included:

perf: optimize getActors functions for the case of 1 distance

Instead of iterating over all the actors on the battlefield and measuring their distance to _tile, we only iterate over the adjacent 6 tiles. Getting adjacent actors is a very widely used thing in mods and occurs inside often repeating functions e.g. onUpdate so it is good to optimize it.

@LordMidas LordMidas requested review from Enduriel and TaroEld March 4, 2025 21:42
Instead of iterating over all the actors on the battlefield, we only iterate over the adjacent 6 tiles. Getting adjacent actors is a very widely used thing in mods and occurs inside often repeating functions e.g. onUpdate so it is good to optimize it.
@LordMidas LordMidas force-pushed the perf-optimize-getActors-functions branch from 090dbf7 to ca306cf Compare March 4, 2025 21:43
@LordMidas LordMidas merged commit bf3708e into development Mar 11, 2025
@LordMidas LordMidas deleted the perf-optimize-getActors-functions branch March 11, 2025 06:32
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.

3 participants