Determinism issue on ARM platform

Post Reply
Alkane
Posts: 7
Joined: Sat Jul 10, 2010 8:34 pm

Determinism issue on ARM platform

Post by Alkane »

I'm making a small racing game for Android and decided to use Bullet as the Physics engine, so I'm using a btRaycastVehicle and some TriMesh, and so far the simulation is fine, and the speed is great.
But I've encountered an issue concerning determinism, after looking into it a bit more, it seems that the way I call stepSimulation() is the root of the problem.

I'm using a standard "Canonical Game Loop" as it's called on the wiki, in which I adjust the parameters of the RaycastVehicle and then step the physics simulation to finally draw the world.
The stepping is done using this call :

Code: Select all

// getDeltaTime() returns a float containing the delta in seconds since last call
mDynamicWorld->stepSimulation(gSettings->getDeltaTime(), 12, 0.01f);
Unfortunately, when doing it that way, the simulation is not deterministic at all :?, the app runs at a locked 30fps on this Android device (inherent to the device's GL driver), as you can see i'm also using a fixedTimestep of 100Hz because I had some collision issues with the default 60Hz.

However i found out that I can get a deterministic behavior by manually inputting the timestep :

Code: Select all

mDynamicWorld->stepSimulation(1/30.f, 12, 0.01f);
Of course, this is not a great solution since it kills the framerate independence.

So i was wondering what could be wrong with my implementation, Isn't it supposed to work just fine ? am I doing it wrong ? Shouldn't Bullet handle it just fine and interpolate the world ?
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: Determinism issue on ARM platform

Post by Flix »

Maybe this won't help to solve your problem (and I'm not completely sure of what I'm saying too :oops: !), but I believe that if you process the input at a different frequency than the Bullet time step, maybe you can get out of determinism more easily (in your second solution, the ratio between input and physic processing seems to be "more constant").

If this is not the case, I can't help you; try searching the forum for other posts about determinism... and good luck :)

P.S. I've used this approach to make the simulation experience more uniform on different machines, not because I wanted it to be deterministic...
Alkane
Posts: 7
Joined: Sat Jul 10, 2010 8:34 pm

Re: Determinism issue on ARM platform

Post by Alkane »

Thanks that helped me solve the issue.
I was indeed applying the speed of the vehicle before calling stepSimulation() which resulted in variable results, doing it in a tick callback fixed this.
Post Reply