GPU bottleneck in Android version of our game

Hi folks,

I’m porting a 2d game from iPhone to Android which is based on cocos2d-x. The game works perfectly in iPhone but I’m finding very bad performance issues in Android. The game in iPhone employs cocos2d-x 3.11 because the development was started some time ago. In relation to the level design, we used level helper (https://www.gamedevhelper.com/) and for sound effects and music we use Cricket Audio https://www.crickettechnology.com/. Now we are trying to port it to Android, and we updated cocos2d-x 3.11 to cocos2d-x 3.17-2. The game builds fine in the last version of Android Studio (3.5) with the last NDK. We think that we have a bottle neck regarding the GPU, because in the Android version the number of GL calls has doubled (using the same code). We observed that GL calls increase when the scenes employ Box2d, for example, in the main menu the GL calls are around 10 and during the game (when Box2d is being used) they are 70-80 while in iPhone version they only increase to 30-40. We tried to solve this by employing different Box2d versions (including compilating the source code from github and prebuilt ones) but it didn’t work. We also used several CPPFLAGS in the Application.mk but we didn’t succeed.

I think that the problem is not in the game code because the gl calls are always twice in Android than in iPhone and we are using Atlas for textures.

Please, if anyone has any idea about what is happening here, I will be glad to know your thoughts.

Also, can you please suggest me how to profile the GPU in Android studio?

If you want to see a trailer of the game for iPhone here is the link. I hope you enjoy it :smiley:

Have you tried the info on this page: https://developer.android.com/studio/profile/inspect-gpu-rendering

Other than that, any chance you could build a Win32 (using VS2017 or 2019) or Linux version of it, and then check how many draw calls you’re using up on the desktop version compared to iOS. If Windows/Linux operates the same as iOS, then that narrows down the issue to being Android-related. On the other hand, if the desktop version also has the same problem, then I strongly recommend you use an nVidia graphics card, and their amazing software, Nsight Graphics, to track down your issue (works with both Linux and Windows).

In addition to that, Visual Studio has really useful profiling tools, so that may help as well.

1 Like

Is LevelHelper provides classes which render level into cocos? Then I think LevelHelper could be the issue.

1 Like

Which texture format are you using?

I’m not sure but the performance is too bad for it to be just a texture coding problem.

Thanks for the info but luckily I will not have to try on linux / windows since I found a way to track openGL calls in android with a tool called GAPID https://developers.google.com/vr/develop/unity/gapid

The problem seems to be that LevelHelper for some reason I don’t know is rendering each frame 3 times on android. So it’s time to try to debug LH. Thanks for the feedback guys and wish me luck :joy: