ashes999

Simple Phaser game extremely slow with PhoneGap build

Recommended Posts

I made a very simple game where you have a dragon flying on screen and collecting balloons.

 

You can play it here, courtesy of GitHub Pages. You can view the source on GitHub, but be aware that it's CoffeeScript. (If you want to see the raw Javascript, you can see it here.)

 

The game runs fairly quickly on my dev boxes in Chrome (tested in Linux VMs). It doesn't have much; maybe 10-15 sprites on screen at once, one text object, and some sine waves (yeah, I know, I couldn't resist).

 

I built it using PhoneGap's cloud build service (it's quick to set up). But it runs slow on Android. Really slow. Oozingly slow, like a few frames per second.

 

I'm not sure why. I checked it on my phone (Samsung Galaxy Discover -- circa 2012). I also checked it on BlueStacks, which should run lightning-fast on my desktop PC. It's still slow.

 

Any suggestions? Is it because I left the drawing mode in AUTO instead of CANVAS?

 

 

Share this post


Link to post
Share on other sites

I tried CocoonJS and I didn't like it.

 

With PhoneGap, after waiting about 15-20 seconds, I get a "hello world" app building to ~300kb.

 

With CocoonJS, after waiting around three minutes, I get an equivalent 18MB app.

Share this post


Link to post
Share on other sites

I recently used the Intel XDK and performance was great. On par with cocoonjs. The trick was to build an Android Crosswalk app (A standard Android app was woeful).

Dunno about iOS but XDK can compile for it.

Edit: yeah I think you might want to use CANVAS not AUTO. I haven't done a lot of testing around this but I used CANVAS I think.

As an aside I've read that Intel is really pushing for html5

Share this post


Link to post
Share on other sites

While it's true that intel XDK rendering preformannces are similar to cocoonjs', from my experience on android, the sound support/management is total crap.

Playing multiple sounds turns to a catastrophe.

 

Anyway, your dragon game above, I can confirm it runs smoothly with chrome (on OSX), and very poorly with firefox.

 

Try using Phaser 2.0.7, I'm quite sure those slowdowns come from the latests versions, namely, 2.1.2 and 2.1.1, which run on a different version of pixi which triggers those slowdowns problems.

 

 

I'm 99% sure those slowdowns won't occure with 2.0.7.

Share this post


Link to post
Share on other sites

Try removing the text first. I think there should be some fps increase. If this is the case replace it with bitmap font.

Also check the performance by disabling some functions in your update loop.

 

On my samsung galaxy core runs with about 20-30 fps on chrome.

Share this post


Link to post
Share on other sites

i have no problems with sound and crosswalk at all..   with cocoonjs the sound "jumps" on the first note..  with crosswalk i can play several long songs over each other and it works flawlessly..

 

 

 

one tip for crosswalk:  use WEBGL for crosswalk not canvas..  (with cocoonjs it is the other way around) - it will be faster

Share this post


Link to post
Share on other sites

I tried:

 

- Phaser 2.0.7 (no effect)

- CANVAS mode (big performance boost)

It's still super slow. I'll have to come back to this later. I still need to try:

 

- PhoneGap + CrossWalk app

- Removing text

- Removing some logic

 

Thanks all.

Share this post


Link to post
Share on other sites

Removing the text seems to give me around 40FPS on BlueStacks, but only around 10FPS on my phone. 

 

Odd. Maybe trying to render an 800x600 game onto a 320x240 device is the reason why.

 

10FPS is pretty much unplayable. I'm stuck for now.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.