Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have created a small game project in HTML5 using Phaser engine (tried both 1.1.5 and 1.1.6). Then to port it to mobile platform, used Phonegap/Cordova for Windows Phone 8, Android and iOS.

In my game, there are around 10 elements, which get animated (moving from point a to point b and some rotation at same time). On iOS and Windows Phone 8, I didn't face any issue.

But with Android, performance is unacceptable. On the other hand, if I run my game via device browser, it run smooth without any lag. But compiled APK runs very jerky and elements move very slow & in flickering manner.

I have checked android hardware acceleration flag is set to "true" in manifest file. Tried changing it false too, but that didn't reflected any change in performance.

I have checked same on Android 4.2 on Samsung S2 device and on that performance is better. But on Asus Nexus Tab 7 (running Android 4.4) its very jerky, while the OS and Device both are latest. Also checked on another device running Android 4.3 (Samsung Galaxy Grand Duos) and on that too performance is not good at all.

In my game tried both WebGL / Canvas rendering (Phaser engine uses Pixi.js, which fallback to 2d canvas if WebGL isn't supported), but no change. Similarly with easeljs.

If anyone else faced similar issue and can suggest any way to get native like performance. I checked cocoonjs examples and while they seems smooth and acceptable, I can't go for that route.

share|improve this question
3  
This question is very well written. I would like to know if you ran a benchmark or profiler to narrow down on what might be the culprit and if you contacted phonegap with a set of easy steps to reproduce this? –  Zehelvion Mar 1 at 9:51
    
I haven't written to phonegap yet. Tried profiler and couldn't find anything unusual with the framework or codebase. Perhaps thats the reason why everything runs smooth on desktop as well mobile browser too. One finding was that Android has a different runtime for WebView based apps and browser itself. But couldn't find anything which indicate that why such small tweening is causing so much lag in APK (WebView) mode. In fact, this issue is appearing on Nexus tab running KitKat which is said to have fastest webview (Chrome based). –  devilzk83 Mar 7 at 5:25
    
This is very superficial observation on my part; it seems that you might be onto a bug. I don't see why would there be a strong discrepancy in performance between highly-end devices. –  Zehelvion Mar 7 at 12:59
1  
I'm curious why you don't want to go the CocoonJS route. I believe both Phaser and Pixi run well within CocoonJS. What's preventing you from trying that option? –  Geoff Mar 10 at 16:32
1  
The bug causing lame CSS3 & Canvas rendering is the new Chromium-based webview and it is a total fiasco for Cordova/Phonegap devs on Android... Ghaaadzoooks didn't anyone at Google test webview canvas/CSS3 performance before booting KitKat out the door? I hope it is fixed fast and hopefully transparently particularly to people on cellphones with 3rd party locked Android builds... Utter fiasco.. If you are a Cordova/Phonegap dev or utilizing Webview, please star this bug with Google Android bug reports... more info: groups.google.com/forum/#!topic/phonegap/1ZxXe6chHZc code.googl –  user44449 Apr 10 at 10:28

3 Answers 3

Saw this the other day, might well be worth a look to solve this problem. Sounds like a pretty nice idea to me: http://tmtg.net/glesjs/

The fact that it works fine when in browser, but not when on Phonegap/Cordova is very strange indeed. The whole canvas/webGL situation on Android (can't speak for iOS) has always seemed pretty dire to me. Definitely something GOogle needs to put more energy into, perhaps Lollipop will be an improvement!

share|improve this answer

Try to remake your game in libgdx. Libgdx is fast enough and doesnt have issues like that and it works on all platforms. Unfortunately this is only what I can think of right now and I dont like the idea of converting js to android java or whatever that coverter does. Although it will take some time, give LibGDX a test.

share|improve this answer

Seems like this is a issue with most game developers. Similar issue

"I'be often heard that phonegap wasn't the best choice when wanting to make canvas game. It's more adapted to web app to native."

It seems to be rendering issue capabilities for android phones. There are some engines that can not handle more sprites rendering. I know 10 objects are easy to render but it definitely looks problem with rendering capabilities.

My suggestion is that you go with cocoonjs.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.