We are working on a game that requires the use of replays. We have been working with ODE for several years now, and the replays work fine, so the internal game code is solid, but for some reason, I can not seem to get bullet to be deterministic.
I have attempted everything that I can think of at this point, including a ton of stuff from the forums and external documentation, including:
Using the btSequentialImpulseConstraintSolver with the rand flag disabled (I disabled all btSolverMode flags for the sake of sanity at this point)
Removing all geometries and adding them back in to ensure the broad phase pairs are in the exact same order.
Resetting all velocities, positions, translations, forces yadda yadda
But still, for the life of me, this thing will not be deterministic.
I am in the process of dumping the states of all collision objects in the world at the beginning of the simulation, but that is going to take me a while. Maybe, if I am lucky, I will find something in there.
Any thoughts or ideas?
Thanks,
Brandon
Determinism - Its a real pain
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Determinism - Its a real pain
Are you using Bullet 2.73 sp1 with the btAxisSweep3 broadphase? If so, you need to call the resetPool method.
See also http://code.google.com/p/bullet/issues/ ... &start=100
Try using the following steps for determinism/reproducability:
Erwin
See also http://code.google.com/p/bullet/issues/ ... &start=100
Try using the following steps for determinism/reproducability:
- Remove all rigid bodies from the world.
- Reset the properties of each rigid body to the initial values.
- Reset the activation state for each rigid body. E.g., for dynamic rigid bodies I do the following:
object->forceActivationState(ACTIVE_TAG);
object->setDeactivationTime(0); - For btAxisSweep3-broadphases, invoke resetPool.
- Invoke reset (or setRandSeed) on btSequentialImpulseConstraintSolver.
- Add all rigid bodies (always use the same order).
Erwin
-
- Posts: 7
- Joined: Tue Jan 27, 2009 5:47 pm
Re: Determinism - Its a real pain
Well, good news and bad news. Good news is that this thing is definitely Deterministic now. I had to upgrade to 2.73, as the adding of the clear didn't fix it alone (I was trying to be lazy). Bad news is, things aren't colliding so well. Looks like the broadphase is screwy for some reason, as they seem to be having issues with the static world as well. At anyrate, I'll figure that out, I'm just happy this thing is completely repeatable now.
Brandon
Brandon
-
- Posts: 7
- Joined: Tue Jan 27, 2009 5:47 pm
Re: Determinism - Its a real pain -- Update
Hey Erwin,
When I posted earlier, I said that I managed to get the simulation deterministic, but I said that things were not colliding so well. Well, I finally managed to track down the issue, or at least the source causing the issue. Basically, if I go back to the previous revision of the btCompoundCollisionAlgorithm.h and btCompoundCollisionAlgorithm.cpp, the collisions work just fine between objects.
I am still having a few issues with the static world, but I suspect that is unrelated.
I will spend some time trying to figure out the specifics of why it is failing now, but I was hoping for your thoughts.
Brandon
When I posted earlier, I said that I managed to get the simulation deterministic, but I said that things were not colliding so well. Well, I finally managed to track down the issue, or at least the source causing the issue. Basically, if I go back to the previous revision of the btCompoundCollisionAlgorithm.h and btCompoundCollisionAlgorithm.cpp, the collisions work just fine between objects.
I am still having a few issues with the static world, but I suspect that is unrelated.
I will spend some time trying to figure out the specifics of why it is failing now, but I was hoping for your thoughts.
Brandon