kmp Posted November 15, 2014 Share Posted November 15, 2014 I have a game where all the movement is run by ARCADE physics. When I run the game on my desktop it runs faster than it does on my Android phone and my Kindle Fire. I would like the game to run at the same speed on all devices but, as movement is controlled by the physics engine, I cannot directly adjust sprite movement. Does anyone have a good technique for this? Ths only thing I can think of is to set an ideal rate (60 fps) - the speed on Firefox on my desktop - and change all the physics engine values in proportion to how the device matches this speed, like this: this.game.physics.arcade.gravity.y = 200 * (idealfps / actualfps); So on a desktop runing at 60fps the gravity setting would be 200 * (60/60) = 200. On a slow dvice with only 30 fps then the gravity would be 200 * (60/30) = 400 So sprites woudl fall at the same rate as on the faster machine. Is this the best way to go about it? Thanks in advance Ken Link to comment Share on other sites More sharing options...
Sam Posted November 15, 2014 Share Posted November 15, 2014 You should optimize your game for the slowest device, there are several posts on it.a simple Arcade-style game should be able to run at 60FPS on a modern mobile device.http://www.html5gamedevs.com/topic/9931-mobile-performance-tips-tricks/ Link to comment Share on other sites More sharing options...
valueerror Posted November 15, 2014 Share Posted November 15, 2014 what about this new feature in 2.2 ? game.time.desiredFps = 30;this would set the physics calculations to 30fps (independent of the actual rendered frames per second) that way the whole game would run at half the speed Link to comment Share on other sites More sharing options...
rich Posted November 15, 2014 Share Posted November 15, 2014 Everything we've been working on in the dev branch is aimed at addressing these timing issues. It will form the basis of the 2.2 release later in the month. Link to comment Share on other sites More sharing options...
kmp Posted November 15, 2014 Author Share Posted November 15, 2014 Thanks to everyone for their replies. Looks like 2.2 will help with this issue. I'll look forward to it. As a matter of interest, my android phone (Nexus 4) was giving about the same frame rate as my desktop (60 fps) - only the Kindle Fire was appreciably slower (35 fps). Ken Link to comment Share on other sites More sharing options...
Recommended Posts