How to Optimize a Game: Video Game Optimization Best Practices for Console
- What is Game Optimization?
- How to Optimize a Game
- Reduce the Batch Count
- Utilize Multiple Cores
- Profile Post-Process Effects
- Stay Away From Tessellation (When Possible)
- Aim for Healthy Wavefront Occupancy
- Utilize HDRP Built-in and Depth Prepass
- Reduce the Size of Shadow Mapping Render Targets
- Utilize Async Compute
- Console Game Optimization
- Consider Pingle Studio Your Trusted Partner
In 2021, 29% of 1,466 respondents to an online survey claimed that the Sony PlayStation 4 was their primary gaming console, with Xbox One coming in just under it. Though a general consensus does not exist on the best device for gaming, most users agree that whatever the device, they want the best performance possible. High-quality performance is why so many turn to video game optimization.
Not all game developers have a working knowledge of video game optimization, what it entails and how to execute optimizing a console game. Keep reading to find out the ins and outs of game optimization, the process, and who to turn to for optimizing console games.
What is Game Optimization?
During full-cycle game development process, a developer has many considerations, one of which is factoring in the hardware it will be played on when setting the parameters. Devices with hardware that is highly mutable, like the PC, can only optimize their games in a generic way. With consoles, the hardware is always the same, allowing the developer to cater the operation of their game to those unique and consistent specifications.
What is optimization in games? In short words, game optimization refers to a process in which the performance of the game is enhanced as it pertains to visual experience and gameplay. Elements of game optimization include resolution, detail, frame rate, and so on. Effective console game optimization requires that the game plays at a consistent frame rate across a wide array of hardware specs.
Game development is all about user experience. Situations in which game optimization might be needed are when game performance is suffering. Poor performance can include low frame rate, choppy or lagging gameplay, and poor-quality visual display.
How to Optimize a Game
The first place you want to start in optimizing console games is finding the performance bottlenecks. This involves locating a frame with a high GPU load; this is your starting point. Look at the GPU frame step by step and break down the frame cost into specified elements.
Reduce the Batch Count
Like any other platform, reducing the batch count is a valuable tip for console game optimization. There are two recommendations on techniques for achieving a low batch count:
- Occlusion Culling will eliminate unseen objects behind objects in the foreground in order to reduce overdraw. This process will require additional CPU processing. To assist with this, use the Profiler, so work moving from the GPU to the CPU is helpful. Dynamic Batching should be avoided on consoles unless you’re certain it would be beneficial to the performance.
- GPU instancing is helpful if you have a large number of objects that share the same material and mesh. Limiting these numbers in a scene can enhance performance. Creativity is key with this technique to avoid too much repetition within your scene.
These techniques are best used if your project utilizes one of the built-in renderers. If you are using one of the SRPs, then SRP Batcher will assist in controlling batch count by batching Bind and Draw GPU commands. To get the most out of SRP Batcher, use whatever amount of material is needed, but limit them to a few compatible shaders.
Utilize Multiple Cores
Some consoles, like the PS4 or the Xbox One, have multi-core devices to get optimal CPU performance. For optimal performance, those cores need to be kept busy at all times. In order to take advantage of PlayStation’s or Xbox’s multi-core devices, enable the control by navigating to Player Settings> Other Settings.
Graphics Jobs can optimize performance in nearly all situations on consoles, with the exception being when you’re drawing a small amount of patches. Enabling this control allows Unity to distribute rendering work across several CPU cores in two ways:
- Native Jobs, on PS4 and DirectX 12 for Xbox One, is the optimal option for large scenes and will distribute the most work across CPU cores.
- Legacy Jobs, on PS4, and DirectX 11 for Xbox One, will relieve some of the pressure from the render thread by distributing to other cores.
Be aware that this option may not be suitable for large scenes, as it may cause bottlenecks in the render thread.
Another option for utilizing the multi-core devices is using Unity’s new multithreaded system, DOTS. DOTS has three subsystems: C# Job System, Entity Component System, and Burst Compiler.
Profile Post-Process Effects
One component that can use a lot of your frame rate is post-processing effects. For this reason, it’s important to use post-processing effects that are authored for consoles instead of tools from the Asset Store that were intended for PC. These tools tend to absorb more resources than needed.
When you apply post-processing effects, be sure to note how long they take on the GPU. You can adjust these effects to accommodate GPU bandwidth, performance, and visual quality.
Stay Away From Tessellation (When Possible)
The process of tessellation is dividing shapes into miniature versions of that same shape. While this can enhance detail, it doesn’t always make sense for the cost of GPU. Instead, use the authored asset created by an artist that would be comparable.
Aim for Healthy Wavefront Occupancy
Sending a draw call to the GPU, also known as a computer shade dispatch, splits that work into several wavefronts that Unity will then distribute to the available SIMDs within the GPU.
Each SIMD allows for a certain number of wavefronts to be going at one time, which in turn gives you the max amount of wavefronts that can run parallel on the GPU at any single point. This number is referred to as the wavefront occupancy.
Pix and Razor display wavefront occupancy in great detail. If you see a lot of vertex shader wavefronts with little pixel shader activity, this can mean the GPU’s potential may be underutilized. In other words, this could imply inefficiency. Low wavefront occupancy isn’t innately bad, but it could be an indicator to optimize your shaders and check for bottlenecks. Doing so could very well be the solution for a game stall as a result of computing or memory operations. On the other hand, too many wavefronts can cause decreased performance and cache thrashing.
Utilize HDRP Built-in and Depth Prepass
A lot of overdrawing during Gbuffer pass is bad on a console when examining alpha-tested objects. If you write directly to depth in pixel shader or administer pixel discard instructions, you won’t be able to take advantage of early depth rejection.
The solution to this issue is to utilize a Depth Prepass, which would render the scene ahead of depth only, using light shaders, which can be the basis for smarter depth rejection, binding your heavier Gbuffer shaders.
HDRP built-in includes Depth Prepass for alpha-tested objects, but it also allows you to enable the full version of Depth Prepass. This change can be done via the HD Render PipeLine Asset. Once you find the asset, you’ll see an array of options to check marks that control every aspect of the HDRP.
Reduce the Size of Shadow Mapping Render Targets
The HDRP high-quality setting uses a 4k shadow map. The culprit to performance issues here typically lies with the resolution of the Shadow Map when rendering to Shadow Maps.
The solution is to reduce the resolution. However, this may have an impact on quality. Dropping the resolution to 3k provided a more acceptable balance between performance and quality. If you want to compensate for the loss in visual quality, you can make some changes to the light’s settings.
Utilize Async Compute
A method for reducing points of underutilization on the GPU with helpful compute shader work is Async Compute. This method is supported on both PS4 and Xbox One (2019 cycle). You can access Async Compute through Unity’s Command Buffer interface. Though this method is primarily used with SRP, it is not exclusive and is also available in the HDR PSOS and BOTD assets.
Async Compute allows you to run your compute shader alongside your graphics queue, which would normally be underutilized during the depth-only phase of shadow mapping. It is typical not to use the full potential of the GPU at this phase.
BOTD uses both Async Compute and SSAO calculations. Async Compute is used for its tiled light list gather, part of the deferred lighting, executed with compute shaders on the console in HDRP.
Console Game Optimization
If you’re looking to dabble in console game optimization, there are some best practices to follow in the process. Oftentimes, this type of work is outsourced to trusted partners due to its challenging nature. The process of console game optimization can be quite laborious, with very little progress at times.
For example, when using a profiler output and noticing the top function takes 3% of the time, that means if you’re even able to enhance this function to run two times as fast, the entire program will only run 1.5% faster than before. This type of scenario is typical in vast, competently written code bases. This process requires a lot of time and energy that might be better left to specialists in video game optimization.
Here are some best practices in video game optimization:
- Use a profiler to track your program’s usage of CPU, GPU, frame rate, memory allocation, and other integral metrics.
- Make sure your engine is up-to-date. Research tools and plugins that can accompany your engine.
- Be sure to manage your memory properly so you allocate what you need and reuse when possible.
- Use smaller assets
- Ensure assets are optimized
- Be aware of asset decompression
- Reduce the size of your game world
- Improve your data locality
- Leverage Asynchronous actions, which will allow operations to be executed simultaneously, enhancing performance in specific tasks.
- Watch out for deadlocks, live locks, data races, increased complexity, and synchronization.
- Network calls should be used asynchronously, meaning obtain your data early. Combine loading assets/images with making server calls.
- Learn better algorithm design and data structure to better pathfinding and nearest neighbor computation.
- Beware of loops
- Utilize hashmaps
- Focus on repetitive tasks. Pay attention to your game loops for performance hits. Issues with recurring tasks can cause a lag when they occur dozens of times per second.
- Recycle objects. In other words, practice resource pooling. Do not destroy or create dynamically.
- Leverage spatial locality to find an object’s nearest neighbor.
These are just a few suggestions, not an exhaustive list, so further education may be necessary to optimize a console game successfully.
Outsourcing would save a lot of time and energy in console game optimization. Be sure to look for a partner that can provide insight, the latest in innovation, effective communication, and solutions for any challenges and deliver excellent work according to your deadline, no matter the conditions.
Consider Pingle Studio Your Trusted Partner
At Pingle Studio, we take pride in our ability to provide publishers and developers with creative artists, battle-tested developers, and veteran leadership, so any project, no matter how ambitious, will be executed efficiently and with excellence.
Our studio is able to take on any creative demand, technical request, or strict deadline, ensuring your needs are the priority. Our ability to adapt to project conditions and work environments makes us a top choice for video game optimization.
Our company have had many cases in video game optimization, including Pathea Games’ release of My Time At Portia update. This project included multiple port updates for an open-world life sim game on Xbox, PlayStation, and Nintendo Switch. These updates passed every certification for all three consoles on the first try and received an average score of 80 at Metacritic.
Some unique challenges with the My Time At Portia update included:
- No access to the original project’s documentation for the technical and design aspects of the game.
- Tight timeline for game testers (180+ hours of gameplay
- Moving all related mechanics and visuals of player interaction with trees and terrain to consoles.
No matter the challenge, we found the solution.
Another case was Irregular Corporation’s release of PC Building Simulator on PS4, Nintendo Switch, and Xbox One. The challenge of this particular project was to bring this realistic simulation game to all aforementioned gaming consoles. We delivered builds for all required consoles on time, receiving an 8.3 user score on Metacritic.
Some unique Challenges with Irregular Corporation’s release included:
- Data leaks and consistent freezes during gameplay
- Slow performance
- Slow data uploads before querying to the database
- A large amount of visual artifacts on the scene
- Discrepancies between certain PC parts in the real world versus the game.
Again, no matter the challenge, at Pingle Studio, we know how to optimize a game.