Digging game lagging with many parts

So I am making a digging game but have come into a little bit of a hurtle, Whenever you dig down to around a depth of 160 blocks (each block is 6 studs) you start to lag due to the number of blocks

Normal
https://i.gyazo.com/e6f0cfb4cc905a0e9feffa29fe36d685.mp4

160 depth
https://i.gyazo.com/08026947268391a07e2cfe8181f0f7e9.mp4

Thanks

2 Likes

You could try making a script to only show blocks within a radius of 60 studs to reduce the surrounding lag.
I don’t really know how that’ll work though.

Actually, I already tried that but still seems to have lag
I’m thinking its my rendering function

But I’m not sure how I could make my rendering function render faster with the increasing list of blocks because the way it renders is it goes through all the blocks and if its close to a player it will render if not it won’t be so I’m just not sure how to make it faster

1 Like

Maybe a no texture option? Setting every material to SmoothPlastic.

At around 250 blocks it just becomes extremely laggy

Still happens
The max depth is 8700 blocks

1 Like

Try CastShadow or Rendering like said here?

If you already disabled shadows and everything then I dunno

Just to clarify, you’re only generating new parts as parts are being dug up, right?

Is it the script that’s lagging or not?

Try enabling Workspace.StreamingEnabled.

As @SubtotalAnt8185 has mentioned, If possible, I suggest you attempt using StreamingEnabled.

You can find this in Workspace under Streaming, this is a good way to get around this issue if your scripts are not dependent on existing parts as it will only load in chunks for the player.

Content Streaming | Roblox Creator Documentation

image

If you require extra help using StreamingEnabled, try this: Coding for Streaming Enabled


else, there may be another way around this, attempt using Paralell coding for managing parts.

Parallel Luau Developer Preview

I am not fully familiar with this, but it will make your codes spread out across CPU cores. I am sure of it being a very efficient way of dealing with lag, but with instances, I am uncertain.

Yes i have previously tried to turn off shadows and textures

Correct, i only generate blocks as needed

What if you tried implementing greedy meshing to reduce the number of parts?

So currently im trying to implement a new system so that the block database does not exist anymore and all of the data is processed as is needs to be and is not constantly being run through.

If this does not work ill try what you said, Thanks

1 Like

so what I did instead was got rid of the old system entirely and put a new system into only process the things that need to be instead of running through the entire table of existing and destroyed blocks every tick for every player

1 Like

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