r8n5n Posted May 18, 2015 Share Posted May 18, 2015 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 enginea '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 7fpsSwitching from AUTO to CANVAS - game runs better using Canvas on all platforms Things I have tried... halving the width of all backgrounds - no changehalving the width/height of all backgrounds and scaling up by 2 - no change switching physics engine to arcade - no changetemporarily removing all the objects from the tilemap which have collision detection - no changechanging all tiling background images to power of 2 - no change Here is the game - press space or click/tap screen to starthttp://test1.theworkshop.co.uk/ sorry for the blurred graphics... Any pointers/help much appreciated. Link to comment Share on other sites More sharing options...
ericjbasti Posted May 19, 2015 Share Posted May 19, 2015 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 More sharing options...
r8n5n Posted May 19, 2015 Author Share Posted May 19, 2015 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 More sharing options...
rich Posted May 19, 2015 Share Posted May 19, 2015 What size is the game? What Phaser scale mode are you using? Usually poor iOS performance is just trying to draw too much at once, or too fast, or even something entirely unrelated to graphics like audio processing. Link to comment Share on other sites More sharing options...
r8n5n Posted May 19, 2015 Author Share Posted May 19, 2015 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 More sharing options...
ericjbasti Posted May 20, 2015 Share Posted May 20, 2015 I get 55-60fps with your example when saved to the home screen on a 5s. You don't by chance have the device connected to a computer while testing do you? That use to get me all the time. Link to comment Share on other sites More sharing options...
r8n5n Posted May 28, 2015 Author Share Posted May 28, 2015 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 More sharing options...
nuke22 Posted November 24, 2016 Share Posted November 24, 2016 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 More sharing options...
Recommended Posts