Archive 17/01/2023.

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

cirosantilli

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.

1vanK

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

cirosantilli

Thanks. Why setMaxFps(60) could help?

Eugene

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

1vanK

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

Eugene

It doesn’t make Bullet determenistic, unfortunatelly.

cirosantilli

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.