Jump to content

Performance problems on iOS


r8n5n
 Share

Recommended Posts

Hi,

 

I am developing a game in Phaser 2.3.0.

 

It is running smoothly on desktop, generally about 55-60 fps, and on android mobile (Nexus 4 and 5, Sony Experia) between 30-50  but I cannot get it over about 7fps on most iOS devices (tried iPhone 4s, iPhone 5, iPad3, iPad mini)

 

An iPad Air runs at about 20fps which is OK, but not great.

 

I am struggling to find out what is causing the slow frame rates so was wondering if anyone had any words of wisdom.

 

It is using:

p2 physics engine

a 'Tiled' map with objects converted to sprites and collision objects.

Texture packer atlases where possible

 

I use large parallax backgrounds but swapping to smaller ones does not seem to have much effect

 

I have read anything I can find on the forums regarding optimising games and tried anything that was suggested.

 

Things I have implemented..

 

Detecting iOS and using sprites rather than TileSprites  this got me from 1fps to about 7fps

Switching from AUTO to CANVAS - game runs better using Canvas on all platforms

 

 

Things I have tried...

 

halving the width of all backgrounds - no change

halving the width/height of all backgrounds and scaling up by 2 - no change 

switching physics engine to arcade - no change

temporarily removing all the objects from the tilemap which have collision detection - no change

changing all tiling background images to power of 2 - no change 

 

 

Here is the game - press space or click/tap screen to start

http://test1.theworkshop.co.uk/

 

sorry for the blurred graphics...

 

Any pointers/help much appreciated.

 

 

 

 

 

Link to comment
Share on other sites

When you save the games to the home screen what does the performance do? I would expect it to improve if you're on iOS8.

 

Add <meta name="viewport" content="width=device-width, initial-scale=1"> to head tag of the HTML files. Find out how much the page scaling is hurting the fps. 

Link to comment
Share on other sites

Thanks fro the info, added the meta tag, can't see any real difference in frame rate. 

 

Also tried saving to the home screen with no significant change.

 

One thing I did try was not using camera follow on the character and keep the character static and move the backgrounds instead. This increased the fps by about 6 or 7.

 

Really struggling with this ....

Link to comment
Share on other sites

The game is 980 x 551px, 

 

scale mode set as follows...

 

this.game.stage.scaleMode = Phaser.ScaleManager.SHOW_ALL;
this.scale.pageAlignHorizontally = true;
this.scale.pageAlignVertically = true;
this.scale.setScreenSize(true);
 
I have not added audio yet, fingers crossed that does not drop the fps more.
 
How would I slow the down the drawing rate to see if that helps, dropping the desired fps?
 
I do have a parallax background with 3 layers, but when I have reduced it to 1 there was no difference in fps.
Link to comment
Share on other sites

Thanks for you help,

 

I ended up reducing the dimensions of the backgrounds I was using, thoroughly checking my code and clearing up any things I did not need, optimising etc. 

 

One thing I found was that I was using a tilemap which was 300 x 5 tiles and I was using this to create sprites and P2 bodies. I realised that I did not need the tilemap after I had created the sprites and therefore destroyed it which gave me a big performance boost.

 

I got it to around 20fps on iPhone 4, iPad 3 which was acceptable.

 

Cheers

Link to comment
Share on other sites

  • 1 year later...

Currently developing using Phaser v2.6.2. 

Getting great framerates on desktop, iPhone 4S (running iOS 8.4) and iPad Mini2 (running iOS 9.2).  However, iPhone 5 (running iOS 10.1.1) was woefully slow.

Turned out that Masking was causing the problem.  Turned masking off, and the game runs like lightning.  Thankfully, I can get around the need for masks on this game.

Just thought I'd share in case anyone else was caught out by this.

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...