Home
GGJ Archives 2009-2012

Open Source libraries help yet again

jordi.fita

I had a problem with OgreBullet library that would step on an assert which had a single and very cryptic and, I am rather sad to say, unhelpful expression: 0.

That's right. Trying to create a bullet triangle mesh from a loaded mesh file in the scene's node and adding that node to the dynamics world would end up with and assert dialog from Visual Studio with the aforementioned expression as the only clue. Needles to say, I was bewildered. (Let me add that Visual Studios' assert dialog by itself is an example of bad design. Just look how I must click on "Rety" in order to Debug... Hello? Retry? I can't understand that...)

To add insult to the injury, OgreBullet's documentation is... scarce... at best. So, how could an overly tired programmer find the fault (that must be his own) in a situation like this? Most of us probably would turn to almighty Google for an answer. I did, and I dare you to find something about OgreBullet in Google. Go ahead, I'll wait.

What? Disappointing say you? Yes, until you realize that you have (almost) the best documentation for a library: the source code!

I had just to go to the source code where VirtualStudio's dialog box pointed to: bullet/src/BulletCollision/CollisionShapes/btTriangleMeshSHape.cpp, line 181. And what we find here? Let's take a look:


// moving concave objects not supported
btAssert(0);

OF COURSE!! I had to use RigidBody::setStaticShape() instead of RigidBody::setShape(). The latter is for dynamic (i.e., moving) objects and my mesh (which represents a room) doesn't move at all. Such an small mistake, specially at this hour (is 7am here right now, GMT+1. Didn't sleep for 24 hours now...)

If I didn't have the library's source code I am not sure how I would have seen this so soon. I also don't know why the message isn't an string inside the assert sentence, that way the badly designed dialog box from Visual Studio would be useful, at least for that.

And don't think that this is an open source library-only issue. I've seen far worse errors from commercial libraries that have the same level of documentation and, in rare cases, the same level of "support" as open source libraries do.

Remember that when choosing a library (besides making sure the license is compatible with your work, of course.)


Follow

All rights reserved 2012-2013, Global Game Jam