wograebn Posted October 19, 2016 Share Posted October 19, 2016 My Phaser (v2.6.2) game runs great at 60fps on my iPhone 6S. But then I tested it on a regular 6 and was shocked to see 20fps. I took everything out until nothing was left but an empty scene and it is still just 30fps on iPhone 6 and 10fps on iPad Mini 1. The code below outputs: In Safari on iPad Mini 1 iOS 8.2 -> webgl: true fps: 20 In Safari on iPhone 6 iOS 9.3 -> webgl: true fps: 30 (I even checked this on two different iPhone 6 because I couldn't believe my eyes) In Safari on iPhone 6S iOS 10 -> webgl: true fps: 60 The performance cannot possibly be this bad can it? iPhone 6 is still a modern device. But what could be wrong with my code below? For comparison I also quickly googled html5 game engine and set up a basic scene with Panda JS that just sets the renderer to WebGL and prints out fps and it was running at 60 on all 3 devices listed above. So I think I can rule out device and it must be something down to the Phaser engine, or the way that I am using the Phaser engine. <!doctype html> <html> <head> <script src="./build/phaser.js"></script> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <script type="text/javascript"> window.onload = function() { var game = new Phaser.Game(360, 640, Phaser.AUTO, '', { init: init, render: render }); function init() { game.time.advancedTiming = true; } function render() { game.debug.text("webgl: " + (game.renderType === Phaser.WEBGL) + " fps: " + game.time.fps, 32, 32); } }; </script> </body> </html> Link to comment Share on other sites More sharing options...
lewster32 Posted October 19, 2016 Share Posted October 19, 2016 The debug overlays are expensive, especially when using WebGL, as they're not optimised (as is typically the case when enabling any kind of debugging functionality). Advanced timing is also reasonably costly (hence why it's disabled by default). Link to comment Share on other sites More sharing options...
rich Posted October 19, 2016 Share Posted October 19, 2016 Definitely don't use the debug overlay to check fps! It creates a brand new texture upload, every single frame, which hammers the GPU. Link to comment Share on other sites More sharing options...
phot Posted October 20, 2016 Share Posted October 20, 2016 6 hours ago, rich said: Definitely don't use the debug overlay to check fps! It creates a brand new texture upload, every single frame, which hammers the GPU. What about the advanced timing? My code relies on getting delta frame information for consistent movement no matter the frame rate. Is there another option? Link to comment Share on other sites More sharing options...
lewster32 Posted October 20, 2016 Share Posted October 20, 2016 To be fair, the hit from advanced timing isn't that bad looking at the code. If you need to keep track of the fps I'd maybe suggest you do it via a DOM element on the page? Link to comment Share on other sites More sharing options...
wograebn Posted October 21, 2016 Author Share Posted October 21, 2016 Thanks guys, printing the fps to a text label instead of the built in debug resolved the issue. Link to comment Share on other sites More sharing options...
Recommended Posts