3 ms·
While having a quick look at the sources, I learned about the quadtree: http://de.wikipedia.org/wiki/Quadtree http://de.wikipedia.org/wiki/Quadtree. agar.io is
by raffomania 11y ago
While having a quick look at the sources, I learned about the quadtree: http://de.wikipedia.org/wiki/Quadtree http://de.wikipedia.org/wiki/Quadtree.
agar.io is using this implementation: https://github.com/silflow/quadtree-javascript https://github.com/silflow/quadtree-javascript to optimize collision detection performance.
- e1g 11y agoGood find. Another nifty JS implementation of collision detection is https://jriecken.github.io/sat-js/ https://jriecken.github.io/sat-js/ - I have used that one for tricky gaming and drag&drop behaviours.
- yoklov 11y agoQuad trees are popular because they're fairly easy to understand and implement, but they don't actually perform that well in practice for broadphase. (Its really more for LOD) If you want a tree that does perform well and is similarly easy to understand, a dynamic AABB tree is much better.