简体   繁体   English

概念iPhone 2d游戏开发问题。 石英? Cocos2d? 花栗鼠? Box2d?

[英]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. 我是iPhone开发人员的新手,想写一款涉及2D碰撞的游戏。 Would somebody give me a conceptual overview on how the various frameworks interact in a typical 2d collision game? 有人能给我关于典型的2D碰撞游戏中各种框架如何相互作用的概念性概述吗?

The candidates I see mentioned so far are 2d packages such as quartz and cocos2d and physics engines such as chipmunk and box2d. 到目前为止,我看到的候选对象是2d程序包,例如石英和cocos2d,以及物理引擎,例如花栗鼠和box2d。 What I am not extremely clear is the relationships among these in my context. 我不是很清楚这些是我所处的关系。

Thanks in advance for answering! 在此先感谢您的答复!

Quartz is a 2D graphics API by Apple. Quartz是Apple的2D图形API。 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. 它通常不用于性能要求较高的游戏,因为您可以直接使用OpenGL或使用为游戏制作的精简框架来获得更好的性能。 (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. (这是Cocos2D提供的功能。)碰撞的内容与这场争论无关,因为碰撞通常是在不了解碰撞对象的图形表示的情况下进行计算的。

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. 碰撞(或一般物理)引擎与图形层之间的关系正好是MVC模式中的模型与视图之间的关系。 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. 这意味着您可以选择OpenGL,Quartz或Cocos2D作为图形引擎,以及Box2D或Chipmunk作为物理引擎的任何可能组合,并获得不错的游戏。 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 : zoul正确,我将添加以下内容:

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. 如果您想尝试一下,Cocos2d for iPhone提供了包括Box2D和Chipmunk在内的示例,以了解它们的易用性和难易程度。 So you can go ahead and download Cocos2d, then play with the samples a bit to see if it fits your needs. 因此,您可以继续下载Cocos2d,然后尝试一些示例以查看它是否符合您的需求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM