Bullet performance on iPhone & iPod Touch

User avatar
sio2interactive
Posts: 31
Joined: Tue Jul 29, 2008 10:26 am

Bullet performance on iPhone & iPod Touch

Post by sio2interactive »

Is there anyway too speed up the performance of bullet at the cost of less precision. I got a game level running on iPhone when physic is OFF Im around 20+ FPS, as soon as I start stepping in the simulation "btDiscreteDynamicsWorld->stepSimulation( dtime, 0 )" the FPS goes down at like 5+.

I don't really care if the simulation is like "super precise" I just want to speed up the overall physic calculation. Im already using #define USE_APPROXIMATION 1 and have modify the following parameters in btDefaultCollisionConfiguration.h:

// To use less memory...
m_defaultMaxPersistentManifoldPoolSize( 1638 ), //65536
m_defaultMaxCollisionAlgorithmPoolSize( 1638 ), //65536
m_defaultStackAllocatorSize( 131072 ) // 5 * 1024 * 1024

Is there anything else I can do to speed it up?

Tks in advance!

Cheers,
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Bullet performance on iPhone & iPod Touch

Post by sparkprime »

You haven't given any information about the simulation. How many bodies? Are they sparse or dense? What collision shapes? How many are static? What broadphase are you using? Can you run a profiler of some kind?
User avatar
sio2interactive
Posts: 31
Joined: Tue Jul 29, 2008 10:26 am

Re: Bullet performance on iPhone & iPod Touch

Post by sio2interactive »

Well take a look: http://www.youtube.com/watch?v=0vmgNJWJ1ug&fmt=18

It's pretty basic...

The terrain is divided in 3 static meshes and the monkeys are ConvexHull all the rest are their respective shapes. For the broadphase I use:

const btVector3 worldAabbMin( -1000.0, -1000.0, -1000.0 );
const btVector3 worldAabbMax( 1000.0, 1000.0, 1000.0 );

btBroadphaseInterface = new btAxisSweep3(worldAabbMin, worldAabbMax, 1638 );
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Bullet performance on iPhone & iPod Touch

Post by sparkprime »

i suppose you'll have to get some kind of profiling in there, even if it's just some hacked up debug output

you could try using the bvh broadphase instead but otherwise there's no point in guess

do some experiments

try just one dynamic body

try removing the terrain

try removing half the terrain

etc
User avatar
sio2interactive
Posts: 31
Joined: Tue Jul 29, 2008 10:26 am

Re: Bullet performance on iPhone & iPod Touch

Post by sio2interactive »

Is there any tutorials, can't seems to find anything in demos....
User avatar
sio2interactive
Posts: 31
Joined: Tue Jul 29, 2008 10:26 am

Re: Bullet performance on iPhone & iPod Touch

Post by sio2interactive »

What I mean is "is there a tutorial out there on the different broadphase that you can use?"
User avatar
sio2interactive
Posts: 31
Joined: Tue Jul 29, 2008 10:26 am

Re: Bullet performance on iPhone & iPod Touch

Post by sio2interactive »

Allright forget about all the fuss I got it ;)
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Bullet performance on iPhone & iPod Touch

Post by Erwin Coumans »

Are you using a btConvexHullShape for the monkeys?

How many vertices are the moneys?
If there are more than 32 vertices, please try to reduce the number of vertices, by using the btShapeHull utility:

Code: Select all

btShapeHull shapeHull( originalMonkeyShape );
shapeHull.buildHull(0.01);
btConvexHullShape* newSimplifiedMonkeyShape = new btConvexHullShape(shapeHull.getVertexPointer(),shapeHull.numVertices());
Also, you can use the btDbvtBroadphase instead of btAxisSweep3 broadphase.
Hope this helps,
Erwin
User avatar
sio2interactive
Posts: 31
Joined: Tue Jul 29, 2008 10:26 am

Re: Bullet performance on iPhone & iPod Touch

Post by sio2interactive »

Allright good stuff, I definetly see an improvement!

Cheers!
rubenjavier
Posts: 1
Joined: Mon Sep 01, 2008 5:27 pm

Re: Bullet performance on iPhone & iPod Touch

Post by rubenjavier »

very cool indeed... did you used a dynamic or a kinematic charactercontroller? I havent been able to get the kinematic character to interact with the dynamic objects, and your character seems to lack the inhertia problems of a dynamic character controller but it collided with the cones... so I was wondering, did you found a way to collide the kinematic character with the dynamic objects?