Hi, I'm looking at using the bullet library and I have a couple of questions.
First, does the library support 2D physics? I can see in the example projects that it supports 3D physics constrained into 2D, but does it support the physics of real 2D objects?
Second, is the library deterministic? In particular I want to know whether I could create game replays using bullet from the game's initial conditions and user input.
Thanks in advance.
A few questions (2D, determinisitc)
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: A few questions (2D, determinisitc)
Bullet supports proper 2D rigid body simulation as shown in the Bullet/Demos/Box2dDemo. It uses the 2d btBox2dShape and btConvex2dShape with dedicated 2D collision algorithms. The constraint solver has built-in support to reduce the degrees of freedom without adding additional constraints. The Box2dDemo uses 3 degrees of freedom for 2D objects: 2 linear dofs and 1 angular dof, using 'setLinearFactor' and 'setAngularFactor',just like a 'real' 2D physics engine would do. The added benefit is that Bullet supports interaction between 2D and 3D objects. This Bullet 2D solution is more efficient then using additional 'planar' constraints to keep the objects moving in a 2D plane.Poita_ wrote:First, does the library support 2D physics? I can see in the example projects that it supports 3D physics constrained into 2D, but does it support the physics of real 2D objects?
Yes, Bullet can be configure to be deterministic for a specific platform/compiler version, so you can replay games from original state and input on the machine it has been played. Note that on machines with different OS, CPU, compiler etc, the simulation will be different, so for networking physics you will need some synchronization.Second, is the library deterministic? In particular I want to know whether I could create game replays using bullet from the game's initial conditions and user input.
Hope this helps,
Erwin
-
- Posts: 9
- Joined: Sun Oct 04, 2009 10:00 am
Re: A few questions (2D, determinisitc)
Thanks Erwin.
About the determinism, I need the replay to run not just on the same machine it was created on, but on all machines.
Assuming this is all going off the one binary (compiled once for all machines), would it not run the same on all x86-64 CPUs assuming I also turned off GPU acceleration? I was under the impression that all x86-64 processor floating point calculations are identical. I know for a fact that Supreme Commander replays works this way across all x86 CPUs, and I have even verified personally that floating point calculations on x86 and ARM{6,7} architectures are the same.
Thanks again.
About the determinism, I need the replay to run not just on the same machine it was created on, but on all machines.
Assuming this is all going off the one binary (compiled once for all machines), would it not run the same on all x86-64 CPUs assuming I also turned off GPU acceleration? I was under the impression that all x86-64 processor floating point calculations are identical. I know for a fact that Supreme Commander replays works this way across all x86 CPUs, and I have even verified personally that floating point calculations on x86 and ARM{6,7} architectures are the same.
Thanks again.