How to force a fixed time step for the world simulation?

I want the world to evolve deterministically, independent of how long it takes to render the frame.

Or in other words, in 2D, I want the step that is passed to b2World::Step to be always the same.

It is fine if that leads to a non responsive UI, and it is also fine if I have more than one step per frame.

I’ve put a cout next to b2World::Step of a simple program, and the step value is not always the same.

urho2D does not support fixed yet, but you can setMaxFps(60)

1 Like

Thanks. Why setMaxFps(60) could help?

Neither Bullet nor Box2D are deterministic. Do you use physics?

Thanks. Why setMaxFps(60) could help?

timeStep wiil be stable (of course, not on a weak computer)

Neither Bullet nor Box2D are deterministic. Do you use physics?

bullet use fixedStep

It doesn’t make Bullet determenistic, unfortunatelly.

Hmmm, Box2D is deterministic given a single binary, which is at least enough for debugging properly: https://github.com/erincatto/Box2D/wiki/FAQ which is already good enough for me.