Hello reader, I hope your day is going well As the title suggests I’m after help regarding some performance “humps”. I use the word “hump” here because it feels like “spike” is the wrong word. You see, when I am play testing my game it suffers from frame rate drops that last for around 100 frames. This is what it looks like in the “CPU Usage” section of the (standalone) profiler:
This issue has been plaguing me for a while and so I’m really keen to get to the bottom of it. I’ll provide some more detail. The game is a 2d procedurally generated game, here’s a screenshot for context:
I’m sure a few of you reading may have read “procedurally generated” and then assumed that some content being generated somewhere is the cause. However I have mostly ruled this out by adding my own profiler stats to track ‘chunks loaded’, 'tiles built, ‘mobs spawned’, ‘lighting updated’, etc, for all the major sources of computation. These are all reading as zero during the hump and to make extra sure, when I’m attempting to debug this issue I just idle the character in one spot and wait. The humps just come and go with no changes to the scene occurring that I can see.
Now, why I think this is due to rendering/graphics performance is due to the hierarchy section of the profiler. During this hump period “PostLateUpdate.FinishFrameRendering” goes from averaging 3.5ms per frame to an average of around 16ms per frame. The specific culprit seems to be lnl_RenderCameraStack, with the various cameras all exhibiting a performance hit equally.
I have spent a long time trying to resolve this issue and I have recently discovered something, however I am not sure how relevant it is. Whenever this issue occurs I also get spikes for “vertex buffer upload in frame” and “index buffer upload in frame” The former goes from around 60kb during the good performance period to 400kb during the bad period. The upload doubles from 15kb to 30kb. Here’s what this looks like in the profiler in relation to the hump:
The red line is vertex buffer upload and the orange line is index buffer upload. Now at this stage I am unsure if this is a symptom of the issue or the cause, also interestingly the spikes never seem to quite line up with the hump.
I have very likely not provided all of the details each of you may be after in order to help me, so please feel free to ask for these details and I will strive to supply them.
Thank you for any help you may be able to provide, I’ve been chasing this issue for months and really need it.