![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](https://www.lexaloffle.com/bbs/files/25532/icon.png)
One optimization path for a very large number of things colliding between each other is to "bucket" actors.
That is, for each update, for each actor:
- get list of buckets the actor is in
- unregister actor from buckets
- update actor position
- register actor into in new buckets
Collision between 2 actors might exist only if the bucket count is > 1.
Getting the list of possible colliders is done by iterating over the content of each bucket the actor touches:
Some reference material:
https://conkerjo.wordpress.com/2009/06/13/spatial-hashing-implementation-for-fast-2d-collisions/
"Gif" example:
![](https://www.lexaloffle.com/bbs/files/25532/nuke_cmap.gif)
[Please log in to post a comment]