MeshParts cause Engine Lag

The more MeshParts, the more lag when setting BrickColor for these parts locally. I’ve recorded a video that explains it. This also happens online, and it occurs on any quality level.

This has been happening ever since I added these dance floors to my game. I don’t know if other developers have noticed this? Perhaps it’s existed ever since MeshParts were introduced. It’s taken me awhile to debug and figure out that this is caused by MeshParts.

Repro file from the video: MeshPartBug-10-27.rbxl (28.0 KB)

3 Likes

Setting every collision to “Box” will make it no lag, there was something like this 2 months ago where Collisions were glitched, I think it is back? Not sure but it seems :confused:

I forgot to mention, most if not all of these meshparts are using Box CollisionFidelity.

Oh … Then it is a new bug, I hope they fix this as soon as possible.

This is not new and not unique to MeshParts - same for CSG, and even for parts. The more triangles you have clumped in a small area due to heavy meshes/CSGs or just many parts, the more expensive it is to change part attributes.

We are working on a new part clustering system that will resolve this and many other performance problems of the sort, however it literally means rebuilding the clustering algorithms from ground up - while this is work in progress, don’t expect it to ship this year.

18 Likes

This excites me. Can you explain how you’ll hope it differs and what kind of performance changes we could potentially see?

2 Likes

Instancing. No more reclustering of part clusters when changing properties like position, size, color, etc. And not just for parts - for meshes and CSGs too, in fact, any sort of geometry.

Less memory usage too.

5 Likes

Ooo.

So would Instance.new() and cloneing into workspace be a lot less laggy?

No, it’s a general 3D graphics term, unrelated to Roblox.

I didn’t mean that Instance.new meant [quote=“maxvee, post:7, topic:30211”]
Instancing
[/quote]

I was just curious if Instancing would be faster with the new upgrades.

There’s a difference between instancing objects in the game hierarchy (developers do this) and instancing geometry for rendering (the engine does this).

1 Like

Thanks for informing me. For now I’ll use use a SurfaceGui, which seems to resolve my issue.

1 Like

I’m not sure what you mean.

Right now certain operations cause what’s known as “reclustering”, which you can see in on-screen profiler in “Prepare” → “updateInvalidatedClusters” → “generateBatchGeometry”/etc. They happen whenever there’s a non-CFrame change in the part data, that is:

  • Additions/removals of parts
  • Reparenting of parts
  • Changing any attributes other than CFrame
  • Reconfiguring physics constraint/weld graph

The goals of the new system are:

  • Drastically reduce the time spent in Prepare → updateClusters for all aforementioned update types
  • Move most of the work that does need to be done to Perform so that scripts can execute in parallel with that
  • Reduce memory requirements due to geometry duplication that exists right now for cloned meshes/CSG/etc.
  • Do all that while keeping the “active” Perform time (Perform minus Present) reasonably close to what it is right now

We’re hoping that these goals are achievable on most ROBLOX content, but it’s too early to say if this is the case. This would help with performance and memory consumption, especially on mobile, with a caveat that this will require a rendering feature that is only available on ~70% of mobile hardware - current plan is to use the old system on old hardware.

5 Likes

I meant will removing, cloning, and instancing new parts/meshparts cost less in terms of performance, which you seem to have answered (thank you).

Is the 30% like iPhone 4 users or something?

Yeah, iPhone 4S and iPhone 5 pre-S. There’s the same 70/30 distribution on Android devices, although there I can’t know the hundreds of devices the new system will or won’t run on :slight_smile:

On Android there’s also a risk that some drivers will be terminally broken wrt the rendering feature we need but I’ll hope for the best.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.