Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where to start for game development? UIKit vs Core Animation vs QuartzCore vs OpenGL vs cocos2D

If I was interested in getting across game development on the iPhone/iPAD any suggestions on which technology(s) to start looking into? In fact just a simple bullet on each of these technologies that highlight how it fits into typical game development would be great, as the reason for this question was me not understanding how these fit together. So in this case it's where do these roughly fit in here:

  • UIKit
  • Core Animation
  • QuartzCore
  • OpenGL
  • cocos2D

I was getting the impression that cocos2D would be the way to go, and it seems to be a simpler wrapper for OpenGL? Not sure where that leaves UIKit vs Core Animation vs QuartzCore then?

like image 223
Greg Avatar asked Nov 21 '11 20:11

Greg


1 Answers

Ok well I will try to make a rather lengthy answer short: it depends.

Now for a few longer thoughts and explanations - this is long. If you won't read it to the end, make sure you read the last few sentences.

First I need to clarify that the "technologies" or API's you have listed are mostly concerned solely with graphics (except UIKit which also handles input) and that is ok as long as you understand that the graphics is only a part (and as of my experience I might add "minor") of a whole game.

Besides the graphics, there will be quite a bit more to handle when doing a real game. In order not to get a away from the question too much let me just throw in a few buzzwords: game logic, AI, resource management, physics, interaction, networking (possibly), sound, etc. My recommendation is to get a good book on the topic and dive in [1,2].

Now that I skimmed that, back to your question:

Basically, OpenGL and QuarzCore are the core technologies to "get something drawn on the screen". All other technologies are built on top of that. So in theory, if you want to go that way, you can implement everything related to graphics output with OpenGL or QuarzCore alone (whereas you will have to account for the fact that QuarzCore is 2D drawing only, whereas OpenGL supports 3D also and 2D is really just a special case of 3D). I actually believe that Quarz is also built on top of OpenGL, but I'm unsure about that.

UIKit is built on top of those and using it does basically two things: a) avoid re-inventing the wheel and b) make creation of user interfaces easier, faster and more robust. Of course you could draw every button itself by specifying the coordinates of a quad and sending that to OpenGL for processing. Then you would have to check every user input if it hits your button and call an associated handler. However, just creating an UIButton instance (maybe even in IB) and specifying an on-click handler does remove quite a lot of work.

Bottom line: UIKit is perfectly suited for creating user interfaces. Plus it can be used together with OpenGL and QuarzCore. I use it for the user interface on iOS even in games.

Regarding Cocos2D: This one is a "game engine" built on top of OpenGL. As such it includes quite a lot of the stuff you would have to handle yourself when rolling your own OpenGL-based engine, i.e. scene management, sprites, texturing, meshes, resources etc. I believe it also has connections to physics and collision detection libraries. In order to understand what happens there, however, requires to learn how computer graphics and games work[1,2,3].

Bottom line: you would use Cocos2D for your (2D) game graphics and UIKit to do the user interface.

CoreAnimation then is for animating CoreGraphics stuff. It provides an easy interface, e.g. for smoothly sliding or rotating stuff around, encapsulating all the required calculations (interpolations, redrawing etc). Will not work with OpenGL - but I think Cocos2D will also have a wrapper for that.

Bottom line: Use for fancy user interface animations.

Having said all that and just merely skimming the top I didn't want to frighten you in the first place.

For your special game (and every game is special) you might well get away with just UIKit and CoreAnimiation for the graphics and it might well make a blockbuster game. They allow a lot of drawing to take place with an easy to use interface plus they don't require too deep background knowledge and are sufficiently performant for small projects.

If you have a great game idea, use the simplest possible graphics solution that will satisfy you and your players and realize it. Once you got it going, you can still improve it if necessary.

[1]http://www.mcshaffry.com/GameCode/

[2]http://www.gameenginebook.com/

[3]http://www.opengl.org/documentation/red_book/

like image 71
cli_hlt Avatar answered Nov 01 '22 00:11

cli_hlt