Flash game ported to Android (APK) going at half-speed.

Discuss issues specific to the Flash/AS3 port of Box2D
gramcracker
Posts: 21
Joined: Wed Feb 25, 2015 10:36 am

Flash game ported to Android (APK) going at half-speed.

Postby gramcracker » Tue Jul 28, 2015 7:55 am

This is a performance-oriented box2D mobile question. I think anybody who has previously ported their game to different versions might recognize some of these issues.

I've optimized the box2D game application using Scout, and the overhead is very minimal. There is a good system in place to destroy bodies and remove materials from the stage not in use.
The timestep is 60 fps, velocity 8, iterations 3. I found this necessary to achieve smooth movement of falling bodies. I also designed the game physics and mechanics around a low gravity. It runs well in Flash.
The dimensions of the stage are 640x960. I designed it large to accommodate for iPad, iPhone and possibly other devices.
When I install the APK on an Android phone (or the iOS IPA) on an iPhone, everything works normally, but the speed is < 50%.
Is the oversized resolution, 60 fps rate contributing to this?
The graphics are optimized and converted to bitmaps. (Adobe Scout shows no memory leaks, redraws, decomp lag or dirty regions)

I was under the impression mobile devices would auto-scale graphics.
Or am I looking at shrinking down the entire graphics library and retuning the game physics around a lower frame rate?
Because the game is too lightweight to be giving the Android OS a problem. (also happens on iOS)

gramcracker
Posts: 21
Joined: Wed Feb 25, 2015 10:36 am

Re: Flash game ported to Android (APK) going at half-speed.

Postby gramcracker » Tue Jul 28, 2015 2:41 pm

Just a quick update, I had great results by using cacheBitmapMatrix and manually setting GPU as the render mode in the XML file.
The Adobe AIR publish dialog does not apparently acknowledge the choice there, you have to set it in the actual XML file.

The simulation is much, much faster, although still hitting bottlenecks when there are 10 to 12 bodies in motion.

The overall game is mega-optimized, so I'm excited that it appears Box2D can work on mobile devices, even with the heavy math involved in the game.

But if anyone has any additional tips and tricks.

Would making 50% versions of all the graphical elements matter?


Return to “Flash”



Who is online

Users browsing this forum: No registered users and 2 guests