Frame Rate Independent Physics Implementation

4 replies [Last post]
User offline. Last seen 12 weeks 1 day ago. Offline
Joined: 29 Aug 2011

I have searched the forums and only noticed one post pertaining to this issue from over a year ago, with no real solution.

While going through the prototyping stages we have run into quite a snag. Our game is physics reliant, it involves the player using precise timing to get the main character sprite around a series of objects by orbiting them. There is a small margin for error when playing the game, and as such the physics implementation has to be close to perfect.

The problem arises when testing our game out on lower end devices where the frame rate will hover around 30fps. This wouldn't be a huge deal but it seems that the physics steps are locked to our default framerate of 60fps, making the game appear to play at half speed.

To add insult to injury, the physics act completely differently at the lower framerate, making the game close to unplayable on those devices. You can test this out by changing the framerate to 60fps in practically any of the 'physics' sample code examples that come with the SDK. It is most apparent in the 'Bullet' example.

This is a known issue with Box2D, but any available solutions cannot be implemented using Corona. Here is a little more info on frame rate independence and how to achieve it for your own game.

It is very important to us to have a high standard of quality, so having the game running at 60fps is a must. The solution isn't to limit ourselves to 30fps as if the frame rate drops below 30, it will still affect the physics. This problem can affect anyone's game, but it is much more likely to happen when a game is running at 60. I really hope we can find a solution to the problem, maybe there is just something I am overlooking.

Corona is such a great platform that is built to run on a variety of devices, so a limitation like this is really surprising. Implementing frame rate independent physics, or even the option for implementing it ourselves, would really make it stand out that much more!


Erik W.
User offline. Last seen 21 weeks 1 day ago. Offline
Joined: 1 Feb 2011

I'm loving Corona so far and have one app that's almost ready for submission, but I haven't used the physics engine yet. I'm also in the early stages of a physics-based 2D racing game and I can already see this being a show-stopper for me too. I have a bit of experience with Unity (which is great for 3D, but a huge pain for 2D) and it doesn't have this problem. It has a fixed physics timestep that you can set, as well as max timestep and even timescale -- which is also absent from Corona.

I noticed on the roadmap page it says "Improvements to Physics API" is coming. Could this be some of the things being fixed? If someone at Ansca could chime in on this it'd be awesome.

User offline. Last seen 1 year 41 weeks ago. Offline
Joined: 27 Jul 2011


application =
    content =
            fps = 60,

in config, will keep fps at 60.

User offline. Last seen 40 weeks 18 hours ago. Offline
Joined: 17 Aug 2011

Moved to a more suitable forum.

@anddrewscott : That will only set your desired framerate, it is impossible to keep something at 60fps no matter what, it depends on several factors and what is going on in your game as to whether or not your game can constantly attain a solid 60fps.

User offline. Last seen 12 weeks 1 day ago. Offline
Joined: 29 Aug 2011

Considering this may well be a bug, we have it filed under case #8292 if it helps you guys along with the issue at all.

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.