Mapping Android pixel densities to Cocos' resource asset sizes

Mapping Android pixel densities to Cocos' resource asset sizes

I’m trying to port my Cocos2dx (3.17) game to Android and I’ve been reading this topic, where it’s suggested to divide your assets into following groups: UHD, HD, SD, LD with resolution assigned to each of them. My problem seems similar, since my game is in landscape-only mode and is going to be using FIXED_HEIGHT policy.

The poster suggests it with regards to Apple’s phones but I suspect it will be something similar for Android.

Reading Android’s official docs, I found out that they suggest to divide your assets into different set of groups: ldpi, mdpi, hdpi, xhdpi, xxhdpi.

One of my goals is to make sure people don’t download asset packs that won’t even be used on their device.

I’m looking for a sane way of mapping one onto another, preferably Cocos’ to Android’s not the other way around, since it simplifies distribution. I guess I probably won’t even need to use setSearchPaths(), since I’m pretty much forced to distribute several APKs anyway due to asset size.

Design resolution is 1920x1080 and I’m targeting Android 4.1 and above.

Would doing something like this be reasonable?

UHD (2048x1536) --> xxhdpi and higher
HD  (1920x1080) --> xhdpi
SD  (960x640)   --> hdpi
LD  (570x320)   --> mdpi and lower

Or it’s not precise enough and it’s likely that many devices get too low quality, upscaled assets or too high, downscaled resulting in either poor visual quality or a severe performance hit?

Or maybe it’s better to try and map asset sizes to screen size groups rather than pixel densities?