Switch "DevicePixelRatio" based on performance of device

Hi dearest community,

the “DevicePixelRatio” option draws a lot of performance, but makes the game look nice on devices which have enough power.

Our game looks great with DevicePixelRatio enabled on a newer tablet and runs with decent FPS, but if I test it on a slightly older tablet (e.g. Galaxy S7), the performance is so bad that every other frame get dropped and the screen flashes white. If I disable DevicePixelRatio, the flickering is gone, but then it looks crap on the newer tablet :wink:

So my question is: Is there a way to switch the DevicePixelRatio flag based on the performance of the device? Or how do you tackle such an issue?

I’ve already read the “Optimization Guidelines”. Thanks a lot for any hint beyond that!

Best,
Rene

1 Like

Well you have multiple approaches to this problem:

First - the non-automatic way is to have control buttons for the user to choose quality (button to manipulate devicePixelRatio).

Second - you could for example get average FPS during first 3-5 seconds and then change quality depending on this information.

We are using combined 1st/2nd method in our apps and everything runs smooth.

1 Like

Thanks for the answer. This sounds like an adequate solution for the problem I’ve described, but I found out that the flickering (on this specific device) was somehow caused by having set the “Fill Mode” in the rendering settings to “Keep Aspect Ratio”.

If someone experiences this flickering as well, try to change the Fill Mode to “Fill window”. Sounds strange, but it fixed the problem for me.

Best,
Rene