I\'m working on a 2D game that has a huge amount of dynamic entities. For fun\'s sake, let\'s call them soldiers, and let\'s say there are 50000 of them (which I just randomly t
The simplest approach is to use a grid. It has several advantages:
Also, make sure you don't do a squareroot for every distance check. Since you are only comparing the distances, you can also compare the distance squared.