Split the world into chunks.
If you really have a world that large, you might want to do this anyway. I’m currently doing a game where you have a ship sailing over the ocean – since you can not look infinitely, (atm its 4km, i might increase this a little in the future) there is no need to have thw whole world loaded. I only need the visible parts of it. so i split the world into chunks of 2kmx2km and load alway the chunk the player is in and all adjacent chunks.
once a player maves more then 1/2 * chunkSize from the origin in one direction, he enters the next chunk. So i drop all now unneeded chunks (in fact, they were all cached for a while, in case the player moves in and out one chunk often) and recompute the players position and world position so that the current chunks is again centered in the origin.
as far as navigation goes – i store all coordinates as floats relative to their chunk. Inter-chunk navigation is pretty easy. I have a waypoint system that a vessel follows automatically. I store waypoints as floats (Vector3f) relative to the chunk its in. So you want to go from 0f,0f,0f @ Chunk 0,0 to 200f,0f,0@ chunk 0,1? no problem. i calculate ne sub-waypoint just outside of chunk 0,0. The subwaypoint would be (100f + really small value to leave that chunk, 0f, -1.000f [half size of chunk]). So my vessel starts to the subwaypoint, hits the waypoint & switches chunk and continues to the waypoint on chunk 0,1.
as far as interactions between chunks go – i’m still working on that. in my case, there will not be that many interactions. For mouse-pciking, im currently evaluation setting up a vertical plane at the sides of a chunk. When the ray hits such a plane, i will simply send a new ray on the other chunk from the point of impact on the plane.
But i have not yet really worked out how i will manage collision detection of two objects that are each very close to the edge of a chunk, but currently on different chunks, but close enough to collide. i’ll have to deal with it, though.
Thats only how I am currently handling my chunked world. if anyone has suggestion or better ideas, i want to hear it
i do not have much experience with chunked worlds, so i would really appreciate any input