`buildSkeleton` operation hanging render thread causing frame spikes

Our game is experiencing an unusual long waiting time for the render thread during the duration of a projectile shooting. As far as we can tell, this only occurs to certain projectiles out of the many hundred available in our game. It’s a fighting game with a bunch of abilities and whatnot but none of those are really causing frame spikes, for some reason these specific projectiles are. We use the FastCast library to handle them, and it’s the same for all projectiles.

We put debugging profiles for the microprofiler in place to make sure it had nothing to do with the raycasting operations and whatnot, and it was true as you can see from this microprofiler log attached below. Instead, we found that the increased waiting time each frame was caused by an operation profiled as “buildSkeleton”. I am not sure what could be different about these projectiles causing this issue, they are basically the same as any other.

One of the projectiles is a basic arrow mesh, it is not a skinned mesh or anything of the sort. The other one that we currently know causes the same “buildSkeleton” operation to hang is a projectile that is a skinned mesh; however, this projectile gets parented to a folder specifically made to contain projectiles, as I’ve seen other forum threads mention layered clothing/skinned meshes causing similar frame spikes when parented directly to the DataModel, but that is not the case here.

This issue first arised only for specific devices as far as I could tell, the next morning, I continued to find the culprit and ended up having the frame spikes myself, which was surprising first considering that it wasn’t happening just last night, and that my PC also has fairly high specs (3070 Ti, 32GB RAM, i7-12700K).

microprofile-20241102-170757.html (2.9 MB)

This issue was caught by another developer on the team @Synteuro.

Expected behavior

buildSkeleton to not be causing frame spikes

2 Likes

Hello, I just wanted to add on that one of the projectiles that we know cause this frame spike so far was added a while ago, and it did not have this issue in the past. The arrow projectile is new, we added it for an NPC as part of a Halloween-related update.

There is a distinction between Models and Folders, Models are for 3D elements while Folders are purely hierarchial. I believe rig skeletons are only contained under Models, have you tried switching to using one instead? You could also try having each projectile be in a Model to further contain the skeleton.

1 Like

That’s a fair point, I’ll make the switch to using a Model for the projectile container itself and see if there are any improvements. In the mean time, we’ve moved over the affected projectiles to private server usage only and there has been a significant reduction in lag across our public servers.