Constraint perforfmance drop

Post Reply
m1d1
Posts: 2
Joined: Fri Aug 05, 2016 11:04 am

Constraint perforfmance drop

Post by m1d1 »

Hello. im trying to integrate ragdoll physics into one old game. Its pretty much done and works well, but theres an issue:
to get rid off constraint stretching i decreased substep time to 0.0016.. (inc. num. substeps) and it causes strange performance drop which comes after like 2-5 seconds (16-20ms to 600-3000ms/cycle) for only one ragdoll (11 constraints(conetwist/hinge)) with default 10 solver interations. It doesnt appear with 1 solver interation (constraint->setOverrideNumSolverIterations(1), with world->getsolverinfo->numinterations doesnt work), but it comes back with 10 ragdolls. Anyway i noticed some 50-70ms spikes with default 1/60 substep too.
Any suggestions? Thank you.
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: Constraint perforfmance drop

Post by benelot »

Hi m1d1,

Is your game summing the time it should progress in physics for the actual time passed and does not cap this time in any way? Because this sounds like your physics step is not able to keep up with the game time step. Therefore, it runs into the feeback cycle of using more time to finish the physics step than expected and then takes even more time in the next physics step as it need to step forward even more physics time.

If so, please read gaffer on games: fix your timestep to fix the game. It might be cumbersome to do it right, but it is worth the time. If you need a code example that works in bullet, search for the TimeWarpExample I posted here on the forum a while ago.
Post Reply