Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

Lag Reduction with building. How to do so, and any tips?

Asked by 6 years ago

This has been a great problem that happens to a lot of people, and I was wondering if anyone has any tips so that I wouldn't make my models/meshes/unions causing a lot of lag. I am just concerned about the models/meshes/unions, not script.

0
0
Don't forget to accept the answer If it helped you. Zafirua 1348 — 6y

1 answer

Log in to vote
2
Answered by
Zafirua 1348 Badge of Merit Moderation Voter
6 years ago
Edited 6 years ago

Since this is a very vast topic, expect a long answer.

Lag was, is, and always will be the enemy of a Developer.

The first thing you always want to keep in mind is that everything that is in the studio are the source of lag. This includes even 1 Part which you inserted in the Workspace. That 1 Part is causing lag. Of course since it is 1 Part, it is going to be very very very very small. As you implement more Parts to the Workspace or just game in general, it is going to generate more and more lag, gradually.

Now before going on explain about different types of lags, we first have to identify what kind of lag is it?

There are generally a lot of types of lags, but I am going to narrow it down.

  • Latency Lag

    • Consider this as the main type of lag. Latency lag occurs when the Local Player is very far from the Roblox Server. Say I am living in Seattle and the server I am playing in is from London, I am going to be experiencing tremendous amount of lag due to the distance factor. This is generally the most common type of lag. You cannot really decrease this type of lag because this strictly depends on server and player's location.
  • Part Lag

    • So this is the type of lag which deals strictly with Parts. When there is generally high amount of Parts in your game, it will generally delay the run time process. However, this again has couple factors inside it again.

      • How much parts are there?
      • How concentrated are the parts?
      • Are they Anchored or not?
Since this is the main issue, I will be going on details here. There are more lags which will contribute it overall as well. I will not go into to much details on that.

"How much parts are there?"

This, again, strictly depends on a person's computer. If a person is playing at a high-performance computer, they will have no problem playing a game with around 30,000 Parts to around 50,000 Parts. Of course this is all just approximate, Meaning, I could have a high-tier computer and still face lag because it could possible be a Latency Lag.

"How concentrated are the parts?"

This, is the, might I say, the main factor you want to consider. How concentrated are the parts?. Say I have a two place.

A: One place has 10,000 parts and is spread apart, anchored.

B: Another place has a 5000 parts but it is heavily concentrated.

In a situations like this, the B is more likely to lag more when we look at it. Else, A is more likely to lag. Slightly more.

"Are they Anchored or not?"

When a Part is not Anchored, roblox physics has to play in role to make it "realistic". Now, this is not a significant issue when you have only limited amount of parts. But if you have 5,000 parts, then you will suffer. Terribly.

Which is why: Always Anchor your parts. If it is a special case, I suggest you Un-Anchor it from the script and revert it back after the "animation" is finished.

Solutions.

So. What can we do about it?

  • Unions? Are they really the best solution?

    • If you had asked a question to different people, you will notice different answers. Why? Because it generally depends on what you want to do. The thing about Union is that, it isn't loaded by the server. This responsibility is given for client, i.e., the Local Player. Now, this is not a specific answer because sometimes, you might want the client to have their experience the best instead of server. In cases like this, you would want to avoid using Union. However, if the server performance is higher priority for you, then you would want to stick with not using Union. Now again, this is for a large amount. Having a mere 10-100 Unions will not effect drastically.
  • Streaming Enabled? The only solution?

    • Streaming Enabled or Network Streaming, is a roblox feature that allows the parts to only be generated when it is required to do so. The best example of usage of this feature is Apocalypse Rising. Streaming Enabled takes into account of the Local Player's view. If I was facing to the North, the game would load the Parts located in the North. Elsewhere, it wouldn't load to the Client.

    • Now, do keep in mind that Streaming Enabled do have some of its cons. It isn't very stable at all. It can sometimes backfire and cause massive lag instead.

  • The Best Solution, in my opinion, is to try to cut down the number of instances used. If you find yourself using the same parts more often, make it a union instead, since Union has to calculate Shape and Collision Data for the Union you created. It downloads one for each different Unions so it is best to reuse the previous Unions. Try not to make your places high-detailed on just one area. That will be too much for a player to handle looking at. Spread it apart more.

Of course, you aren't entitled to be limited to the options shown above. You could research more and come up with a new solutions. In conclusion, I will leave you with some resources you would want to take a deeper look at for more insight.

Resources

0
thx greenhamster1 180 — 6y
0
No problem Zafirua 1348 — 6y
0
So if I’m building a stadium that is all anchored, and packed, should I use meshes and unions? User#34371 0 — 4y
Ad

Answer this question