Making a game less laggy without removing major details

Right now, the game I’m making crashes on my tablet because it’s a very large map with a lot of unions, meshes, and models to load.
I tried to think of a way to make certain models only appear when your device is above a certain memory amount, but there’s currently no way to see that.
So, just in general, is there any way to make the game less laggy? I don’t want to remove too much details, because then higher-end devices still get less detail than otherwise. If you have any suggestions, please tell me!

2 Likes

You might be able to make a localscript that renders objects when you are a certain distance away from them. Like a view distance I would say?

2 Likes

Yes, but doesn’t roblox already do that if you’re on lower graphics?

Edit: I also feel like that would require more memory use, because roblox does that already, and doing it a second time over probably wouldn’t help.

Graphics Quality 1 still has a very far view distance.

Is there any way to do it without making it look much different though?

I’m not very sure but Graphics Quality 1 only lowers the quality, not so much of the “render distance”. Every item in workspace would still be loaded in.

How would I make a script that “unloads” and loads objects anyways? I know I could do game:GetDescendants() and then check the distance from the player every second or so, but two things:

  1. It might cause lag going through everything in the game every second.
  2. Not sure where to temporarily store the objects, maybe replicatedstorage?

Edit: StreamingEnabled does this actually, just it breaks all the tools when enabled, so if there’d be a way to make it work, but also not break certain things that’d be good.
Edit2: Actually, just enabled streamingenabled, and it doesn’t look like it broke anything this time.

You might be able to use The QualityLevel in the user settings instance to determine the View distance that you want to be rendered by using magnitude from mabye each object in the workspace. I think that the QualityLevel is a readable Property of RenderSettings.

1 Like

You can Fix the lag for Mobile Players by using a Hide other players Feature and Hide Structures Feature. That’s the ways to able less the lag for Mobile Players without getting rid some Structures in your game.

Streamingenabled can help you in this situation. It unloads parts and objects.

1 Like

The problem is, if it’s set to automatic, it’ll show as 0 or automatic. I turned on streamingenabled though, and it seems to help with actual gameplay.
The biggest problem is bodyvelocities, and that’s mostly what’s causing lag.

(edit)

The lag is mostly gone, the problem was one very inefficient script that, instead of detecting player collision, it detected when the area was touched, to see if it was by a player with the name of the player’s textlabel. I fixed it now, and the script is a lot more optimized.

I’ll set yours as the solution, because it may help other people who want to make a similar system to my original idea know how to do it.