frame rate independent physics?

My game relies on Corona’s physics for its core mechanic, which (unfortunately) seems to be highly dependent on the framerate of the device. For example, on the Corona sim and iPhone 4 I can eek out 60 fps and get relatively consistent results between the two, but on a slower device, like a 1st generation iPhone, the game’s framerate fluctuates and often dips below 30. This causes the game to run in slow motion since the physics steps seem to be locked to the higher framerate.

What’s worse is that the results of the physics simulation are quite different depending on the framerate. For example, a box bouncing off a wall might travel 100 pixels across the screen on a fast platform, but move 200 pixels across on the slower platform. This makes designing and tuning the game for more than one platform fruitless. The only workaround seems to be to design the game around the capabilities and framerate of the worst performing platform, which is not exactly ideal.

Since Corona is designed from the ground up to run on many platforms with varied performance capabilities I would expect the physics engine to handle framerate discrepancies better. Take a look at this actionscript demo to see how I think corona physics should behave under various framerates:
http://actionsnippet.com/swfs/qbox_FRIM.html

I have found some corona code examples of time-based animation that don’t use Corona’s physics engine, but does anyone know of a way to do it with physics enabled? [import]uid: 9422 topic_id: 4112 reply_id: 304112[/import]

I second this. I am seeing some of the same issues that you mentioned. The Physics engine tied to the framerate. I am developing purposely on and ipod touch 1st gen to minimize the effects, but sometimes the discrepancy with the higher devices is still there. I guess this one is on Ansca. [import]uid: 8192 topic_id: 4112 reply_id: 13072[/import]

Ansca, the time-based animation example TimeAnimation bouncing ball physics demo in your “getting started” code examples doesn’t use your Physics API! Instead, it fakes physics the old-school way. Cute for a demo, but I need to be able to do that using the “real” physics engine.

With the latest Corona SDK update everyone gets to use the game edition features, including physics, so now there’s no excuse. Please, if there’s a way to do time-based animation using the Box2D physics engine, show us how.

[import]uid: 9422 topic_id: 4112 reply_id: 13414[/import]

@xenonBL. I feel your pain. I have a physics based game that is totally affected by framerate drops. It’s very very frustrating, since it really destroys the game if there is a drop in frame rate at all. I wish Ansca could say a couple of words about this. It might be a hard implementation. [import]uid: 8192 topic_id: 4112 reply_id: 13496[/import]

I scaled my physics down and it made a huge difference much better performance gain.

Default is 30 i set it to 100 so 100 px = 1 m

you can use

  
physics.setScale(100)  
  

Did this after reading this,
http://www.box2d.org/forum/viewtopic.php?f=8&t=2740

and watching this
http://www.kerp.net/box2d/displaylesson.php?chapter=1&lesson=8

Hope this helps you. [import]uid: 8192 topic_id: 4112 reply_id: 13738[/import]