How to best go about debugging laggy physics

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
mcmonkey
Posts: 92
Joined: Fri Apr 17, 2015 11:42 pm

How to best go about debugging laggy physics

Post by mcmonkey »

You know what's fun? When everything is broken and you don't know why!

Every once in a while, as I reload my project too many times, some unknown piece of data is getting corrupted and causing BEPU to eat far more CPU than should ever happen, as seen here:

Image

That reduces the game to below 1 FPS.

The problem is, I have absolutely no idea what is corrupt, and I'm not sure how to go about determining what would possibly cause this.

(Note: The picture is from a YourKit .NET Profiler result)


As you may remember from previous postings, I have a Voxel-based game using an adaptation of the Voxel sample you were kind enough to make for me (Thanks again so much for that!).
I'm fairly sure that data is relatively intact and functional, but do not guarantee it.
I also have "Box" shaped objects representing non-Voxel objects in the world -> I believe those are most likely to have been mis-set.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: How to best go about debugging laggy physics

Post by Norbo »

If this high broadphase expense is intermittent, I would expect a bad bounding box. Some NaNs or infinities probably snuck in somewhere. Such a bounding box would do nasty things to the broad phase structure.

Try compiling with the CHECKMATH compilation symbol defined in BEPUphysics.

Of course, it might not be NaNs or infinities but rather just bad regular numbers- in that case, CHECKMATH won't catch it. Sanity checks and visualization would likely be required then.
Post Reply