Thursday, December 23, 2010

Musings on wants, goals, and the status of the towel

At last, it has come to this.

I have ultimately decided to forego writing my own physics engine and collision detection routines in favor of the seemingly robust and open-source Open Dynamics Engine (used in such popular titles as Call of Juarez and World of Goo).

My reasoning for this is that, while I'm very fond of the idea of writing my own and the sense of personal accomplishment that would accompany it, I realized that my goal is not actually to write a physics engine, but to write a game. So I've set my pride aside and have begun the integration of ODE into Rustbot.

I'm experiencing some odd anomalies, though. For instance, objects are not moving. I can add objects and render them, but their positions are not being updated as they should according to gravitational pull. Even further confusing is that without the presence of this line of code:

const dReal *p;

the program crashes when an object is added. No, the variable p is not actually used anywhere. It was a temporary variable used here:

p = dBodyGetPosition(gameObjects->Body);
cout << p[0] << ' ' << p[1] << ' ' << p[2] << '\n';

in order to display an object's position. But despite having removed any and all reference to the variable, the program will crash without declaring it. Note that it will compile without it (verifying that all references have been removed), but will crash when the method containing it is called. It seems like the memory allocation is masking a separate bug, one whereby memory is accessed improperly. Without the allocation, it crashes as though by an index-out-of-range error.

If I can work out these few kinks, it seems as though I'll be on the right track to eliminating steps 5 through 9 on the to-do list. That's pretty sweet.

Oh, and the towel - it has been thrown.

No comments:

Post a Comment