I00I
I00I

Reputation: 423

Core Animation VS. Cocos2d performance for simple games

I have been using Cocoa Touch for a while now and really like it. For my next game I want the user to be able to trace a route with there finger and have an image follow that path. Also it will involve collision detection like i.e. a wall is here. I have seen collision detection done in Core Animation, and I am aware of CGPath() and similar functions which would probably help me with tracing a path for an image to follow. So my question is why do so many people use Cocos2d when well over half of the entire framework has duplicate code to Cocoa Touch. Is there a performance issue I am missing here? Can't I make a finger tracing game like Flight Control that involves the collision detection for walls only using Cocoa Touch. I am really wanting to lay out levels in Interface Builder. The lowest build requirement I need is for the game to be able to run on iPhone3g and above, which means I can also use Storyboards as well. Does anyone see me entering a world of pain, by trying to dodge Cocos2d. Should I just break down and use that framework for this type of project?

Upvotes: 2

Views: 1198

Answers (2)

sergio
sergio

Reputation: 69027

Your question is pretty "philosophical", and I think that many developers have pondered the same kind of doubt at some point for themselves.

For me, I have used cocos2d in a couple of apps because of its "out-of-the-box" support for concepts typical of games (in the end it is a game engine): sprites and sprites sheets; native format (PVRTC textures) of the iPhone graphics chip; physics engine and collision detection. I also like to think that cocos2d does a great job at dealing with the intricacies of Open GL, saving me a lot of time (said in other words, I would program a game in Core Automation only if it did not use Open GL).

Core automation, on the other hand, is in my view a broader kind of technology, which includes supports for both Quartz and Open GL, but is somehow at an intermediate level between the underlying graphics system (be it Open GL or Quartz) and your game. By using Core Animation you will have to (re-)write much code that you already find in coco2d for free (like the three points I have highlighted above). Have a look also at this post about the topic.

Both paths can be taken, in one case you will have to master a new custom framework (cocos2d); in the other, you will need to write some "generic" code to handle basic stuff (i.e., building your own mini game engine on top of Core Automation).

Upvotes: 2

Danyal Aytekin
Danyal Aytekin

Reputation: 4215

In terms of screen content, Cocos2D is simply a wrapper around OpenGL, with many of the tasks you'd want to do in OpenGL solved for you already. OpenGL is faster than UIKit and can produce more of the graphical effects you might like to use in a game (e.g. particle effects, although you can do those in iOS5 in UIKit now).

There are simple games that have been made with UIKit though and if you're just dragging an image around with your finger, UIKit should be fast enough for that.

Upvotes: 0

Related Questions