Tuesday, April 19, 2011

Someday...

... I think I'll learn.

It's become apparent to me that I've deviated quite a bit from my design doc, to the detriment of good coding. I suppose you might consider the current state of Rustbot as a sort of prototype and use that as justification for my lackadaisical approach to good coding principles.

Portal 2 comes out today and, while there's a tinge of interest on my part, I'm fairly certain I'm going to delay its purchase. I'm sure it will be brilliant and yadda yadda yadda, but I haven't worked on Rustbot in nearly two weeks, and that makes me unhappy. I don't need the distractions of a new engrossing game to further set me back in development.

My object handling has been sloppy and thrown-together. I need to revisit my design doc and get a feel once again for how I was supposed to do it. What this all means is that I'm going to need to tear down some more code and rebuild. It's not quite an overhaul, but certain significant portions need to be purged and made anew.

I've been going about object joining all wrong. I've been making every contact point into a joint between two objects, which bogs down computational speed due to the system's need to calculate forces from each joint between each object. In my original design doc, I have specific objects specified as being joint objects, which act as joints between two physical objects. I should have relegated joints strictly to that definition.

The epiphany I had was that Bullet supports multi-shaped physical bodies, which means I can say "this physical body consists of two rectangles oriented like so relative to each other." They are then locked together in that orientation, and Bullet computes accordingly. THAT is what I've wanted all along. Instead , with my current method, I achieved soft connections, i.e. joints that are springy and wobbly.

So what I've identified as what needs to happen is this:

Each physical object will contain a list of shape objects that comprise the physical body. Each shape object will link to an existing renderable object (one of the three basic primitives: box, sphere, cylinder). With this method, I'll be able to add and remove shapes from the body at will (though I will need to worry about removing an object that serves as a bridge between two objects so that, if it's removed, the other objects don't float about each other like a binary star system). This is decidedly thrilling for me.

But in order to do that, I need to rewrite lots.

I welcome the opportunity to start with a clean slate, but dread the bugs inherent with my coding behavior.

I just wish I had more time to work on it. Lately my time outside of my tedious dayjob has consisted of playing Uncharted (yes, I know it's 4 years old, but I only recently got a PS3, so get off my back, Mom), watching Battlestar Galactica (yes, I know it's 7 years old, but I only recently decided to start watching it and I love it, so get off my back, Mom) and partaking (however minimally) in wedding stuffs.

Sooooo you want to give me money so I can work on Rustbot full time. It's good for your health!

No comments:

Post a Comment