valueerror Posted November 26, 2014 Share Posted November 26, 2014 in the dev branch i found this new feature to cap the physics update rate (desiredFPS) very useful.. 50fps for example are definitely enough for me - 40fps would still do it .. i would have to adjust my game environment a little bit but thats it.. if 40fps is enough for my physics calculations why waste another 20fps on rendering the whole thing? as far as i understand with a framerate of 60fps all my scripting stuff has something around 16ms to do everything.. with 30fps it would be 32ms .. this would definitely avoid lags so im curious.. please correct me if i'm wrong ! how could i limit the maximum rendered frames in phaser/pixi ? Link to comment Share on other sites More sharing options...
eguneys Posted November 26, 2014 Share Posted November 26, 2014 This might helphttp://www.html5gamedevs.com/topic/9394-update-function-call-rate/?p=55626 Link to comment Share on other sites More sharing options...
valueerror Posted December 9, 2014 Author Share Posted December 9, 2014 thx for the answer but i don't see how this could help.. i tried to set every value related to "time" manually but it didn't change anything i don't know if this is even a good idea.. i just hoped to get some info on this.. Link to comment Share on other sites More sharing options...
achexi Posted December 9, 2014 Share Posted December 9, 2014 In pixi to do the same thing I separate the draw + game logic calls and use set time out e.g. setTimeout(Draw, 1000/50); instead of requestanimframe. Not sure if the same thing can be done with phaser. Link to comment Share on other sites More sharing options...
valueerror Posted March 16, 2015 Author Share Posted March 16, 2015 now this issue became even more important to me.. i am moving some of my objects 10px every frame.. if the gamer has a 100hz display the game would probably run at 100fps .. and therfore close to twice as fast... i could bind the movement to a specific time frame but if there was a way to just say to phaser.. "don't you ever render more than 60fps" it would be nice. is there a way ??? Link to comment Share on other sites More sharing options...
CtlAltDel Posted March 16, 2015 Share Posted March 16, 2015 Don't move them 10px every frame, move them 10px / 16ms. Fix your timestep: http://gafferongames.com/game-physics/fix-your-timestep/ Link to comment Share on other sites More sharing options...
valueerror Posted March 16, 2015 Author Share Posted March 16, 2015 would you implement you own timer in some way to do this or should i just rely on phasers timer game.time.events.loop(16, moveittenpixels); ? thank you ! Link to comment Share on other sites More sharing options...
valueerror Posted March 16, 2015 Author Share Posted March 16, 2015 i tried it with the game.time.loop it kinda works but it doesn't look smooth anymore.. Link to comment Share on other sites More sharing options...
CtlAltDel Posted March 16, 2015 Share Posted March 16, 2015 You can check in the update() func and keep track of time elapsed.. I believe game.time.physicsElapsed is what you need. And then move the correct amount of pixels. Link to comment Share on other sites More sharing options...
valueerror Posted March 16, 2015 Author Share Posted March 16, 2015 thx .. i'll have a look at "game.time.physicsElapsed"i tried this approach.. what do you think ? if (game.time.now > timeDelta1) { ufer.tilePosition.y += slidespeed; timeDelta1 = game.time.now + 16;} Link to comment Share on other sites More sharing options...
Recommended Posts