You can build a grid of nodes and load only the tiles in your surrounding, as well as removing tiles you left. You should have different levels of detail of the map depending on the distance it needs to be displayed, which allows you to give the illusion that the whole map is loaded. And with that, use dynamic shaders for the textures instead of UV maps.
Technically, and if you play well with LOD, you could be able to give the illusion of an infinite world with a programatically generated map. Check the minecraft clone project for more detail.
so how would you go about creating the world so it fit into these perfect grid systems. each grid would have to be unique, so when start the game would you have to preload each unique grid piece and spawn them when the character was close enough?
To be exact, it would be 1 grid with meshes that compose the cells of the grid. It is important that the meshes are not preloaded (nor generated if it’s a dynamic terrain).
And then, yes, only the surrounding meshes must be loaded as the camera moves. You must also care about removing meshes properly. And there must be various levels of loading and instantiating. You can load a mesh in a separate thread, which means you must load a bit more meshes than needed, but that’s because you can’t predict in which direction the camera will move. But it’s important that when a camera enters a new tile, the surrounding tiles must immediately be instantiated (otherwise the player will notice it). And you have to do it for close range meshes (high res), middle range meshes(medium res) and far range meshes (low res).
I did already an attempt quite early and I did a couple of mistakes. First mistake was the texture. You must do it with shaders otherwise the textures will be gigantic. Be very careful about your meshes. You’ll have 2 choices to do it:
- split the large map in tiles, like I did in Blender. I even wrote a script to do the splitting.
- generate the mesh, with heightmap and other stuffs.
The first solution has the problem that the splitting is very difficult to do, especially for the collision manager. It’s possible but I had a lot of adjustments to do. Best solution: vertex shaders. Shaders, shaders, shaders, always shaders.
And the lights will cause you trouble too. You’ll see shadows and light artifacts at the borders of the tiles. I didn’t found a solution for that. But if you can add vertexes to an existing mesh, which means you don’t have really a grid anymore but more like a map of vertexes, you won’t have the problem of the lights. However I don’t know if it’s possible to add vertices to an existing mesh in the runtime.
Actually, after I noticed the project was a bit too difficult for me, I decided to create rooms instead of an open map. It works the same way, with loading and removing meshes, but it’s easier because the player don’t see far away. And interconnections are hidden with doors, which makes it much easier too. And that’s my current project. Thanks to that, I can create a map with a theoretically unlimited number of rooms (but it’s boring when it’s always the same 3 rooms. I need to make hundreds kinds of room).
Gokudomatic2 | 2016-05-20 18:21