[DGD] Using r-trees to subdivide a world

Shentino shentino at gmail.com
Fri Aug 3 16:20:24 CEST 2012


I intend to have two different layers.

The outer layer would be explicit geographic and political subdivisions.

This would be the traditional cluster > galaxy > sector > star >
planet and its moons > continent / ocean > nation > state > county >
city > block / street > building > room > furniture > compartment >
trinket.

Here, objects that contain other objects would be named and listed in
a directory of sorts and this is the primary layer that builders would
be working on.  I intend for this part to be kept simple and abstract.

I don't intend to use an rtree structure at this level to keep things
simple for my builders, and also so that some other parts of my code
won't have to deal with rtrees.

The inner layer would kick in if an object, such as a galaxy or an
uncivilized stretch of wilderness, contained more inventory, such as
stars or animals, than could efficiently be managed.  My cut-off would
probably be about 50 objects or so before I shove everything into an
rtree.

This inner layer is where I'm most in need of an r-tree type thing to
divide and conquer by physical location.

It's also intended to be a background sub-layer that is very much
"under the hood" with interfaces that allow usage without worrying
about the details.  Only geometry nerds would typically even be
curious about it, but otherwise I want very much to keep the details
at this level out of the way and neatly abstracted away as far as
builders go.

So I guess you could say that rtree-ing would act as a spatially
specialized extension to inventory management.

I have thought about using rtrees for general geography, but how do I
keep it simple for builders who don't care about rtrees?



More information about the DGD mailing list