Closed Sheldonfrith closed 8 months ago
its likely going to take more than 1000 entities. i haven't done formal benchmarks, but this was developed out of my own need at first, which started at around 10K entities
it should get much better than naive in 2 cases:
i've also been working on more naive hash and grid based solutions with often better tradeoffs in a branch, but haven't made progress recently due to personal reasons
Thanks for the quick response! I will probably end up using it in the future, as I have multiple systems that can use it, and will probably be working with more entities, but right now I only have a bottleneck in one system, so I'll optimize in a different way.
Noob question here, sorry. As the title says, how many entities do I need before this becomes faster than just a naive loop and distance comparison through all entities?
I added this to my game and surprisingly performance has worsened for the systems that I added spatial queries to. Specifically, my systems were previously simply iterating naively through all entities and comparing coordinate distances to find the entities within a certain area. Transitioning to using
tree.within_distance
reduced performance when I have 1000 entities.Not really an issue, unless there is some bug with within_distance that is making it slow?