- Home /
Huge world without huge lag?
Hello all. I'm making a pirate game where you sail the seas as a pirate. The world would be composed of meshes with height maps to simulate islands. In total, the world would be 50 - 60 of these height maps wide, and 50 - 60 of these height maps long (world map would be flat, so I'm not trying to make a sphere with them). Each of these terrain pieces would have 128x128 vertices on them. And each vertex would be roughly 3.9 of unity's units, or in the game terms, about 230 feet. In total the map would be about 340 miles^2. Inside these terrain maps are harbors and stuff populating them. I have already made the terrain generator, problem is, how do I go about making all of these terrain maps without killing any computer that starts the game?
Here is what one of the terrain chunks looks like:
So basically I would need 3600 of those chunks. Quite a ridiculous amount if I do say so myself. I know it is possibly because I have played Just Cause 2, which had a map more complex, and larger, then the one I am setting out to create. So at long last my question is, how would you begin to optimize something like this? To my knowledge all I can do is make so you don't draw the other chunks, but the memory strain from their existence alone would be incredibly lag inducing.
Answer by SilverTabby · Sep 24, 2011 at 04:53 AM
I'm not sure if this is going to be terribly helpful, but try this:
Render the chunk you are on, and the chunks directly bordering your as normal.
Render nothing but the terrain and large objects on the chunks bordering the ones bordering the current one.
[ Alternate method: Use a Near Camera/Far Camera system for the nearest chunks like in the 3d platformer tutorial ; might be easier with same/better results ]
For all other chunks, save that chunk and everything on it to a file (using System.Serializable or some other method), then Destroy() them. When you need them back, just read back that file and recreate the objects in it.
Luckily it takes roughly a $$anonymous$$ute or two to go between chunks at the fastest speed, so loading would not have to be done often. Thanks for the idea, I'll test it and see how fast it runs and then comment.
Your answer
Follow this Question
Related Questions
No Procedural Terrain without lags? 2 Answers
Out Of Memory With Mesh Generation 0 Answers
Can I use bytes instead of floats for vertices? 1 Answer
Is Terrain Optimized? 1 Answer
Memory problems with procedurally generated meshes 2 Answers