Better spatial partitioning


Last time I had a classic quadtree going for spatial partitioning. Although it worked, it didn't deal with overlaps properly.

I've now reworked it to be based on bounding boxes (AABBs) instead of the classic 'put the overlapping item in multiple parts of the tree' approach. It's less efficient in some ways, but also simpler.

In the video (mild flashing colour warning BTW) you can see a constant 'popping' effect as the split regions grow to occupy the moving objects, and then get split again once there are too many objects in the space. 

This is already working for spatial queries (i.e. tell me what objects are in X area so I can test for collision) so I can finally start implementing actual stations and game behaviors

Leave a comment

Log in with itch.io to leave a comment.