Dealing with Lag Optimization

I have a large scale open world map, where players can build persistent buildings across the entire map. I am running into an issue where the more players build, the laggier it tends to become.

With that said, I am primarily using low part count buildings. But, there are now over 24k buildings across the map, and lag is starting to take its toll.

Will turning buildings into meshes help reduce lag? I know it will reduce part count. I’ve attached an example of the kinds of things Players can build below.

Most of these are primarily parts, with some exceptions that include unions.

7 Likes

Hate to bump, but any thoughts?

1 Like

Try adding a limited building count? Or maybe have a script that splits the map into chunks, like Minecraft and unloads chunks or buildings that are far away?

2 Likes

A limited building count wouldn’t be possible.

As for the other idea, you mean StreamingEnabled?

2 Likes

I don’t know how to script, but I searched it up in the documents, and I think it might work?

1 Like

For what you have described “so far”, I highly recommend you to do these things below:

1. Turn everything into meshes: By turning into meshes, you will decrease draw calls, better optimized complex shapes, less textures calls, better polycount control, better LOD system control (RenderFidelity) and more.

2. Turn on StreamingEnabled: StreamingEnabled helps you load and deload parts of the map where a player is not in anymore. There are many settings of StreamingEnabled that have their own purposes/ dowside and you can find out more in the document here:

3. Optimize collision Fidelity: Use box and hull Fidelity as much as possible because these allow the CPU to calculate much less accurate collision results. I encourage you to try for yourself and see if enabling these collision calculation affects the gameplay at all, if not then use them.

4. DO NOT USE UNIONS!!!: I will say this here and clear, do not ever use unions if you want to your game to run smooth. Unions are cheap and skill less and a useless feature for making games. Why would you use unions when you can just make the mesh in Blender? Meshes offer much better control and performance then unions. Unions poly calculation also TRASH and will have many excessive polycounts for no good reason.

5. Turn off CanTouch, CanQuery and CanCollide as many as humanly possible: These three affects performance so turn them off whenever you can.

6. Turn off FluidForces on instances when not needed: This new Roblox feature affects performance so turn them off if you’re not working with aerodynamic.

7. Use less accurate lightings: Avoid using Future technology because it is the most performance consume lighting tech with semi-realistic light calculation (the most realistic in Roblox studio). If you’re not going for hyper-realistic visual, I do not condone the use of this lighting tech.

8. Models instances together: Models things together help with draw calls, rendering and much more. I will let an official Roblox quote speak for this fact:

9. Use StreamingMode LOD system for Models: The quote above mentioned about something call LOD so I will continue from there. Models have an LOD system that you can utilize to decrease your instances polycounts. If you are asking what is LOD then it essentially look like this:

As you can visualise, the LOD is short for level of details. The LOD 3 is when the model is in all of its glory and renders maximum details. As the player go further away, the models decrease the details therefore lower the polycount and lag for the game.

10. Keep your eyes on post-processing effects: Post-processing effects like blur, ColorCorrection are laggy when use intensively.

11. Decreases player counts per server: Decrease the players count will decrease humanoid, moving parts,… which helps a lot with the game server performance.

Newbie Tips:
1. Get rid of as much dynamic physics calculation as possible: Do this by get rid of weldConstaint, anchore your instances,… this means that you decrease physic calculation which is good for performance.

Advanced optimization (requires scripting knowledge):
1. Make a system to turn off Light.Shadow: By disabling Light.Shadow, the CPU doesn’t need to calculate dynamically the shadow casted by instances in the game. Note: (As we’re on the topic of shadows rendering) contradict to popular believes, disabling an instance.CastShadow doesn’t boost the performance of the game due to CastShadow not being designed with the intension to do so.
Resource for this claim:

If you have any question regarding performance for your game. I can’t be more happy to help :slightly_smiling_face: !

12 Likes

You were saying?

Besides that, these are actually useful tips and I utilise the lot of these and recommend builders out there to utilise them too.

Hi, not even sure if you’re still looking at this BUT.

I’m seeing terrain, which is a massive killer to games. I tell everyone the same thing, hollow out the terrain under the map (where people cant see) to lower the lag rate, it then becomes less dense and obviously in turn there is less terrain to render

It may seem unrelated to the situation regarding parts but it is not.

2 Likes

Ye, my bad i remember doing importing unions to blender but it didnt appear so I search on forum and saw someone talking about unions cant be import to blender but I guess back then I was serverely inexperience. Regardless, I have edited that part out from the post. Thanks.

2 Likes

Meshes would be best, also play around with streaming settings and Collision Fidelities on parts as when the game tries to calculate the collisions on a lot of parts (What is probably happening in your game) which lags out the game. If you set small, unused or less visible parts collision fidelity to Box, it will be easier on the game’s performance as it will have less collisions to calculate.

1 Like

add a lag reduce script where it reduces chunks or limit the buildings or how many there can be, you can use a plugin to see how many bricks/parts there are in the game.

1 Like

StreamingMode might help. But if you’d like a more advanced technique, create a script that constantly checks the player’s position, Once that’s done you can loop through all the buidings in a certain folder and check for their primary part’s CFrame, if it’s lets say 500 studs away from the player hide it in the ReplicatedStorage, and same goes for loading in them back.

Just don’t forget a task.wait() to prevent extreme lag.

1 Like

I remember the first time I used a while loop, it completely busted my PC lol. That was over a year and a half ago, now I don’t make that mistake lol.

1 Like

You see, there are some usefull tips and tricks to make lag less:

  1. Turn unions into meshes - unions are unoptimized region of the game, if you use few it’s not problem, but if it’s large map and objects are made from them, then you should export them into obj then turn into fbx in blender and import as a mesh

  2. Collision fidelty, if mesh will not be able to touch player, or this mesh is something like leaves ect. you should set it’s collision fidelty to box, it will make less calculations soo it will lag less

You can disable collisions for things that have no function, can touch and querry too, it will slighty improve performance on large scale

  1. Use less parts, if you can for example make one part looks like two it’s better to use that tricks, for example in shops you can make two sided shelves from one part for two shelves

  2. make textures from visible sides

  3. Make advanced rendering system, this is more scripting than building, you should make that every object on map is hitbox, and on client it renders rest, then if player is far away, disable object from visible soo it will don’t render, if player are near, enable it.

those tips are only few of possible solutions for your problem