How to generate chunks in voxel game with less lag?

  1. I want to reduce lag, when generating chunks.

3.I have tried streaming, setting cast shadow to false and and making lower layers invisible.

Sorry for bad English.

1 Like

what are your computer specifications?

Are all the blocks not visible still being rendered? Like, are you hiding ones where all sides are completely covered?

I generate them with 1 transparency

When they are out of view, you should delete the block and instead keep it in memory as simple as possible:

{
    ChunkId = 0, -- Or a chunk position, whatever you use
    Position = {1,2,3} -- Chunk relative
    BlockId = 0 , -- Or a string for the name
    Metadata = "",
}

When a block is generated and deleted, update the blocks touching it’s sides to see if it should be visible.

Can you explain how to know that?

If there is a block touching all of it’s sides, it’s not a visible block and it shouldn’t exist as an instance at the moment. To detect if it’s touching, don’t use roblox methods. Use your script to get the block at a position relative to the original block.

Ok! but what is the best place to store the block data?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.