Jump to content
  • Advertisement
Sign in to follow this  

Best Spatial Indexing Algorithm

This topic is 2534 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm currently working on a regions (cuboid) plugin for Bukkit (minecraft server API). What I'd like to know is what the best Spatial indexing algorithm would be. There's two main options that I can think of:
  • R-Tree. This is probably the most complicated to implement. I would probably use Linear splitting when nodes get too full, however I'm struggling to understand how the algorithm works. If anyone could provide some pseudocode that would be great.
  • Spatial Hashing. This seems like a more viable option. Minecraft is divided into 16x16x128 chunks, and so I can use a HashMultimap to store which regions are within which chunk. This seems fine for small regions, however would probably start to use a lot of memory when regions span multiple chunks.
    Maybe there's an option to use both of these methods. Most likely there will be very few large regions, however many small ones. Heck I could probably get away with storing the large regions in an array, and iterate through them. Probably a better idea though would be to use something like this: http://khelekore.org/prtree/. Although it only works in 2 dimensions I feel that should be enough for the larger regions since it's unlikely for there to be many large regions stacked on top of eachother.

    Writing this post has already helped me to come to a decision, but if anybody can give me some better guidance I'd be very grateful.


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!