Jump to content

Adjusting game speed for different devices using ARCADE Physics


Recommended Posts

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





Link to comment
Share on other sites

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).



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...