Code: Select all
$posx; //player's X position
$posy; //player's Y positionNow I have a viewport of 550x350 pixels which is peg registered (player is always centered).
Now to grab the other players right now I do a simple query and grab all the players whos posx and posy are within that 550x350 rectangle around you.
One problem with that is that it doesnt return them in order of distance from you.
I was thinking of changing that query to order by distance, which would mean SQRT( ($posx - posx)^2 + ($posy - posy)^2), now heres my question:
is it ok to do a query where "distance" is less than 275, ordered by distance? Or would that slow down the query a lot?