Before this project, Unity had already released the 1st preview version of Adaptive Performance through the collaboration with Samsung. Based on this, we started a technical collaboration with the Call of Duty Mobile team, Timi Studio J3 from Tencent, in which we aimed to make their game have minimal power consumption with a highly stable frame rate. Of course, this kind of technical collaboration will help to bring Adaptive Performance more and more games as developers see the clear benefits.
We will discuss what developers can achieve by using Adaptive Performance and how to use it to develop your own optimization solution for your game learning from the example in Call Of Duty Mobile.
Let’s see some screen captures from this game:
We can see Call of Duty Mobile has PC-like rendering quality, the game is using PBR material with high resolution textures, this will create a heavy work load on both the CPU and GPU. So it seemed likely that adjusting only CPU/GPU frequency automatically would not be enough to avoid Thermal Throttling and consequential performance degradation. We discussed with the Call of Duty team the idea of making multiple types of scalable quality factors, and of course these were confirmed with the Art designer and Project Staff of the game to make sure the adjustments of these factors did not impact the game experience. The scalable factors for Call of Duty were:
Shadow Distance : The shadows in the game usually demand complex calculations. The game needs to take into account many variables to calculate the shadow such as the sources of light, the object creating the shadow, and the object upon which the shadow is cast. The whole process requires a lot of processing power.
Foliage LOD : An effective method to reduce the on-screen polygon count by replacing the high quality model with a lower level (lower polygon count) mesh when it reaches a specific distance from the camera. In Call of Duty Mobile, we mainly adjust the LOD of foliage rendering.
Animation Rate : The calculation of Bone animations usually needs to manage huge amounts of bone data and frequently update matrices. But realistically we don't always need to update the full animation every frame, reducing the update rate can effectively reduce the CPU and GPU calculation costs.
Target Frame rate : Higher frame rates always cost more power and result in higher temperature for the device (especially if the game is running at high refresh rates). In Call of Duty Mobile, we lowered the target frame rate when the temperature rose quickly, thereby we could restrict the peak temperature and have more stable performance with limited CPU/GPU frequency at the same time.
Adaptive Performance is built on top of Samsung’s GameSDK which can provide you with feedback about the thermal state of mobile devices. Developers can subscribe to events or query the information from the Adaptive Performance API during runtime to react in real-time.
Left to its-self the mobile device will trigger an immediate reaction to deal with high surface temperature by throttling chip frequencies, which naturally will cause the performance to drop.
CPU and GPU cores are actually less efficient when run at their maximum clock speeds. The API ‘setLevelWithScene(String scene, int cpuLevel, int gpuLevel)’ limits the maximum allowed clock speeds which can avoid situations where the operating system throttles the frequency of the CPU and GPU to cool down the device.
Applications can determine cpuLevel and gpuLevel which range from 0 ~ 3 based on the thermal feedback provided by the Adaptive Performance API and can use some special knowledge of the application like:
Depending on the game and scenario, Developer can react differently when the game is CPU or GPU bound according to the thermal state changes.
Here are the detail rendering factors for Call of Duty Mobile, and of course, the adjustment will not impact the game experience:
Shadow Distance (80 ~ 50)
Foliage LOD (1.0 ~ 0.8)
Dynamically changing quality scale factors features were encapsulated into funtions “LowerCoDFeatures()”and “RaiseCoDFeatures()”in which we set prefered scale factors’ value:
DynamicChange.ChangeAnimLOD(m_AnimateIndex, m_AnimateHeight, m_AnimateUpdateRate);
Normal : We kept target frame rate and checked the performance boottleneck, In case of “GPU bound”, we raised GPU level and called “LowerCoDFeatures()”. In case of “CPU bound”, We raised CPU level and also called “LowerCoDFeatures()”.If “frame rate bound”happened, we made sure that the target frame rate can be maintained for a perid of time before reducing CPU or GPU level.
NearThrottling : We checked the temerature trend, If it was still increasing we deceased CPU and GPU level and called “LowerCoDFeatures()”. Or else, we increased CPU and GPU level and invoked “RaiseCoDFeatures()”.
CloseThrottling : We firstly changed frme rate then checked the temperature trend, If it was still increasing, we decreased GPU and CPU level and called “LowerCoDFeatures()”.
This is the FPS compare result from 3 battles of BR mode in Call Of Duty Mobile. As shown here the FPS with Adaptive Performance is much more stable and the average FPS is higher, about 7%.
With Adaptive Performance, the temperature is on average 2, and a maximum OF 3 degree celcius lower.
Also as shown in the Max Freq graph, in the normal case, the device works at higher CPU freq. at the beginning time, so it quickly meets Thermal Throttling and then the FPS drops and power control also shakes badly.
Using Adaptive Performance, the device can set a lower level CPU frequency and also keep the GPU frequency at a much more stable level. For this reason, Adaptive Performance’s temperature and performance are much better than the normal case.