Please check out RetroMUD !

Member Discussions

terms



[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]


1. How to store/search this data? Sat Feb 28, 2004 [12:47 AM]
Delgath
Email not supplied
member since: Jan 13, 2004
Reply
I was wondering if anybody had a suggestion for how to store and search object location data?

In particular, let's suppose I have a list of 1000 objects each with a name and a x,y,z coordinate. When I am at any particular object, I'd like to return a list of all other objects within a certain range from that x,y,z coordinate.

One way to do this is to just loop through all 999 other objects and see if the distance from that object to the one I'm at is less than the required range (based on the x,y,z coordinates of each), but that seems very inefficient and surely there's a better way.

Does anybody know one?

Thanks,

Thomas.


2. RE: How to store/search this data? Sat Feb 28, 2004 [1:50 AM]
a_htw
assault_htw@yahoo.com
member since: Jul 18, 2003
In Reply To
Reply
I've made myself an array, paralel to the map, that stores the objects in the room. The array itself stores the first object, and the objects have a next_in_room pointer.


3. RE: How to store/search this data? Sat Feb 28, 2004 [8:11 AM]
muir
Email not supplied
member since: Sep 14, 2003
In Reply To
Reply
I believe Tyche posted an excellent treatment of this just recently -search for 'morton codes' to get the posts. Other data structures tossed in often are the R- and R*-trees which have been designed for geographic data.

.




[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]