Android performance with big tiles

I´ve wondered why my app has such a bad performance on Android although I´m using Tilesheet.drawTiles.
Therefore I played around a bit with the bunnymark example.
I saw that it´s no problem displaying thousands of the tiny bunny tiles at 60fps, but when using bigger tiles the fps go down rapidly. I didn´t expect this effect to be so drastically.

It seems to me filling a screen with tiles plus other objects at 60fps is hardly possible on Android?

Btw I was testing with a HTC One X at 720p, 1.5GHz Quad Core.

I thought a 2D game wouldn´t be such a problem as other 3D games are running fine on the same phone.

Is there something I missed or any additional performance tipps?

Yes, you are fill-rate bound most of time on mobile devices.
Some frameworks support features like this to redeuce amount of fill, but OpenFL itself doesn’t.

http://discuss.cocos2d-x.org/t/new-feature-meshsprite-polygonsprite-updated/21153

Tegra is using immediate rendering, but if you want to target other devices that uses Adreno, Mali, or PowerVR, you may also need to do other optimization, as most of mobile devices are using one of these GPUs.

https://wiki.mozilla.org/Platform/GFX/MobileGPUs

Only thing you can do in the case of an OpenFL app is disabling stencil and depth and reduce number of draw calls as much as possible, I guess.

1 Like

2D games are more likely to be fill-rate bound than 3D games, because optimizations like early Z test won’t work for 2D rendering. PowerVR’s per-pixel Hidden Surface Removal(HSR) still works for 2D rendering though.

Oh wow, thank you! This goes far deeper into technically spheres than I wanted to go :wink:
I thought about pre-caching the background tiles into one large background image. Obviously this only works for static or slow-moving backgrounds.
Also isometric tiles tend to have alot of transparent pixels, so that is counter-productive as well.

Guess I´ll have to test alot here to get a good result.

I think if your tilesheet image exceeds hardware capabilities of device (on Android its often 2048x2048 pixels) it might be down-scaled - affecting performance. If I’m wrong I hope somebody will correct me :smile:

Yeah downscaling is what you can do with pixelart and what is common in haxeflixel, but I don´t think it is a good option for non-pixelart

I mean its often down-scaled automatically by API or other “middle-ware” (leaving developer unaware of this).

So you mean when I use a 4096x4096px spritesheet android will occasionally scale it down to 2048x2048? I´m new to android and I never heard of that, so if you have more information, feel free to share it!

I don’t think openfl does that, when I tried to use 4096x4096px spritesheet on device that allows maximum size of 2048x2048 my graphics were all black. You can use GL.getParameter(GL.MAX_TEXTURE_SIZE) to find out how big of a texture you can use.

1 Like

How many draw calls and overdraw do you currently have?
I can see them easily with Adreno Profiler, as my test device is Snapdragon-based.

Tegra has a debugger too, though I don’t know whether it works on your device and how you can see overdraw analysis.

1 Like

Thanks, sounds good.
Unfortunately I cannot get Adreno running with my app:

ADB: Found a device, but no Adreno Profiler-enabled app. Verify your app is running and network privileges have been enabled in the APK manifest.

The app is running on the device and as far as I can see the privileges are given:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

IP: No device found: entern an IP Address in the box and click Refresh to scan again.

Is this even relevant when using ADB?

Isn’t your device using Tegra3? HTC One X has two variants, one is dual-core Snapdragon-based and the other is Tegra3-based.
Adreno proiler only works on Snapdragon.

This blog says “debug.egl.profiler” must be set, though it also says that flag is set by tool automatically.
http://blog.toonormal.com/2013/11/14/gpu-debugging-on-android-devices/

1 Like

Ah thanks, I just quickly googled htc one x and snapdragon, found something and didn´t realise there are two versions of htc one x :wink:
I´ll check that tegra tool out!