Large amounts of local data thoughts

Hey peeps. So I had a thought today and just wanted to see if anyone has tried it or perhaps I’m just over thinking the issue at hand.



Lets say I have a large amount of scene objects spaced very far apart (in a universe or whatever). Would it make sense to attempt to use standard practices of Octree’s or complex hashmaps or would it make sense to go with something like JavaDB? My thinking for the later is that you could configure objects in a relational database so that you could easily query for an object based on a major feature of the item you’re coming up to.



Sticking with the universe idea you could say have 1 table that would store all major features (Stars, Nebula’s, blackholes) and just assume that those never move. A table with keys linked to this major feature table would contain minor features (Planets, asteroid belts) and even let those objects have sub items (moons, space stations).



Part of my thinking was that for orbital information you could use the users local clock and some orbital mathematics to calculate the position of such items. Further more if you made the planet surfaces procedural for the most part you could store the seed’s in the table as well (along with whatever else is needed or even a large field of some sorts).



But ya. Anyways that was just something I thought off the top of my head. Good idea? Bad idea? Maybe I’m over thinking things?

If you go to galaxy scales you need a db, no way you can store millions of objects in memory :slight_smile: Also you should be able to create only the visual objects that are actually visible to save resouces, a db allows this too. So yeah, good idea :slight_smile:

Cool. :slight_smile:



But out of curiosity how does something like Mythruna store so many blocks? I think this is why I was uncertain of my solution.

In a db and it generates the visual blocks only for where the player is, just like I said ^^

Actually it just needs to store those that are different from what the “world algo” which defines the landscape spits out.

Oh… Well then. Good thing I’m making sense. Whew. :stuck_out_tongue:

Spatially organize the data into a grid of some cell size then store the data in a cell under the key for that cell. The key is easily calculated so it’s easy to retrieve anywhere in the universe at any time.



Mythruna stores it’s world data as files on the disk using the grid location as the file name, basically. I further organize things into larger grid cells just to keep the directories from getting too large. (Some OSes don’t like several thousand files in a directory.)



So in Mythruna’s case, the world is divided into large 1024x1024 block areas that I call “nodes” and under that there is a 32x32x32 grid of “leafs”. So I end up with:

node-0x0x0

/0x0x0.leaf

/0x0x1.leaf

…and so on.



I could have stored it in a database but the file system already has a fine index for this purpose and is often better at storing this kind of data.



I store my entity data in a real database, though. (hypersqldb is excellent for this).