Which is the best way to decrease the lags of the game?

Which is the best way to decrease the lags of the game?
I’ve developed for a pretty long time but I don’t know how developers of games like Jailbreak, Adopt Me or Fireteams made their games so smooth, even tho it has a pretty big map. Is it because they are using meshes, unions or the parts?

If I am only using Roblox Studio for developing, how should I make my game less laggier? :thinking:

3 Likes

Hey! I’ve checked some of them too! But I couldn’t find any solution, they didn’t help me making my game less laggier.

3 Likes

Alright, it’s best to use meshes instead of parts, never use unions unless you absolutely have to, and of you’re still having trouble, make sure you’re being efficient with your scripts or reduce the detail in your map.

2 Likes

Reduction of triangles used in a map is necessary and many more:

1 Like

For parts that you are done using, union them. Start making them unions if you are not going to edit that part of a build, you can also make individual parts unions to reduce mass amounts of lag in games. I am not sure if meshes might help, I doubt they will cause lag.

So my solution is, use unions and experiment with meshes if they will cause lag.

1 Like

But unions are risky because they get corrupted. It will lead to a big loss if they get corrupted. So the better option is to use meshes.

2 Likes

Hmm, I did not know about that. I have never encountered a problem like that while using unions.

1 Like

It’s very common and causes the unions to disappear when we play the game. However, it does not happen to everybody.

1 Like

Hey! Everyone has this question, it is a good one to ask. I am going to run over all of the possible things you can do to improve performance, starting out with:

1. Incorporate meshes.
This stages is not essential, but certainly helps. Lets say you have 500 parts, all to the same model. What you can do is, select all of them, then right click them in explorer. Go to “Save to file”, then save them. THEN, you can insert a meshpart, and set its MeshId to the file id. BOOM! You have just eliminated 500 parts, instead using just 1!

For more info on when to do this, you can see my article: Mesh Article

2. Decrease the work load on the Physics engine.
This one is pretty essential. Things like shadows, moving and unanchored parts negatively effect your game performance. To fix this, turn cancollide off for any parts you don’t interact with, and anchor them. Turn cast shadow off for any parts that don’t need shadows. This will help improve game performance, as the Roblox physics engine doesn’t have to compute them. You can also turn off shadowmap, and change lighting properties to make it easier.

3. Improve script performance.
This is a big one. Scripts that do a lot of needless work just take up memory. Try to avoid common errors, and make your scripts clean and easy. If you have ten models, each with the same script in them, that does the same thing, simply turn all of those scripts into one script. That way, the same script isn’t running countless times, under different models.

4. If you are using smooth terrain, eliminate any needless terrain.
Try getting rid of any terrain that isn’t seem. For example, say you have a mountain made of terrain. Hollow it out! It is less triangles/voxels/whatever for the game to compute, thus helping.

5. If you have a massive terrain map, turn on StreamingEnabled
This will help systematically unload and load terrain, depending on your distance from it. However, if you need to be able to see terrain from a long distance, I do not suggest this.

Those are all of the big things you can do. Basically, just try to eliminate waste, or things that don’t need to be there. That will help. If this is the solution, consider marking it, so people know its been solved :wink:

5 Likes

This goes backwards when the mesh is all too detailed(a lot of triangles, hahaha!).

This is very unspecific, but to be more specific, it is about being more memory-efficient when working with the script. If your code is expensive, your memory is eaten. If your code is badly patterned and encounters memory leak, your memory is slowly eaten.

2 Likes

Thanks for clarifying! When I say to turn parts into meshes, I say that because it narrows part count. While it is backwards for triangles, one mesh is 100 times easier to work with than 500 parts. Improving script performance can mean a lot of things, which is why I didn’t dive deeper.

2 Likes