开发者

Conceptual iPhone 2d game dev question. Quartz? Cocos2d? Chipmunk? Box2d?

I am new to iPhone dev and would like to write a game that involves 2d collisions. Would somebody give me a conceptual overview on how the various frameworks interact in a typical 2d collision game?

The candidates I see mentioned so far are 2d packages such as quartz and cocos2d and physics engines such as chipmunk and box2d. What I am not extremely clear is the relationships among these in my context.

Thanks i开发者_JAVA百科n advance for answering!


Quartz is a 2D graphics API by Apple. It's usually not used for performance-intensive games, because you can get better performance by using OpenGL directly or by using some thin framework made for games. (Which is what Cocos2D provides.) The collision stuff is independent on this debate, since the collisions are usually calculated without knowing anything about the graphic representation of the colliding objects.

The relationship between collision (or general physics) engines and the graphic layer is exactly the relationship between a model and a view in the MVC pattern. In each frame you move the physical world a bit forward (physics) and then you draw the objects on their new positions (graphics).

In reality the model and view sometimes blend a bit to make things faster, but in principle they are completely separate things. Which means you can pick any of the possible combinations of OpenGL, Quartz or Cocos2D as the graphics engine and Box2D or Chipmunk as the physics engine and get a decent game. I'm not sure how well do the particular combinations work in practice - if that was your question, then I've just wasted a few minutes of your life :-)


zoul got it right, I would just add this :

Cocos2d for iPhone provides samples including Box2D and Chipmunk if you want to try them and see how easy or hard they are to use. So you can go ahead and download Cocos2d, then play with the samples a bit to see if it fits your needs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜