Game Development Reference
In-Depth Information
But if you're not very familiar with C++, you may find its steep learning curve daunt-
ing. To that end, the Chipmunk physics engine may be more welcoming to you if
you're more familiar with C language syntax or prefer a lightweight implementation of
a physics engine that may be easier to pick up and learn. It's been part of the cocos2d
distribution for many months longer than Box2D has, which has also spawned more tu-
torials and forum posts about Chipmunk, although Box2D tutorials are catching on.
Chipmunk also offers several commercial versions from Indie to Enterprise Editions;
the higher-end editions include additional performance optimizations and an Objective-
C API. Learn more about the commercial version features here:
http://chipmunk-physics.net/chipmunkPro.php .
One warning ahead of time: Chipmunk uses C structures , which expose internal fields.
If you're experimenting and don't know what certain fields are used for, and they're
not documented, that means you shouldn't change them—because they're used only in-
ternally.
There is also the popular Chipmunk SpaceManager, which adds an easy-to-use
Objective-C interface to Chipmunk. SpaceManager also makes it easy to attach
cocos2d sprites to bodies and adds debug drawing, among other things. You can down-
load Chipmunk SpaceManager here: http://code.google.com/p/
chipmunk-spacemanager . Unfortunately, at the time of writing the latest version
0.1.3 of SpaceManager isn't compatible with cocos2d 2.0. I'm sure a compatibility up-
date will be made eventually.
In terms of functionality, you can safely choose either engine. Unless your game relies
on one particular feature that one physics engine has and the other doesn't, you can use
either to great effect. Especially if you have no familiarity with either one, feel free to
choose the one that appeals to you more, based on the language and coding style.
The rest of this chapter introduces you to the basics of both physics engines so you can
decide for yourself which one appeals to you more. In Chapter 13 , you'll learn how to
build a playable pinball game with bumpers, flippers, and lanes built with Box2D and
the VertexHelper tool.
Box2D
Search Nedrilad ::




Custom Search