Lots of coins simulated in Bullet -> coin pusher arcade game
Posted: Fri May 22, 2009 5:04 pm
Hi
here's a quick youtube video showing what I am up to. http://www.youtube.com/watch?v=74C61A-wzaA
UPDATE: check out second posting for HD clip of a working prototype
My goal is to be able to simulate 500 to 1000 coins with Bullet in order to re-create a penny pusher arcade game. Right now things get slow at about 70-100 coins (Dual Athlon MP @ 2 GHz, SSE acceleration, no SSE2 available),
I post here to get some advice regarding the physics. My code is based on the osgbullet sample, except that I use cylindrical objects instead of a sphere (this code sample uses btSequentialImpulseConstraintSolver as constraint solver, btAxisSweep3 for broadphase, btCollisionDispatcher with btDefaultCollisionConfiguration for the collisions).
I opted to make my base units millimeters instead of meters. So the coins have a 5mm radius, 1mm thickness (a 10:1 ratio of diameter vs height - this should be OK I guess). My simulation time step is currently 1/200 of a second.
I ended up using a gravity vector of 9.81 * 100 only - realistically this should be 9.81 * 1000 (i.e. 9.81 m/sec*sec). But when I tried the latter options, the coins started bouncing on the ground uncontrollably. Strangely enough, using only 10% of the earth's gravity appears to look realistic enough. I might stick with this.
When I allow the coins to enter sleeping state, they stop rotating/spinning when their speed gets lower than the sleep threshold, but instead of truly resting they keep vibrating on the ground plane, as if they were held in place by a series of upward impulses. Also I notice that coins stacked on top of each other keep sliding apart, as if the entire coin stack was placed on some kind of shaker mechanism.
It's the "sliding apart" effect that I would like to get under control - it might make the game too easy because coins would just slide off the pusher and might end up getting won by the player. Are there any switches that I could use to reduce the vibration+slide effect?
And finally, which settings might make the physics scale to more coins? Right now I am getting trouble at 70 coins or more, but a real arcade might contain hundreds of those. I could try running the CUDA accelerated broadphase algorithm, but that's only accelerating one piece of the physics puzzle. Is there anything I could try to make this scale better? Multithreading? Changing algorithms? Tweaking some settings? I am open to suggestions.
Christian
here's a quick youtube video showing what I am up to. http://www.youtube.com/watch?v=74C61A-wzaA
UPDATE: check out second posting for HD clip of a working prototype
My goal is to be able to simulate 500 to 1000 coins with Bullet in order to re-create a penny pusher arcade game. Right now things get slow at about 70-100 coins (Dual Athlon MP @ 2 GHz, SSE acceleration, no SSE2 available),
I post here to get some advice regarding the physics. My code is based on the osgbullet sample, except that I use cylindrical objects instead of a sphere (this code sample uses btSequentialImpulseConstraintSolver as constraint solver, btAxisSweep3 for broadphase, btCollisionDispatcher with btDefaultCollisionConfiguration for the collisions).
I opted to make my base units millimeters instead of meters. So the coins have a 5mm radius, 1mm thickness (a 10:1 ratio of diameter vs height - this should be OK I guess). My simulation time step is currently 1/200 of a second.
I ended up using a gravity vector of 9.81 * 100 only - realistically this should be 9.81 * 1000 (i.e. 9.81 m/sec*sec). But when I tried the latter options, the coins started bouncing on the ground uncontrollably. Strangely enough, using only 10% of the earth's gravity appears to look realistic enough. I might stick with this.
When I allow the coins to enter sleeping state, they stop rotating/spinning when their speed gets lower than the sleep threshold, but instead of truly resting they keep vibrating on the ground plane, as if they were held in place by a series of upward impulses. Also I notice that coins stacked on top of each other keep sliding apart, as if the entire coin stack was placed on some kind of shaker mechanism.
It's the "sliding apart" effect that I would like to get under control - it might make the game too easy because coins would just slide off the pusher and might end up getting won by the player. Are there any switches that I could use to reduce the vibration+slide effect?
And finally, which settings might make the physics scale to more coins? Right now I am getting trouble at 70 coins or more, but a real arcade might contain hundreds of those. I could try running the CUDA accelerated broadphase algorithm, but that's only accelerating one piece of the physics puzzle. Is there anything I could try to make this scale better? Multithreading? Changing algorithms? Tweaking some settings? I am open to suggestions.
Christian