[help] Calculate 10 closest objects from an array
#7

Quote:
Originally Posted by Rac3r
Same as getting highest ranked player, you have to loop many times through, whilst excluding the highest rank each time.
Although it's a lot of looping, it's only looping through an array, I wouldn't worry about it.






You loop to get information about each object, in this case the Distance
why calculate the distance 10 times if you already know it from the first time?
there must be a way with only looping 1 time

the way you would do it:

- Loop trough: 500 players
- 250 closest objects
- loop trough all objects (possibly 10.000)

10.000*250*500 = 1.250.000 times ...
and that more than once/second ??
that is instant CPU death I guess
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)