Reduce lag in Voxel game (Need Help)

So I have been trying to make a block terrain generation game. I’m trying to make the map atleast 10K * 10K blocks but the lag is intense i have seen other people do this with sucess. I have been trying to do chunk loading with streaming enabled and some other people have told me to do this using tables and stuff like that but i cant come up with any code for it.

Voxel game

Does anyone have a system or solution to fix this?


Well there are several ways to reduce lag:

  1. Remove the terrain that you don’t see
  2. Enable streaming (for more informations Content streaming)
  3. Disable Cast Shadows in the parts that doesn’t need shadows
  4. Optimize your scripts
  5. Use meshes (how to create a mesh from a building you did in studio meshes)
  6. Optimise the collions box (for other building tips here)
  7. Remove Can Collide to parts that you can’t touch

Hope it helps :slightly_smiling_face:
PS: Sorry for the bad English :neutral_face:


Do meshes reduce lag compared to a normal part?

Yes because meshes have a lower triangle cont

1 Like

Thanks alot tho ill check it out :smiley:

Do you by any chance know how many triangles an ordinary roblox part has?

I’m pretty sure Roblox’s built-in frustum culling already removes all terrain that the player can’t see.

1 Like

I recommend checking this page about Improving Performance of your game

Yeah i have experienced that but im using part cubes kinda like minecraft

If the player won’t be able to modify the aleready existing terrain, you can add a density system to your map generator to avoid creating lots of blocks that won’t be seen

Parts are also frustum culled as well. Here’s a good video demonstrating it by Clonetroper1019.

1 Like

Yeah the player can modify the terrain btw What is a density system?

Is a way to avoid generating parts under the visible terrain so the client doesn’t have to use extra memory.

How would i do this if i want underground terrain and cave systems aswell?

For the cave system you can use Perlin Worms, and then you can make a script that generates parts when the player digs a block, like Mining Simulator did, there is a tutorial for that, you can check it here

1 Like

But wouldnt this eventually cause lag in the long run?

If the players mine lot of blocks yes, but keep in mind that is a better option than instantly generating all the parts.

Yes. This is very helpful but players would be able to see that its only 1 layer if they glitched trough the map. Should i just do 2 layers or just 1 ?

No I don’t. I don’t know how many tringles a part has.

Well I tested that out. I made a terrain invisible to the players, I played the game and the terrain was still there. (I saw the terrain by a camera part that I inserted)