How do you "actually" Reduce lag on already laggy places?

Now, I am a 100% sure that lag is one of the most common problems and struggles a developer/Builder usually has. Throughout the years I’ve been told been told by people to avoid making my places laggy by using Unions, adding fewer parts and models as well as avoiding very basic mistakes like accidentally duplicating something over and over again. Though I’ve tried my best to follow these very basic tips, It’s still been a real battle to “not make my places lag” especially for me, since I love putting a lot of detail into my builds.

My question is though:

How do I fix a place that already is pretty laggy and make sure it actually can handle around 25-50 People on a server without crashing?

I have this issue with my most important and recent project.

As you can see there are a lot of detailed structures in this place as well as an entire terrain built with bricks. I’d appreciate if you could give me your tips on how to effectively reduce lag at my place.

This is also partly because its such a huge Issue every developer has to go through.

Thank you.

38 Likes

Shift + F2 and Ctrl + F6 - Ctrl + P are your friends.
After having played it for a couple if minutes I can confidently say that the castle in the back is the source of your performance problem, too many triangles are drawn when looking in that direction and people with weaker computers will suffer from it.
Reducing the amount of triangle-heavy unions/meshes in the castlearea would help a lot.

43 Likes

For action gameplay, usually by using client side prediction and server side lag compensation.
If your server straight up crashes you’re using too much RAM.
If your framerate is low then the things you can do to speed it up are turning on StreamingEnabled, using simple meshes instead of objects composed of a lot of smaller meshes/parts, reduce the number of moving parts, using multiple of the same object instead of multiple different objects (instancing), reducing the number of triangles in meshes, and getting a better device to run the game on.

10 Likes

Okay. These building factors are the core lag causes:

  1. Unanchored parts needs to be simulated and lags quite a bit in changes of networkownership.

  2. Unions and meshes takes extra memory and causes issues with simulation sometimes.

  3. Dense/Concentrated parts within small area.

33 Likes

How does one reduce RAM use? I have a game where the servers crash pretty reliably after 3 to 6 hours

6 Likes

If your servers are consistently crashing after a specific amount of time, you might have a memory leak in one of your scripts.

7 Likes

Lag most of the times is careless use of remotes. Example:

When you press the “F” key, the character punches.

The bad approach: firing to the server when the F key is pressed and the server does the punch.
This approach results in latency which to most players appears as lag.

In order to combat this bad approach, you can make it so that when the F key is pressed, animation and sounds are played in the client (to tell the player his input was taken immediately and seem like no lag) and fire to the server for the Hitbox damage.

That way, this careless event usage is solved.

However, this is just one scenario of seemingly Lag. Lag can still occur for more basic reasons such as loads of parts, etc.
some players combat this by making their map load in chunks over a distance, that way not the whole map is currently loaded, only what you need at that time.

Hope this helped.

11 Likes

What Flostrus said is very helpful, when looking at the castle area, there are 5M+ triangles.

16 Likes

First thing is to diagnose it. If the servers slow to a grind and crash you’re running out of RAM. If it’s sudden, report it to Roblox as a bug. For even more details press F9 in game, then go to the memory usage tab.

5 Likes

Meshes load very much detailed structures, so yeah it’s one of the most elements that lag in ROBLOX.
avoid that element and keep building another cases of structures

3 Likes

Actually they load geometry (structure) of meshes, but they’re pretty “standard” I don’t think meshes contribute too much of the in game lag although it will delay the loading of the game, meaning some devices and old computers will not be able to enter.

7 Likes

Use meshes.

4 Likes

Streaming Enabled?

1 Like

A talk from RDC 2018 about improving performance:

17 Likes

I also find that unions often help with lag, try to union stuff such as doors. (Sometimes it’s better to use unions over models too depending on what it is you’re making, such as a wall)

1 Like

Hey! One really helpful thing I discovered is if there are parts that don’t need collision, disable CanCollide. If you have stuff that the player won’t be able to reach, by disabling collision to it, the engine won’t bother generating the collision surfaces for it, and would only focus on rendering it. Sacrifice unneeded detail whenever possible. Like others say, use meshes rather than complex unions. a simple export, triangle polish up in blender, and reimport should really improve stuff. Lastly, things like particles, loads or images, etc are very heavy on the client, so be wise when using them.

11 Likes

sorry to talk late Marcus i was busy xD i wanted to say that your comment was awesome and correct. they load polygons. sometimes they give a bit of lag but yeah. i preffer deleting excessive scripts, or so many structures. the structures can lag because if you see any games with excessive territory it lags, for me yeah only depending of your computer quality.

2 Likes

I used to believe this, but that is actually false. In fact, it’s worse. Unions actually are worse for your game in most cases than not using them. Parts are already extremely optimized, so if you don’t need the union for design reasons, do not use it.

4 Likes

Well I learnt something today, thanks for telling me. I always thought they helped as they reduce the surface area but I suppose not.

1 Like

Yeah, me too. It turns out they actually create way more triangles than just using normal parts. :slight_smile:

4 Likes