Help with render distance

Alright, so I’m in the progress of developing a custom draw distance script but I am encountering an issue in regards to how I should make it work. Should the map be immediately stored in serverstorage and be unloaded by default, then when the players spawn in it would run a localscript that would individually load and unload parts based upon the distance between the player and the part? If this is the recommended method, how should I do that if I have cars in the map? If there’s another method, what is it so I can have cars work within the server and on client side, and continue to exist with its physics whenever the map around a car is no longer visible when no player is near it?

Hopefully this makes sense, I’m kinda stumped.

4 Likes

I made a chunkloader once.
This might be kinda long but I’m on mobile so sorry for bad formatting.

The other method is to load everything into the replicated storage when the games loads, then put it into workspace.

This will make the game take longer to load but will significantly speed up render distance changing time and make loading in models much faster.

You also need to be aware that it won’t replicate to the server so if you destroy something client sided you need to let the server know and the server needs to tell all the other clients to destroy it.

Additionally, if you use the server storage method you would have to use events to send data to the player which could get messy and take even longer as sequentially moving models to replicated storage wouldn’t work.

As for cars, you will need to make them something that the server automatically replicates. The easiest thing to do is just to not include cars in the render distance system. If you really want to you could make a system that constantly updates the position of other cars, loads and unloads, etc but this could be quite the hassle and causes more replication issues.

TL;DR: Use replicated storage instead of server storage, and let Roblox automatically replicate cars and other objects that will be difficult to manually replicate with your own render distance script.

3 Likes

Thank you, that answered my question in a sense. I am still confused in regards to the cars, so could you elaborate a bit on what you mean by “letting Roblox automatically replicate cars”? Also, would this mean that the cars won’t fall when the map is cloned into replicatedstorage and deleted from workspace?

1 Like

What I meant was let Roblox handle it. As for not falling through the map, clients will likely be doing physics calculations for cars, telling the server “Hey I am at X Y Z” and the other clients get told “put Bob car at X Y Z”, so normally it won’t fall through. Might have to do some experimentation though. If you do encounter any issues, all you have to do is CFrame it to the location the other client says it is.

So whats air for you is solid ground for another player, they are just telling you where to put your copy of their car.

1 Like

Ahh, that makes sense. Thank you so much!

1 Like

@plasma_node I got the render distance to work (But I don’t have cars to test it on yet)
I used replicatedstorage, and I also got the game to organize parts based upon how close they are to other parts and group them like they are “Chunks” and the render distance script works so well and so fast (Btw, I told it to not involve the triangle terrain into the render distance but I need to work on telling it the other terrain components to single out):

Thank you! Still need to script a car to test it though, but it’s turning out great.

1 Like

Cool!
Let me know if you encounter any issues with cars. I haven’t tested chunkloading out for a while and am not sure which option I have suggested will work right off the bat.

Also unless you are setting a manually adjustable render distance via settings, make it automatically scale with the client’s render quality setting.

1 Like