[ODE] ODE freezes, can you help?

Martin C. Martin martin at metahuman.org
Wed Dec 18 12:18:01 2002


Ivan Bolcina wrote:
> 
> Hi Martin.
> 
> I think I found the bug. I looked test_chain1.cpp in examples and found this
> dWorldSetGravity (world,0,0,-0.5);
> 
> I didnt have this line in my code. Everything else was completly identical.
> So, after adding this line in my code, it miracely worked. It also tried to
> set
> 
> dWorldSetGravity (world,0,0,0);
> 
> but then, it froze again. Could it be ode bug?

Could be, but unlikely.  My guess is that something else is causing your
problem, something that only happens once in a while.  If that's true,
it'll probably appear and disappear again as you change your program.

So, you have two choices.  Either understand what's going on, or hope that
it won't come back.  While hoping may work once in a while, if you use it
most of the time, bugs will come back to haunt you.  Once your program
gets much bigger, they'll be much harder to find.

Remember, the size of a program that you can design and write is bigger
than the size of a program you can understand and debug.  You're better
off writing programs whose behaviour you can understand, than programs
that develop weird bugs you can't track down.

> I think it spent all this 5
> or even more seconds in steeping the world. Some math stuff, I think.

Did you use clock() to compute how much time you're spending in each part
of your main loop?  You'll often be surprised.

> One more question. I am having big trouble debuging. You, on the other hand,
> seem to master this stuff. Can you please describe, which tools you use and
> how.

Any introductory programming book should teach you the basics of
debugging, I can't go into it here.  But basically, you should know what
the difference is between a debug build and a release build (debug build
doesn't have many optimizations.  Why?), how to create one or the other,
how to step breakpoints, step through code, and find the values of various
variables and statements in the debugger.  You should also not
underestimate the power of printing reams of info, but it seems you're
already doing that.

> I am working with MS VS7, developing full screen directx game. 

You should be able to start your game either full screen or windowed.  It
will take you time to figure out how to start windowed instead of full
screen; but you'll save much more time on debugging.  If you don't know
DirectX well enough to switch from full screen to windowed, and you can't
find a library or other programmer to do it for you, see the comment above
about size of debuggable program vs. size of writable program.

Good luck,
Martin