johann_dev Posted June 2, 2018 Share Posted June 2, 2018 I'm having huge difficulties getting my game to run smoothly on the big three browsers for desktop and mobile. How my game currently runs on each platform: Desktop Chrome: Great, 60 fps, no problems Desktop Firefox: also great Desktop Safari: great Mobile Chrome: little chuggy, but altogether decent Mobile Firefox: Unplayable, 5-20 fps, music doesn't start playing until several minutes into play Mobile Safari: Unplayable, constantly crashing. Is it unrealistic to assume I can get it to play at 60 fps on all of these platforms? What are some (broadly speaking) best practices for optimizing Phaser games for mobile browsers? I keep trying things to get my game to run faster (Object pooling, lower resolution, reducing number of sprites, optimizing algorithms) but in some cases these optimizations make the game run worse (specifically object pooling on mobile firefox). Should I abandon optimizing for mobile devices and instead deploy my games using CocoonJS/cordova/PhoneGap and put it up on the app stores? Link to comment Share on other sites More sharing options...
onlycape Posted June 2, 2018 Share Posted June 2, 2018 Hi @johann_dev, In first place, If you are using the renderer Phaser.WEBGL or AUTO then try changing it to Phaser.CANVAS. Some browsers have support for webgl but with very poor performance (especially on mobile). If you are using multiple text objects with webgl. Instead of system fonts it's much better for performance to use bitmap fonts (bitmapText object). Regards. Link to comment Share on other sites More sharing options...
johann_dev Posted June 2, 2018 Author Share Posted June 2, 2018 Thanks! I had already done all of those things you listed. I read on someone's blog that tilesprites are really inefficient on mobile browsers, and my game uses tons of them. I'm trying to replace them all with an extended version of phaser.image, I'll report back if it helps. Link to comment Share on other sites More sharing options...
johann_dev Posted June 3, 2018 Author Share Posted June 3, 2018 I can confirm, replacing tilesprites made a massive difference in performance on mobile firefox. mobile firefox is still slow to start, and there's a huge delay before the music in the game will start playing mobile safari crashes during the first loading screen Does anyone know if audio could be the source of my problems? I'm using audiosprites that reference both an mp3 and an ogg file. Link to comment Share on other sites More sharing options...
johann_dev Posted June 3, 2018 Author Share Posted June 3, 2018 Apparently another mistake I was making was not waiting for audio to completely decode before leaving the preload state. Link to comment Share on other sites More sharing options...
Recommended Posts