updateGeometry, finalize, and generateBatchGeometry in the MicroProfiler

Im attempting to fix severe lag in my game when a server has run for a long time.

The microprofiler is giving me data that shows the issue but I can’t tell what it means/which script it comes from


I wanted to use studio to find the problem but it appears only to be an issue in servers with people and activity

It also only happens every other frame which is even stranger.

So i guess my question is what does updateGeometry, finalize, and generateBatchGeometry

4 Likes

I don’t know what updateGeometry , finalize , and generateBatchGeometry mean, but they sound like something to do with the physics engine. Since your game is an obby, it’s possible that the amount of parts is causing lag in the game. To fix this, you can:

disable part collision, can touch, and can query when possible
turn off cast shadow for small parts or parts that dont need shadows
set the render fidelity of unimportant mesh parts to performance
set the “Technology” property in lighting to compatibility or voxel
make a local script to remove parts from workspace when the player is far away from them

Since the lag is happening only every other frame, it’s also possible that it could be caused by a script. Try using Ctrl + Shift + F and search “while” to look for while loops that could be causing lag.

1 Like

We’re also having this issue in our games, and its exactly how you described it. It only happens when there are a bunch of players in the game. Did you figure out the problem?

2 Likes

As far as I could tell from other forum posts and some studio tests, it happens when a model with a bunch of meshes/parts inside of it has a change applied to it. It invalidates the cluster and needs to be rebuilt and cached again. ensure your map is not a single model OR don’t make changes to often to a big model with a bunch of meshes inside of it.

Again this is just my understanding of it and I could be wrong.

I tested this by spawning my character in with 200 different accessories, the game lag spikes any time I change anything about him visually such as adding another accessory or even changing the transparency of one of the hats.

Further research seems to point at this being a humanoid related thing, please see my later post.

2 Likes

Alright after some more research it seems to be related to humanoids, any basepart changes inside of them causes them to rebuild.
But if they are outside but still welded to humanoid its no problem.

From now on, ensure you aren’t updating something inside your character too often, if you need to add accessories, try adding them to workspace and then weld them to the character.

2 Likes

This is very useful. Thank you

1 Like