Learning about built-in profiling tools in Unreal.
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
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 (
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:
- Frame: how long it takes for a single frame to render
- Game: cost of the game (logic) thread
- Draw: cost of drawing all the visuals
- GPU: cost of the GPU thread
- Mem: memory in Megabytes
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!