I'm trying to speed up my collision resolution by using multiple threads.
I'v read through Box2D's source code and while it was challenging and educating, it didn't really point me to how I could use multiple threads.
I'm ready to make some sacrifices with accuracy. I am investigating this because I have boatloads of game objects.
My current implementation handles AABB checks for 100000 objects in about 10 ms. I have no idea if this number is good, but for my purposes it seems sufficient.
Next, I'm trying to figure out how to resolve collisions. How could I get power out of multiple threads here?
This is what i'm currently planning to do: (Do you see any issues with it?)
- Calculate position for each object in separate threads based on manifold data
- Update existing manifolds in separate threads
- get New collisions for moved objects in separate threads
- Repeat 10 times or until no changes