Search Unity

Object Databasing for large levels

Discussion in 'Editor & General Support' started by CornDog, May 5, 2013.

  1. CornDog

    CornDog

    Joined:
    Nov 17, 2012
    Posts:
    13
    I'm working on a game that is set in space. The environment is intended to be very large. So to make sure I dont run into floating point problems, I was planning to handle that problem by keeping the camera/ship at about 0,0,0 and just moving the world around it. (Or just do a check and when the ship gets to 5000 in any direction it shifts everything back so the ship is at 0,0,0)

    The problem I'm having is figuring out how to store data about where everything will exist within the world so I can load those assets into the game as they get within range. From my past doing web development my knee jerk reaction would be to use some kind of database but I dont really know what the best practice is for Unity.

    Thoughts?
     
  2. rapidfirestudio

    rapidfirestudio

    Joined:
    Jan 31, 2013
    Posts:
    73
  3. CornDog

    CornDog

    Joined:
    Nov 17, 2012
    Posts:
    13
    Thank you for your reply.
    Unfortunately your answer may address a different question. If so, then then it was my own failure to articulate my question clearly.

    By way of example: Say I have a 3x3x3 cube of "Chunks" in space. If there exists some planet, star, nebula, space station, or ship within one of those chunks, it will need a Vector3 to represent its position within that chunk, and another Vector3 to represent its offset (which chunk it is in.) If my ship starts in the middle of that 3x3x3 cube of chunks and then moves into one of the adjacent chunks I will unload and load data accordingly so that I only have those 27 chunks that are in closest proximity to the ship.

    Heres the question: To load that data (ie the two Vector3's representing where to instantiate the asset at run-time.) I need to pull it from somewhere. I could see this being a relational database of some kind, files on the disk, or, if I could guarantee having enough memory on the machine, just storing it in memory using some kind of data structure (perhaps an Octree) when the program is running.

    Of the methods I have listed, what would be preferred? As I would like to make this "galaxy" procedurally generated and fairly dense, I don't believe that storing all that data in memory will be ideal. Particularly when it is considered that I would like this application to be able to run on a tablet. So is there a good way to store it in a relational database (such as MySQL) and would it be fast enough? or would it be better to just store it in something like XML files?

    It's also possible that I'm overestimating the amount of memory that would be used by a bunch of Vector3's for object position.

    Thoughts?