UpdateInstancedClusters consuming a lot of CPU time because of a lot of models, even when aprented to nil

My game is Conquest 2, a RTS game; when we first made a grand event with a lot of people spawning their units, the lag was especially big, when I checked the micro profiler, it resulted that the main cause of it was “updateInstancedClusters2”.

Now, I would kind of understand as “a lot of parts make instanced clusters have problem”, though I would really want to know why this is so inefficient. Anyways, the main problem is that even when round ended and the models got cached (my game does not destroy the models, it sets their parent to nil and cache them to be reused) updateInstancedClusters was still consuming a lot of CPU time, even when the units models were not actually parented to workspace.

System info:
Windows 11
Ryzen 7520U
Integrated graphics card (Radeon 610M)
8GB RAM GDDR5
SSD 512GB

Expected behavior

I would expect it that, even if updateInstancedClusters taking a lot of time is normal because of the amount of units, it should at least not require that many resources when the units are cached / parented to nil. If possible i would like an explanaiton about why updateInstancedClusters is too high

A private message is associated with this bug report

1 Like

Do your models have a lot of individual parts? If so, this might answer your problem:

Unfortunately, it doesn’t look like adornees are optimized to deal with tons of parts and doesn’t get any cheaper efficiency wise when caching these models. Personally, I would try to find a different method to optimize part counts if this is the case like using custom meshes or unions.

Interesting. My game units models are made of 2 meshparts only, but I use 6-7 parts to emit particles when attacking. (My game is based on the napoleonic era, and units are blocks of 12 men packed together)

Would attachments be a more performant alternative for the particle emitters, in order to reduce the time of updating instanced clusters

Another related comment. I doubt this caching issue is fixed though…

It is indeed really annoying; my game could support a lot more if it was not because of this issue.

Last time I talked to the engineer, he said it wasn’t a high priority issue for them to fix, since it doesn’t affect a lot of games even though they wanted to fix it years ago. However, he also said that making a bug report can get it fixed faster and easier so.