Build stunning mobile games that run smoothly with Adaptive Performance
Learn how to use Adaptive Performance to tune your mobile game – balancing frame rates and graphics. Get the latest details about updates to Adaptive Performance’s device simulator, samples and scalers.
Developers should pay close attention to their game’s performance on players’ devices, especially when building more complex mobile games. After all, performance issues can affect gameplay and drain the device’s battery. An excessive amount of heat generated by mobile phones, more specifically, can also cause thermal throttling, which leads to dropped frame rates – an issue that is tough to recover from.
So why does thermal throttling affect your mobile games’ performance? Well, as your game attempts to do more work, such as rendering or processing game logic, CPUs and GPUs use more power. This increase in power means that more heat is produced, which slows down device performance in an attempt to reduce its temperature.
With Unity and Samsung’s Adaptive Performance, you can now monitor the device’s thermal and power state to ensure that you are ready to react appropriately. While playing for an extended period of time, for instance, you can reduce your level of detail or LOD bias dynamically to see that your game continues to run smoothly. Adaptive Performance allows developers to increase performance in a controlled way, which in turn, minimizes graphics fidelity.
Check out the video above to find out more about Adaptive Performance, and discover how to add it to your build.
How does Adaptive Performance work?
Adaptive Performance works for all Samsung Galaxy devices. In other words, only Samsung devices can benefit directly from Adaptive Performance implementation.
However, Samsung is the leading Android device manufacturer, with more than a third of the global market share according to AppBrain. This means that adding Adaptive Performance to your game is a sure way to improve performance on hundreds of millions of devices.
While you can use Adaptive Performance APIs to fine-tune your application, Adaptive Performance also offers automatic modes. In those modes, Adaptive Performance determines the game settings to tweak based on several key metrics, including:
- Desired frame rate based on previous frames
- Device temperature level
- Device proximity to thermal event
- Device bound by CPU or GPU
These four metrics dictate the state of the device so that Adaptive Performance tweaks the adjusted settings to reduce the bottleneck. This is done by providing an integer value, known as an Indexer, to describe the state of the device. The Indexer is a system that keeps track of your device’s thermal and performance state and provides a quantified quality index.
Scalers represent individual features in your game, which can include but are not limited to, graphics and physics settings. Scalers adjust themselves based on the Indexer’s value. You can view which Scalers are available in Device Simulator’s Adaptive Performance extensions.
Simulating Bottlenecks in Device Simulator
Simulating bottlenecks can be difficult, but thanks to Adaptive Performance’s integration with Device Simulator, you can test various scenarios directly in the editor instead of waiting for the device to heat up before benchmarking.
With the Thermal settings in Device Simulator, you can set the device to Throttle, or to send out a warning when throttling is imminent. You can also adjust levels and trends to positive, which indicates that the device is generating heat.
The Performance settings, meanwhile, allow you to set any current bottlenecks to CPU, GPU or Target Frame rate. Similarly, you can set CPU and GPU levels to simulate the frequency of their performance.
Both Thermal and Performance settings affect how Adaptive Performance alters your game’s performance via Indexers and Scalers. With Device Simulator, you can enable different Scalers to see how Adaptive Performance accommodates your device when it is throttling.
For example, you can allow Adaptive Performance to tweak the Shadow settings when the GPU is set as your bottleneck and the warning level is set to Throttling with an increase in both thermal trends and levels. You can also override the Scaler with the slider to test individual settings.
Creating custom scalers
Adaptive Performance empowers the creation of custom scalers to enhance and expand on the ways that game settings are controlled. This includes settings that are not automatically provided.
To implement a custom scaler, you must implement the AdaptivePerformanceScaler class.
Setting the QualitySettings.masterTextureLimit, for instance, prompts you to describe the texture quality and size per level.
Based on the current level of the scale, you can override the OnLevel virtual function and implement a scaling logic. The CurrentLevel that Adaptive Performance reports back can inform you to set the QualitySettings.masterTextureLimit to a higher value, which will then use a lower scaled texture mipmap of all the textures. When dealing with texture sizes, you can see that your custom scaler impacts visuals and specifically targets the GPU.
Describing a max level and boundary also ensures that your game’s visuals are not entirely lost, as higher leveled mipmapped textures make up half the dimensions of a lower leveled mipmap texture.
Adaptive Performance provides out-of-the-box features that allow your game to react appropriately to the current state of the device. To learn more about Adaptive Performance, you can view the samples we’ve provided in the Package Manager by selecting Package Manager > Adaptive Performance > Samples. Each sample interacts with a specific scaler, so you can see how each scaler impacts your game. We also highly recommend viewing the End User Documentation to learn more about Adaptive Performance configurations and how you can interact directly with the API. The documentation, along with other relevant links, can be found below.