Skuzzi Posted April 11, 2016 Share Posted April 11, 2016 I really liked Phaser and wanted to use it for game development but I find it to be impossible because of this issue. I'm using Chrome primarily and even with the most basic examples using just body.velocity to move a sprite around it is choppy at times. I can't figure out when and why it is choppy, but basically 30% of the time or so, the sprite is just moving choppily even at 60FPS. The issue also seems to be replicable when I switch back and forth between the tab the game is on and another random tab. I also encountered another issue where the game would just run at 30FPS for no reason and then suddenly start running at 60FPS. I would love to use Phaser but these issues make me want to consider a traditional desktop environment, are there anyone else with these issues that might have a fix? I know about the "forceSingleUpdate" fix but I don't want any users to suffer potential physics calculation issues. I would also like to note that my computer shouldn't be the issue, but my specs are: i5-2500k @ 4.6Ghz, 2x Radeon HD 6970 (4GB VRAM total), 8GB DRAM. Running on Windows 7 on an Intel 128GB SSD. Link to comment Share on other sites More sharing options...
rich Posted April 11, 2016 Share Posted April 11, 2016 forceSingleUpdate would *not* cause physics calculation issues at all. In fact it's now enabled by default in 2.4.7 and on. Skuzzi 1 Link to comment Share on other sites More sharing options...
Arcanorum Posted April 11, 2016 Share Posted April 11, 2016 Do you get the same results on other browsers? Can you put the game up running somewhere so we can try ourselves, or just the code? Skuzzi 1 Link to comment Share on other sites More sharing options...
WombatTurkey Posted April 11, 2016 Share Posted April 11, 2016 Example code? Post it on jsfiddle or something so we can take a look Are you using Phaser.CANVAS as your rendering mode perhaps? Skuzzi 1 Link to comment Share on other sites More sharing options...
Skuzzi Posted April 11, 2016 Author Share Posted April 11, 2016 var game = new Phaser.Game(672, 672, Phaser.AUTO, ''); var map; var layer; var player; var cursors; var mainState = { preload: function() { // Load in tilemap data game.load.tilemap('testmap', 'levels/pacmanlevel.json', null, Phaser.Tilemap.TILED_JSON); // Load in tileset game.load.image('tiles', 'assets/pacmansprite.png'); game.load.image('player', 'assets/pacman.png'); }, create: function() { game.time.advancedTiming = true; game.stage.backgroundColor = '#000000'; map = game.add.tilemap('testmap', 512, 512); map.addTilesetImage('pacmansprite', 'tiles'); layer = map.createLayer(0); layer.resizeWorld(); player = game.add.sprite(32, 32, 'player'); game.physics.enable(player); cursors = game.input.keyboard.createCursorKeys(); }, update: function() { game.debug.text(game.time.fps || '--', 2, 14, "#00ff00"); if (cursors.up.isDown) { player.body.velocity.x = 0; player.body.velocity.y = -200; } else if (cursors.down.isDown) { player.body.velocity.x = 0; player.body.velocity.y = 200; } else if (cursors.left.isDown) { player.body.velocity.y = 0; player.body.velocity.x = -200; } else if (cursors.right.isDown) { player.body.velocity.y = 0; player.body.velocity.x = 200; } }, }; game.state.add('mainState', mainState); game.state.start('mainState'); Here the code is. It does however run fine with forceSingleUpdate. If that does not cause any issues that will be a good solution. And I had the same problems in both IE / Chrome. Did not try Firefox. I can try on Firefox if anyone is interested. Link to comment Share on other sites More sharing options...
WombatTurkey Posted April 11, 2016 Share Posted April 11, 2016 4 hours ago, Skuzzi said: The issue also seems to be replicable when I switch back and forth between the tab the game is on and another random tab. Your code looks fine to me. You can add (in create) game.stage.disableVisibilityChange = true; as well so your game runs while the browser is unfocused (not minimized). 4 hours ago, Skuzzi said: I would love to use Phaser but these issues make me want to consider a traditional desktop environment, If you want to the game to continue to run while minimized you will need to use the latest NW.js SDK and add "chromium-args" : "--disable-raf-throttling", to your package.json. This should help with your 'Desktop Environment' feeling. These tricks can make it seem like a 'native' app Link to comment Share on other sites More sharing options...
noway Posted April 12, 2016 Share Posted April 12, 2016 15 hours ago, rich said: forceSingleUpdate would *not* cause physics calculation issues at all. In fact it's now enabled by default in 2.4.7 and on. Any updates on when 2.4.7 will be released? It seems like it's going to improve a lot of things about Arcade physics! Link to comment Share on other sites More sharing options...
Recommended Posts