hellspawn_bg Posted October 3, 2014 Share Posted October 3, 2014 Another noob question over here. Is the phaser frame rate set up to 60 frames per second, or it can go faster as long as the device supports it? Link to comment Share on other sites More sharing options...
brejep Posted October 3, 2014 Share Posted October 3, 2014 By default, Phaser is using requestAnimationFrame, see here for an explanation - http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/. It essentially keeps the timing inline with the refresh rate of the display (normally 60fps). To update more often, it looks like you could force Phaser to use timeout instead by sending the game a config option of forceSetTimeOut = true and then you could set game.time.timeToCall to a number of milliseconds less than 1000/60. Depending on what you are updating, you could always do it with a separate timer outside the main game loop. hellspawn_bg 1 Link to comment Share on other sites More sharing options...
hellspawn_bg Posted October 3, 2014 Author Share Posted October 3, 2014 My concern is not to call the update function more often than 60 frames per seconds, as in a lot of parts of my game I am using pre-generated data tweens at 60 frames. If the update function is called more often, let's say at 120 frames, the animation would appear faster. Link to comment Share on other sites More sharing options...
xerver Posted October 3, 2014 Share Posted October 3, 2014 The cap for requestAnimationFrame is 60 fps, and setTimeouts are generally not going to go any faster than ~16ms (which is ~60fps) so you can't get any higher if you wanted to with js running in the browser. hellspawn_bg 1 Link to comment Share on other sites More sharing options...
hellspawn_bg Posted October 3, 2014 Author Share Posted October 3, 2014 Thank you, xerver. Link to comment Share on other sites More sharing options...
Recommended Posts