Layered clothing causes lag spikes when updating unrelated part properties

Reproduction Steps

If a part property is changed under a character wearing layered clothing (LC) - including ones which aren’t related to LC and its wrapping at all like humanoid root part color - a noticeable rendering delay occurs. If this is done on every frame, CPU usage peaks and framerate drops. I assume this is because of internal recomputations related to the LC, but those should only be triggered if really necessary.

Open the attached place file
lclag.rbxl (221.0 KB)
and run it. Lag is initiated and paused in a 10s interval, as printed to the output. Lag is caused by the script in ServerScriptService.

Expected Behavior

No lag spikes caused by LC-unrelated changes to the character.

Actual Behavior

Noticeable lag spikes caused by LC-unrelated changes to the character.

Issue Area: Engine
Issue Type: Performance
Impact: High
Frequency: Often
Date Last Experienced: 2023-03-15 00:03:00 (+01:00)

19 Likes

This is a known issue that we are currently working on, thanks for your patience.

In the meantime. For accessory parts, if you move them outside of the character’s Model hierarchy, that should avoid the lags. For avatar parts that can’t be moved, you’ll have to avoid these property changes until we’ve finished our optimizations.

Related thread:

14 Likes

To add to this forum, I’m also having issues with layered clothing.
Playing and stopping an animation on a character who’s wearing layered clothing causes the device to lose frames. The severity depends on how detailed the layered clothing piece is, and I believe how fast the transition into the animation is as well.
Are you working on this issue as well? What timestamp can I expect this problem to be fixed by?

6 Likes

Animation changes should not trigger LC rebuilds. If you think it is, can you please post a new bug report for better visibility? Thanks.

5 Likes

Would like to add this:


it causes GraphicsTextureCharacter to increase overtime and it does not decrease. This only occurs with layered clothing and is a possible memory leak.


I found that the exact moments it increases is when I add a highlight to my character (not the actual roblox highlights but my own). I clone all the parts such as arms,legs,head,etc and increase the size, make it transparent, destroy all children, and weld it ontop of the original limb after setting the color and destroy it after a few seconds.

This did not lag my game prior and I did not make any changes to my character auras.

3 Likes

Can you please submit a new bug report for this too? Having multiple bug reports in one thread is difficult for us to manage as they may have very different root causes and may need to be addressed by different groups. Thanks!

4 Likes

I am unable to submit new bug reports.

I do believe this falls under the same issue though as its the same replication. I am just stating that when the lag spikes occur they dont go down implying it could be a memory leak.

4 Likes

We understand the source of the lags and have an improvement for that in progress, but we had not seen reports of a memory leak before this. They may be two seperate bugs, or it may be an issue specific to your setup. Do you have a simple test place you can share?

5 Likes

I made this test place. Pressing Q will create a character aura for 1 second. I encourage you to try this without wearing any layered clothing then try with layered clothing and watch GraphicsTextureCharacter rise everytime u press Q along with an fps drop.

Just so you know exactly whats going on as well. The character aura simply clones all the body parts and changes things like color, size, material, etc then welds it to the original part and parents it to that same part.

6 Likes

Hi Bedevere. I just posted a new thread regarding my issue. Below is the link to it. Please have a look at the problem. Thank you.

4 Likes

Can you please start a new thread for the memory leak issue? Thanks.

3 Likes

Like I said before I am unable to create topics in bug reports unfortunately but maybe someone can do it on my behalf.

5 Likes

Yes, I understand. Can you start a thread in Help and Feedback? For example:

3 Likes
3 Likes

I’d like to add to this issue that its severely effecting my games playability (and possibly a lot of others). The memory leak issue has been resolved but there is still SEVERE fps drops when parts are added to the character. My game (and a lot of others) has a weapon welded to your back as well as a weapon rigged to your hand (at least 1 is invisible at all times) When equipped the weapon in your hand turns visible and the one on your back goes invisible and vice versa when you unequip the weapon. Players are able to spam re-equip their weapon which causes unplayable FPS drops just by simply unequipping and re-equipping a tool.

(I also tested this with regular tools using just part handles instead of rigging anything and it also causes the severe lag spikes, this means players can lag games just by constantly re-equipping tools with layered clothing.)

What specifically causes the most lag is when parts are added to a specific kind of character in my game that has wings
image

The wings simply consist of an invisible part the same size of the uppertorso that gets cframed to the uppertorso then welded. Theres then like 3 or 4 sections of each wing that are motor6d’d together.
And yes this is the same issue as once I removed all layer clothing fps spikes wouldn’t occur so it is not a problem with the wings. The wings just amplify the lag with layered clothing for whatever reason.

4 Likes

Can confirm this is an issue. Equipping and unequipping a tool for example will cause layered clothing to rebuild. Sitting in a seat will cause it to rebuild. Rescaling a character through their scale values will also cause a rebuild. Any eta on a fix for this?

3 Likes

I do believe rescaling a character causing rebuilds is intentional. But I recently added a system in my game where when you talk to NPCs their mouth opens and closes which literally sets the transparency of 2 decals to 0 and 1 and even just that will cause noticeable FPS drops as it triggers the rebuilds every single time.

For a simple repro you can literally have a loop setting a dummy’s face transparency every second and equip that dummy with layered clothing and watch the FPS drop.

I wish we had a way to disable layered clothing rebuilds as I dont rescale the characters or change them in anyway that would even require a rebuild aside from initial spawning in. Idk why setting decal transparencies would even trigger rebuilds in the first place.

2 Likes

Hello to make this easier for staff to solve I updated my layered clothing lag test replication place to show how my use case is game-breaking and potentially help staff come to a solution quicker.

Instructions:
I recommend you use the blocky avatar although it doesn’t really matter that much. Also use a decal face if you want the face toggling to work. (and obviously wear as much layered clothing as you can)

Keybinds:
Q - adds an aura made of parts around the character then destroys it after a few seconds. This is how u essentially see the lag.

C - This is a toggle key. When enabled your faces transparency will change every task.wait(0.05) this is to show that something completely unrelated to layer clothing can still cause the rebuilds

X - This is a toggle key that will add and remove the exact wings I use on my characters which amplify the problem A LOT. I highly recommend you try this with the wings on just to see how bad it gets when adding extra rigging to the character.

B - This is a toggle. When active it changes the transparency of your lefthand every task.wait(0.05)

If you enable the wings and spam Q with layered clothes on you will almost immediately experience FPS dropping.

I appreciate any staff members time looking into this a lot! Hopefully this can help!

4 Likes

This issue has been happening to me for a while and it’s very frustrating, my game has rainbow accessories that are parented to the player’s character, with the color of those accessories being updated by the client, if the player happens to be wearing layered clothing, it causes very noticeable lag spikes.

5 Likes

was debugging a strange lag spike while equipping / unequipping tools today and led to this known issue :raised_hands: would there be an ETA on when the fix will be rolled out? it would be quite unfortunate that we couldn’t enable layered clothing due to engine performance issue :sob:

3 Likes