Original Post
im creating a tiled top-down-view game, and i want to create a quick distance (collision) algorithm. heres my thoughts so far, tell me what you think...
1) quick culling of players/weapons by which tile they are on in the world
2) find x and y distances (self-explanatory)
3) i want the exact distance, but i was thinking:
instead of using the D = sqrt(x^2 + y^2) distance formula (because sqrt are very expensive speed-wise), i would just use D^2 = x^2 + y^2. so if im trying to see if a weapon is 12 units away from a player, i would see if x^2 + y^2 < 12^2 or x^2 + y^2 < 144.
im just curious as to what you guys think of this algorithm. any way to speed it up?