适合在iOS上使用Core动画vs使用Cocos2D和OpenGL ES? [英] Suitability of using Core Animation on iOS vs using Cocos2D and OpenGL ES?

查看:201
本文介绍了适合在iOS上使用Core动画vs使用Cocos2D和OpenGL ES?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一本书中完成了突围游戏教程,但是球,这是一个20x20像素的图像,跳过帧,而不是非常流畅地移动。这就是模拟器以及iPhone 4S(真实的东西)的情况。代码没有使用 NSTimer (可能更慢),但使用 CADisplayLink UIImageView setFrame 做动画。

I finished a breakout game tutorial in a book, but the ball, which is a 20x20 pixel image, was skipping frames and not moving very smoothly. That is the case on the Simulator as well as on an iPhone 4S (the real thing). The code wasn't using NSTimer (which may be slower), but was using CADisplayLink and UIImageView setFrame to do the animation.

iOS上的Core Animation不是非常适合开发动画类型的游戏吗?说如果它是一个游戏

Is Core Animation on iOS not very suitable for development animation type of games? Say if it is a game of


  1. 入侵者( Space Invaders

  2. 突破(作为教程中的游戏)

  3. Arkanoid

  4. Angry Birds / Cut the Rope / Fruit Ninja

  1. Invaders (Space Invaders)
  2. Breakout (as a game in a tutorial)
  3. Arkanoid
  4. Angry Birds / Cut the Rope / Fruit Ninja

对于这些类型的游戏,Core Animation真的适合写(2)上面?对于(1),(3)和(4),Cocos2D或OpenGL ES更适合做这项工作。而Cocos2D和OpenGL ES的性能非常接近。这是真的吗?

For these types of games, is Core Animation really suitable for writing (2) above? For (1), (3), and (4), either Cocos2D or OpenGL ES is more suitable of doing the job. And the performance of Cocos2D and OpenGL ES are very close. Is that true?

推荐答案

Cocos2D经常被看到,因为它容易编写常见的游戏逻辑,如碰撞检测和sprite动画,逐帧,缩放和其他在游戏开发中非常常见的过程,其中您将多个动画串在一起,组合然后,对它们排序,做回叫等等。这是引擎的一大优势。

Cocos2D is often looked at because of its ease for programming common game logic, like collision detection and sprite animations, frame-by-frame, scaling and other processes that are quite common in game development, where you string together multiple animations, combine then, sequence them, do call backs, and more. That is one of the big benefits of the engine.

但是,性能是另一回事。 Cocos提供批处理节点,它将所有图形元素组合成一个OpenGL调用,而不是在每个框架中分别绘制到屏幕上;这可以显着提高性能,特别是对于大型图形。如果你有跳帧,我不知道Cocos中的批处理精灵是否会是缺少的链接。

However, performance is another. Cocos offers batch nodes, which combine all graphic elements into a single OpenGL call, rather than "drawing" each to the screen separately in each frame; this can dramatically improve performance, especially for large graphics. If you had skipping frames, I wonder if batch sprites in Cocos would have been the missing link.

我对Core Animation感到非常深刻,希望它能在游戏中保持自己的性能问题。我的理解是,CA像Cocos一样,也是建立在OpenGL ES的基础之上,所以我期望它可以在任一方面取得好的结果。它可能是这样做在Cocos更容易,因为它已经为游戏开发内部设计和优化。

I'm very impressed by Core Animation and want to hope that it can hold its own with performance issues in games. My understanding is that CA is, like Cocos, also built on top of OpenGL ES, so I'd expect it possible to achieve good results in either. It could be that doing so in Cocos is easier simply because it has been designed and optimized internally for game development.

这篇关于适合在iOS上使用Core动画vs使用Cocos2D和OpenGL ES?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆