Hacker News new | past | comments | ask | show | jobs | submit login

What kind of collision detection do you use?

I was inspired by your games to try something similar for the latest Ludum Dare: http://www.bemmu.com/compo/ludum/37/index.html

At first I tried checking every creature for collisions against everything else, but unsurprisingly that was too slow (N^2). To reduce the checks I put each creature in a grid cell based on their position, then check for collisions only against creatures in the same or adjacent cells.

I think overlapping grids would be even more efficient, or perhaps to do these checks on GPU.




Use a quadtree or similar structure for your broadphase detection, it will help right off the bat.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: