Chunk System System Without Lag?

How do I make an Chunk System system without lag?

I know various games have them (Jailbreak, Apocalypse Rising, etc.), where if you go in certain distance of objects they will appear, otherwise they are completely gone on the client

But wouldn’t making all those objects appear instantly cause frame drops at times? Which defeats the purpose of a chunk system anyways.

How would one go about preventing this?


It seems like you are talking about StreamingEnabled. StreamingEnabled basically loads in the objects as you play the game. You can find more about it here.


My advice is to not create your own, @Maximum_ADHD has gone into detail about why chunk systems lag. Instead, use Roblox’s built-in StreamingEnabled property.


IIRC, there is a game, Terminal Railways, that I used to work for that used to have chunk loading but it was taken out. When I played it during that time, I’d experience a sudden pause in gameplay that would last about a second whenever it loaded chunks.

Here is a perfect example of a game that is entirely loaded in chunks:

Test this and see if it lags. The key to lag-free chunk loading is not loading the chunks or parts all at once. They are staggered, as you can see in this game.


Correct me if I am wrong, but that terrain seems like it is being randomly generated.

There might be a difference between randomly generating terrain and just saving.

I might be mistaken, but with random generation, the only thing in memory is a simple elegant formula.
With just saving, every detail is in memory.

Then again, I guess the degree of how much the memory has an effect on the game would depend on how detailed your save is.


Yes, the terrain in that game is randomly generated (it’s actually deterministic but looks random). But the point is that to prevent lag, the chunks must be small enough and not generated (or loaded) all at once. There is a slight delay between chunks of 64 blocks.