are you Noname in tha thread?
some people gave advices, that can be good aproximation to the problem but I do not think any of the advices really adress the problem.
in fact any of the solutions they propose can lead to a n^2 search and never to the correct solution, only to an aproximation.
take for example the grid solution, wich is a special case of a quadtree, it will give you a quick seach if the bodies are clostered together, and expensive if the bodies are far appart.
furthermore wrong solution if a body that is father away that the very few one and it is still part of the closest set.
the problem with all the solutions they present to you is that you will never know which of the objects are the exact closest.
for example say you have 100 bodies and you want to know the closest to one body, how do you know that the first say 4 bodies are the closest and not the first 5.
That kind of expert advice is what had lead the Video game industry to mediocre AI solutions. That is the kind of solution that make an AI some time looks good and must of the time look moronic.
for example you will have to set a critiria lei the N closest bodies. say N = 5 and you have a case where they are 7 closest enemy, your abatar will die instead of running away.
but if there are only 3 closest enemy then your abatar end up attacking an eneny that may be irrelevant.
but it get worse, say you want to know the closest closest to make a formation, or to plan an ambush or any kind of strategy, with the false information your ai will also looks stupid.
The Voronoi/Delanay diagrams gives you the exact solution every time. and then from there you can make your AI decisions.
also the Voronoi/Delanay provide information in constant time. and can be maintained incrementally.
having said, it seems you formulated the propblem in terms of the closets points within some radius, have you tried any of those solutions yet?
I'm looking for some background on the following problem: I have a (3d or 2d) point cloud, and for every point (player) I need to calculate a visibility set of all other points within a radius r (let's say that all players have the same r for now). The naive solution is n^2.
if this is what you want, then the solution they provided will solve the problem, but like I say it will give you stupid AI. just think of the case when on body is with in the radius,
but 5 more and just outside the radio just waiting you avatar move toward the bait, your avatar will die everytime.
stil remaind the probmem of maintaninbg the data structure whic they do no adress, and for that Newton comutational geometry library can help too.
but you need to tell me what solution you want also how many objects are we talking about?
and if this a MMOR could the problem be aproximate in teh 2d map?