I'm developing what it's turning into a "cross-platform" 2D Game Engine, my initial platform target is iPhone OS, but could move on to Android or even some console like the PSP, or Nintendo DS, I want to keep my options open.
My engine is developed in C++, and have been reading a lot about Box2D and Chipmunk but still I can't decide which one to use as my Physics Middleware.
Chipmunk appears to have been made to be embedded easily, and Box2D seems to be widely used. Chipmunk is C , and Box2D is C++, but I've heard the API's of Box2D are much worse than chipmunk's API's.
For now I will be using the engine shape creation and collision detection features for irregular polygons (not concave).
I value:
1) Good API's
2) Easy to inte开发者_如何转开发grate.
3) Portability.
And of course if you notice anything else, I would love to hear it.
Which one do you think that would fit my needs better ?
EDIT: I ended up writing an article about my particular choice, you can find it here
I use both, but when I can choose, I go for chipmunk, it has much better API, and was much easier to learn...
But that was because I learned it without need for a community, the manual is completly fine.
UPDATE: My current game is using Box2D, and I wish I used Chipmunk with it... Mostly because Box2D has two serious issues, that are exacerbated on my game: First, it has a REALLY OLD bug where objects "snag" on corners, my game is a breakout game, so when the ball is "rolling" along a wall, sometimes it snag and is flung away from the wall, lots of people asked why my game physics looks "random".
The other issues that Box2D have, is how it store objects, Chipmunk use a spatial hash, and Box2D use a binary tree, my game was having MASSIVE slowdowns in levels with lots of objects, I asked Erin (author of Box2D) the reason, and he explained that because Box2D uses binary tree, if you place objects in a grid (like I said, my game is a breakout clone! everything is in a grid!) the tree gets unbalanced, and Box2D slows down. The solution for my game was make some levels into a "checkerboard" pattern to avoid this problem.
So, for all tile-based games, I will just use Chipmunk, Box2D REALLY is unsuitable for those (because the "snag" on tile corner bug, and the slowdown bug with tile grid)
You are right, chipmunk has been developed improving a lot of the places where Box2D falls down.
However, Box2D is definitely the more established platform and from my personal experience when making the decision of which engine to use, I found that Box2D had a much larger community following, so was easier to learn by example.
Chipmunk is straight C, while Box2D is C++. There is also a new set of Objective-C bindings for Chipmunk, but they are not free to use commercially.
As I understand it, Chipmunk does not support Continuous Collision Detection, but Box2D does. This is important to prevent "tunneling" (objects passing slightly through eachother when moving at high speeds)
At the end of the day, from what I hear, they're both great. If you prefer C++ to C or need continuous collision detection, you should probably choose Box2D.
If you'd rather use a pure C library, go with Chipmunk.
I personally use Box2D and my experience has been fantastic so far.
Also, I think Box2D has a different (possibly larger) set of joint types, so that could be something to consider...
精彩评论