I'm trying to make a voxel-based sandbox game like Minecraft but can't add culling

I’ve been making a Minecraft clone for the past week and I’ve run into some issues. Mainly culling. Culling is like only loading parts visible to the client to increase performance.
This is a video of how the project is right now.


Building and terrain generation work, but culling is giving me a hard time.
Here’s how the system works:

If the player reaches a new chunk, a RemoteEvent is fired to the server to load the surrounding chunks on the server. Since there’s no culling, underneath the grass is empty space.

image
The image above is kinda misleading. the blocks are stored in a folder in ReplicatedStorage for client chunk loading purposes. I moved them up to workspace so you can see. The image on the right accurate tho.

On the client, the chunks are then moved from ReplicatedStorage to Workspace and the chunks closest to the player stay, and the chunks too far away go back in ReplicatedStorage.
image

This itself creates a problem because as more chunks load in the server, the script has to check more chunks at a time, impacting performance.

So about the culling, I can’t find a way to do that without cycling through every single block in the chunk (that lags alot!)

So on the server, I gotta just load the top layer of each chunk. The layers below dont’ even exist yet.

I have no idea how to add culling, since to do that, I have to make all blocks on the server, which causes a huge ping issue. And if i do that somehow and check on the client which blocks should be shown, I have to cycle through every block in that chunk folder which lags also.

Please help!!!

1 Like

Don’t really know much about this topic, but minecraft itself has “chunk coordinates,” which are coordinates that only change per chunk, not per stud/block

Idk, hope this helps tho
I might look more into this too, we’ll see

1 Like

Hello i am kinda doing the same
I got an idea but idk how to fix an error

1 Like

I used a table to kinda put all block in
but block near air wont be generated

1 Like

so how would i just put that all in a table, or use a multi-dimensional array?

if u want to collab on making it my discord encdata and i am making the same thing

Example of a table usage
its laggy but there is culling from 25600 block in chunk to from 256 to 600

And i am trying to make trees do u know how

i made them from code. i coded a tall line of oak logs, then coded a square for the first layer of leaves, a smaller square for the second layer, and so on

1 Like