VedalAI / neuro-amongus

Among Us Plugin for Neuro-sama
GNU General Public License v3.0
531 stars 50 forks source link

Use floodfill to get closest task #40

Closed Taflaxx closed 1 year ago

Taflaxx commented 1 year ago

The current implementation of GetClosestTask() pathfinds to every available task and calculates their distance to find the closest task. Since only the distances to the tasks are needed and not the path itself I used floodfill instead to improve the efficiency of GetClosestTask(). It expands outwards from the current position until it hits a node that is a valid task and returns this task. This should improve/prevent the stuttering when pathfinding.

Alexejhero commented 1 year ago

Unfortunately this pull request will conflict with the changes that I am making to the pathfinding handler in #34.

After that pull request is finished and merged, I will see how I can implement your changes then.