How does it work?
Upon loading the program a minimal set of data will be loaded, that is the road data of the immediate vicinity. As the camera moves through the world, data is loaded dynamically by these extra threads depending on where the camera goes.
So how does it know what to load?
In the initial loading stages basic information about each section of road is loaded including, but not limited to, a list of coordinates describing a line that the road follows. By dividing the world up into a grid, and noting which road sections pass through each square in the grid, you can use where the camera is and the direction it is facing to determine which grid squares are in view, or will be soon, and load as appropriate.
How does this get stored?
A quadtree (not unlike a binary tree, but with four children per node) seems ideal in this situation. The space can be sub-divided until each node holds a reference to only one road. This works especially well since the lines are stored as a list of coordinates, and not a continuous function.
What about the rest?
The reference id's of every topographic area are loaded at the start of the program into a stack. While the program runs, they are popped off the stack and loaded, one by one. By using a stack this also gives the opportunity to push any priority items onto the top of the stack, which can then be ignored later when they are repeated (repetitions are certain in this case, since we start with references to every item in the database)
Sounds like a sterling idea - make sure you've got enough forks, hehe :-)
ReplyDelete