Learning about built-in profiling tools in Unreal.


Profiling

Self-Checkout Unlimited is built in Unreal Engine 4.24 (UE4), and out of the box, UE4 is not exactly known for being well-optimized to support performance on lower-end hardware. As such, some of you might have encountered some lag or low FPS while playing the demo. To address this performance issue, we need to first find out what is causing it–what is computationally expensive, and how can we reduce the burden? We can begin investigating performance by profiling the game while it runs.

profiling is a form of dynamic program analysis that measures, for example, the space or time complexity of a program, the usage of particular instructions, or the frequency and duration of function calls

–Wikipedia

UE4 comes with a fairly thorough profiler, though activating it is a little bit obscure. While running the game in the Editor, if you hit ~ and type stat gpu, a shiny table with too much information on it that completely covers the screen will pop up. Alternatively, you can turn on a graph and some basic stats (stat unit).

Screenshot of beginning hallway with graph and basic stats of how long it takes per frame to compute the GPU and Game threads, among other various stats

The high-level easy-to-read stats are available on the right and visualized in the graph over time. The numbers on the right update every frame, so they flicker fairly quickly. A quick rundown of them:

We can see in the screenshot that GPU is definitely too expensive, and the Game thread is also fairly heavy. We’re over budget on how long it takes to render the frame at 47.05ms, as compared with the 33.9ms budget for a 30FPS game.

Read more about the stat commands: https://docs.unrealengine.com/en-US/Engine/Performance/StatCommands/index.html

Though not particularly detailed, this gives us an idea of where we need to look for addressing performance issues (unfortunately for us, it is in both the game and GPU thread, not just one or the other–at least the draw calls are fine!).

As we figure out how to fix specific problems, we’ll discuss what they are and solutions in future posts.

Very useful resource: https://unrealartoptimization.github.io/book/

Questions or Comments?

Feel free to send in any SCU or AG-related questions! Our Ask Box is always open.

Thanks so much for all of your amazing support, and stay safe out there!