It’s no secret that many Unreal Engine 5 games have struggled performance-wise. These include older titles like the launch of Remnant 2 and Lords of the Fallen and newer games like S.T.A.L.K.E.R. 2 and Grey Zone Warfare. With tons of other games in between and more coming down the pipeline, those same people are a little worried about titles powered by Unreal Engine 5.
To answer these issues, the engineers of Unreal Engine have taken it upon themselves to explain them—specifically, game engine and shader stuttering. Kenzo ter Elst, Daniele Vettorel, Allan Bentham, and Mihnea Balta lent their expertise in a blog post and a YouTube video.
“Recently, there have been a number of conversations taking place in the Epic community around shader stuttering and its impact on game developer projects. Today, we’re going to dive into why the phenomenon occurs, explain how PSO precaching can help solve the issue, and explore some development best practices that will help you minimize shader stuttering.”
The tone from the beginning, while friendly, kind of blames the developer for not doing their work. “Shader compilation stuttering happens when a render engine discovers that it needs to compile a new shader right before it uses it for drawing something, so everything stops while waiting for the driver to finish compilation.”
From here, they let go of the high-level language and dive deeper into the incidentals. Explaining what shaders are, “programs which execute on the GPU to perform the various steps involved in rendering 3D images.” I strongly urge you to read the whole article for a more in-depth understanding.
The issue and the solution
As for the basics, these shader programs were previously compiled at runtime or while the game was in motion. Due to how few shader programs were actually in use over the years, this was generally not an issue. With the rise in shader code, the number of shaders executing during gameplay has caused significant difficulties as their numerosity and complexity have risen.
Compilation is taking source code written in a high-level language, like C++ or Java, and translating it into machine code. This compilation takes resources. Regarding shader compilation, this process is mostly the same for all intents and purposes. Pushing compilations like this during runtime increases the already large load being faced by the GPU.
Hitching occurs when these compilations surface during a draw request. Say you’ve turned your camera toward a new item or area that hasn’t been seen yet. A draw request is made to render the items on the screen, but if something in the frame uses a new shader, the shader is compiled at that exact moment, causing an elongated frame as the game waits or a hitch.
These issues can be minimized through a process called precaching. Drivers save compiled PSOs (Pipeline State Objects) for later use when a draw request is made. Rather than the shader recompiling during the draw request, the PSO is returned from the saved cache instead, skipping the compilation step.
The problem is that fetching a cached PSO can still take time if it’s not already loaded into memory or RAM. This first request of a cached PSO can cause microstuttering. Storing it in RAM has its own issues if the allocation exceeds what is available or what is beyond a typical use case.
If you’ve ever wondered why S.T.A.L.K.E.R. 2 requires extensive shader compilation at startup on a Windows PC, this is why. The process is necessary to reduce the hitching that would otherwise occur during gameplay. As it’s an open world, S.T.A.L.K.E.R. 2 does all the precaching at launch rather than between levels like something that isn’t an open world.
Although the process is different during the initial launch, the following launches are more of a PSO warmup of sorts. A full compilation does not need to occur again until a driver or game update occurs. What does that mean for consoles?
The difference between PC and consoles
Much of the issues outlined are particularly offensive on Windows PC, where multiple GPU configurations, drivers, and other hardware configurations must be considered. As for consoles, these issues are less persistent because they have a single target GPU.
Individual shaders are compiled directly in the executable code shipped with the game. Compiling the shaders at launch is unnecessary because it’s already baked into the game’s code. Shaders are turned into PSOs at runtime, so PSO hitching doesn’t occur on console platforms.
The future of Unreal Engine
Epic and their Unreal Engine developers continue to work on their precaching system. In their own words, “It still has some coverage gaps and other limitations, so there are ongoing efforts to improve it further. We’re also working with hardware and software vendors to adapt drivers and graphics APIs to the way games use these systems in practice.”
In the future, Unreal developers would like this precaching system to happen automatically and optimally to prevent these hitching scenarios, removing the responsibility currently placed on developers. What that timeline looks like is anyone’s guess, but with titles like the next Halo and Witcher games using Unreal Engine, we need this tech sooner rather than later. Heck, we needed it yesterday.
These aren’t the solutions to every form of hitching either. Things like excessive spawning or stream-in, synchronous loading, and other devices can cause hitching and stuttering. Games like S.T.A.L.K.E.R. 2, even with precaching, aren’t free of issues. Two items I listed before, like enemies spawning and synchronous loading of areas, cause many performance issues on all playable platforms.
These issues are more easily overcome with a better CPU or GPU found on a Windows PC, whereas a console needs far more performance passes due to the lack of achievable power. Sure, many PC gamers may have a weaker system than a console. Still, they can lower settings or mod in better optimizations for the game that aren’t available on an Xbox or PlayStation. Even then, games like Grey Zone Warfare would be utterly unplayable on consoles at the moment, given how demanding the title is on even the best PC hardware. You can only lower settings so much.
With the plethora of performance issues many Unreal Engine games face, players face a serious worry as they watch games unveil that they’re using the engine. It may be anecdotal, but I remember when players would get excited about an upcoming Unreal Engine game. Now, I don’t see that same sentiment.
Instead, I read and hear about the worries gamers have. They fear a monopoly that Unreal Engine could possess. It stresses gamers when games like Witcher 4 move from their in-house engine that powered beautiful titles like Witcher 3 and Cyberpunk 2077. If REDengine isn’t safe, what is? Why are they even moving?
Well, it’s a two-fold problem. On the one hand, using a tool like Unreal Engine opens the pool of developers from which a studio like CD Projekt Red can pull. You lower the onboarding time required to get someone up to speed if they’re already familiar with the technology being used. A licensed engine also frees up the costs and time associated with developing an in-house engine.
Look at Halo’s Slipspace Engine. The rumored cost of development for both the game and engine is in the range of $500 million. With standard development costs of AAA games running in the 100 to 200-million-dollar range, you can see why even a company like Microsoft would choose to abandon in-house development and save a tremendous amount of money that could be better spent elsewhere.
It’s a sad reality but one that many game developers face as the cost of development continues to rise. When other engine makers like Unity are busy shooting themselves in the foot, it gives an even greater space for Unreal Engine to grow. Why not use what everyone else is using so you can use the same developers everyone else is and lower your costs?
I could rant some more on why I hate this prospect as well. A lot of Unreal Engine games simply end up looking the same because developers are too lazy to use anything other than default Unreal Engine settings or share standard asset packs. Even Avowed, a game that sets itself apart with a striking visual look, has that Unreal Engine feel.
More studios will adopt Unreal as time passes, which will only compound this issue. Somehow, games like Remnant 2 and Nightingale had a similar visual feel, even though they were placed in entirely different world scenarios. I can’t explain it further, but they just felt too similar.
Here’s to hoping studios both improve their skills and start to branch out on the engines they use. Kingdom Come: Deliverance 2 has proven that an engine like Cry Engine can still power next-gen titles. It both looks awesome while running exceptionally well across a multitude of PC setups and consoles.
What do you think? Are you an Unreal Engine 5 fan? Do you want to see more studios using Unreal Engine 5 but simply approaching development more optimally? Let us know below in the comments or on social media. I’ll be sure to check out what you have to say.