rsdfsdfsdf

Micro stutter

Recommended Posts

Why does it happen?

It's not my computer. It's not my antivirus. It's not my browser nor my drivers.

Every 10 seconds or so, whenever i'm moving or jumping I get a small but noticeable stuttering.

Happens in both WebGL and Canvas, both Chrome and Firefox.

Fps meter remains at 60.

 

  function create() { 
cursors = game.input.keyboard.createCursorKeys();
  game.stage.disableVisibilityChange = true;
        game.physics.startSystem(Phaser.Physics.ARCADE);
        game.add.sprite(0,0,'sky');
       rocks = game.add.group();
       rocks.enableBody = true;

   someText = game.add.text(16, 16, 'pffffff', {fontSize: '32px', fill: '#23238F'}); 


        //ball
        ball = game.add.sprite(32, game.world.height - 150, 'ball');
        game.physics.arcade.enable(ball);
        ball.body.bounce.y = 0.2;
        ball.body.gravity.y = 800;
        ball.body.collideWorldBounds = true;
        ball.animations.add('left', [0,1,2,3], 10, true);
        ball.animations.add('right', [5,6,7,8], 10, true);

};

   function update() {

game.physics.arcade.collide(ball, platforms);
        game.physics.arcade.collide(enemies, platforms);
        ball.body.velocity.x = 0;
        myx = ball.x;
        myy = ball.y;
        if (cursors.left.isDown)
        {
            // Move to the left
            ball.body.velocity.x  = -150;
            ball.animations.play('left');
            myanim = 'left';
        }
        else if (cursors.right.isDown)
        {
            ball.body.velocity.x  = 150;
            ball.animations.play('right');
            myanim = 'right';
        }
        else
        {
            ball.animations.stop();
            ball.frame = 4;
            myanim = 'stop';
        }
        if (cursors.up.isDown && ball.body.blocked.down)
        {
            ball.body.velocity.y  = -555;
        }
        if (ball.body.velocity.x > 0 && !ball.body.blocked.down)
        {
            ball.animations.stop();
            ball.frame = 6;
            myanim = 'airright';
        }
        if (ball.body.velocity.x < 0 && !ball.body.blocked.down)
        {
            ball.animations.stop();
            ball.frame = 3;
            myanim = airleft';
        }
    }

};

 

Share this post


Link to post
Share on other sites

Is this because the page in itself is still loading ? It stutters a lot on my laptop while Chrome is still loading the page, then it's smooth as butter.

Try putting an home screen before your actual game so when you refresh you can wait for the page to fully load before trying your game.

Share this post


Link to post
Share on other sites
3 hours ago, drhayes said:

Have you tried Chrome Canary, the dev version of the browser?

What for?

On 3/12/2016 at 11:22 AM, eXilz said:

Is this because the page in itself is still loading ? It stutters a lot on my laptop while Chrome is still loading the page, then it's smooth as butter.

Try putting an home screen before your actual game so when you refresh you can wait for the page to fully load before trying your game.

I think I may not have explained myself. I'm having the same issue this person had: 

More people talking about it: https://github.com/photonstorm/phaser/issues/2273

Example: http://examples.phaser.io/_site/view_full.html?d=tilemaps&f=sci+fly.js&t=sci%20fly

So, basically, if the camera scrolls up and down, you are ****ed. So imagine a game with no camera deadzone (the example below has deadzone) and a camera locked down on the player. And if, on top on that, your sprite is a physical arcade object with bounce properties, then you're really really ****ed, and if, on top on that, you load your map tile by tile (loadTile) instead of using tileDNIGHTMARE, then you don't want to know the effects that this combined fruit salad will have on your mental health. The sprite will shake by itself on some tiles. The true milkshake of the death. Load an invisible sprite with integer movement and make the camera follow it? MY ASS. The Phaser developer knows about this fact, he just doesn't know how to fix it. I'm done. Waste of time 10/10.

Share this post


Link to post
Share on other sites

The reason I suggested "Canary" is because of this Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=422000 If you see it in your game you'd see it in others that use camera scrolling as well: http://phaser.io/examples/v2/camera/basic-follow

AFAIK it's still affecting Chrome and... looks like, from the issue, that it might be affecting Canary, too. Uh, whoops.

I have a Phaser game that's scaled up from 320x240 with a tilemap that has 8 layers and see a tiny bit of stutter every few hundred frames. I don't believe it's Phaser-specific.

Share this post


Link to post
Share on other sites

Hi! I had this exact problem and went nuts trying to figure it out. I found that just using Phaser.Canvas and adding a line to enforce rounded pixels fixed most of the stuttering issue for me:

game.renderer.renderSession.roundPixels = true;

 

 

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.