Saturday, June 4, 2011

On the Relentless Death Engines of Isaac Newton

Assumptions were made.

Specifically, that if I planned to create a game simulating, to some extent, the vagaries of Newtonian space, that I would need to employ what is, in the parlance of les programmeurs, a "physics engine."

Physics: it's everywhere!
Upon consideration and note-taking and scribbling (in the fine iPad app known as Penultimate, though I prefer Notes Plus for things I might need to present to others) I realized that it may be possible to emulate a number of physics-like properties by extending cocos2d sprites without subjecting myself to the agony of physics frameworks.

Not that physics frameworks aren't wonderful things. It's just that Box2d and Chipmunk are in C++ and C, respectively, and I'd like to get a better handle on cocos2d itself before moving on to new jungles with new tigers.

I lost track of which was which.
The plan was to do a cage match, in which the framework which caused me less cognitive stress in the tutorial would emerge victorious. But since both made me want to stab my cranium with chopsticks* this plan was abandoned in favor of extending CCSprite and just faking the physics till I have no alternative, at which point the algorithms should be transferable and my grasp of cocos2d should be firmer.

Which is to say, my verdict on the Box2d vs Chipmunk non-debate is: they both suck if this is your first try at making a game. Chipmunk has an Obj-C port which is super exciting up to the moment you find out it costs $200 to license. And the separation between the physical representation of your world and the visual representation of your world is frustrating. Perhaps as I continue I'll find a good reason for this. Objective-C's delegates would seem to lend themselves to conveniently adding physical properties and interaction to visual objects, or vice versa, but alas.

A brief note on tutorials available: there is indeed a lovely series right here, but it includes some unsavory coding practices, including magic numbers, poor factoring, and unnecessarily costly algorithms.

* A maneuver indicating distress of the brain, immortalized by the renowned pop culture commentator R. Cota after being subjected to the film 'Gone in 60 Seconds.'

No comments:

Post a Comment