Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of entity to entity collision detection with quad tree #10

Open
BSVogler opened this issue Nov 16, 2017 · 0 comments

Comments

@BSVogler
Copy link
Owner

BSVogler commented Nov 16, 2017

Currently entity collision runs in O(n^2) as every entity checks it collision with each other.

With a grid:
Inserting n entities in a grid with m cells: Still n^2 but divided by m.

Using a quad tree should reduce collision search to O(log(n)).
Split cell if it contains >3 elements. Check for collision probably needs to check the surrounding cells. How to obtain them?

http://gamedevelopment.tutsplus.com/tutorials/quick-tip-use-quadtrees-to-detect-likely-collisions-in-2d-space--gamedev-374

http://gamedevelopment.tutsplus.com/tutorials/make-your-game-pop-with-particle-effects-and-quadtrees--gamedev-2138

@BSVogler BSVogler changed the title Improve collision detection via quad tree Improve performance of entity to entity collision detection with quad tree Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant