Terrain Chunk loading

alt text

I am working on a project that create mesh chunks of terrain generated with procedural noise, and i tried a couple of ways which lead to, chunks loading in the distance before loading near the player and performance issues. So i needed some help. My questions are:

  1. What would be the best way to load and unload chunks even with a fast moving player?
  2. How can I prioritize chunk loading on player distance

Here are some ideas:

  1. Sort the chunks-to-be-loaded by distance and direction the player is moving. It’s more important to load chunks in front of the player than behind him. For distance, you can compute distance squared; no need to waste time on the square root operation.
  2. Load more chunks in front of the player, or more chunks in a larger radius around the player, so they don’t pop into view close to the player’s camera, and the game has a chance to load enough chunks in front of a fast-moving player.
  3. Pre-generate some terrain patterns and reuse them (perhaps rotating them for variety) instead of apply procedural noise at runtime. Or, if you really want to compute the noise at runtime, you could fall back to pregenerated chunks only if the loader is falling behind.