I am making a game like minecraft, but I was wondering if someone could show me how to make a ‘CunkLoader / Unloader’ for my game.
If you need the code the the terrain generator let me know!
I am making a game like minecraft, but I was wondering if someone could show me how to make a ‘CunkLoader / Unloader’ for my game.
If you need the code the the terrain generator let me know!
I can’t say for certain, but I doubt separate chunk loader and terrain generator scripts could be made to cooperate. Essentially, the chunk loader needs to be part of the terrain generation algorithm itself. In Minecraft, a chunk is created, then data is filled by the terrain generation algorithm(s), and the chunk is loaded into the game world.
https://developer.roblox.com/en-us/api-reference/property/Workspace/StreamingEnabled
You can adjust the StreamingMinRadius
and StreamingTargetRadius
variables for the amount of studs you want loaded per chunk.
I have already done this and It does not work.
I already have this type of system what I want to do is make it so blocks farther away from the player get destroyed, and closer blocks get created
Did you configure the StreamingTargetRadius
variable to something smaller? 1024 studs is a lot of studs, which means you could possibly not notice the chunk load if you have a large terrain with multiple biomes.
I’d recommend lowering to blockSize * (amountOfBlocksPerChunk / (blockSize * 3)) * renderDistance
for the StreamingTargetRadius
(possibly the same value for the minimum streaming radius if you want that exact value on all quality levels).
e.g.: if you have a block of size 2.5, 2.5, 2.5, would like 256 blocks per chunk and a render distance of 8 chunks, this would be 2.5 * (256 / (2.5 * 3)) * 8
, which is 682.(6) studs. (You could modify this formula to anything you’d like)
Alternatively, you could also make your own chunk loader, using client sided handling.
This means that when the client gets close to a different chunk in a three dimensional grid, the client requests the server for the blocks in that chunk, whereas the server returns the client a table with all of the blocks, used by the client to then load the chunk. Once the client is far from a chunk it currently has loaded, it then deletes that entire chunk locally.
This can be done using magnitude
.
What is StreamingMinRadius for?
The
target radius
property controls how far away from the player’s current position new regions (terrain and instances) will be streamed to the player. Once the search radius reaches the target distance no additional regions will be streamed.
The minimum radius property controls the minimum collected area that will always be sent with high priority. When a player joins or teleports to a new location regions within the minimum radius (critical content) will be sent first with high priority. Target radius should be greater than the minimum radius. If target is less than the minimum then the minimum radius will be used as the target.
While these values are specified in units of studs, internally we search by regions, which are 64 studs to a region. So attempting to set fine stud level control will have no effect since it is effectively quantized to multiples of 64 during the region sweeping.
The search for unsent regions is performed in a rectilinear manner, not spherical as the name radius would imply. When the server is checking for regions in radius ‘r’ it will search from (-r, -r, -r) to (r, r, r).