wograebn

Empty scene runs at 35 fps on iPhone 6

Recommended Posts

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>

 

Share this post


Link to post
Share on other sites

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).

Share this post


Link to post
Share on other sites
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? 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.