views:

2724

answers:

7

I am writing a simple game that animates a ball image quickly across a background image.

Would Core Animation/Quartz be sufficient for this scenario?

I don't really want to learn OpenGL ES if it is not going to provide any substantial benefit in this one off project.

A: 

yes, it will be fine, as long as you're not wanting to do hundreds of balls at once or something else complicated like that.

David Maymudes
Thankyou ... BTW it is just one ball at a time, but will the image will be animated (with a few frames) as it flys across the screen quite fast.
A: 

If your knowledge of Core Animation is good then i recommend you to skip learning OpenGL ES for now, since it won't really help you (if all you want is what you described of course). On the other hand, if you plan to make more games which have more involved graphics, it might be a better idea to start learning the API. OpenGL ES is a simple API and you can use the full graphics features of the iPhone with it.

If all you want to do is just make this game, then i say go with what you know and are productive.

Bad Sector
Thanks for replying.I havent used Core Animation or OpenGL ES before at all ... this is a short project. So I am looking utilise the most development time effective approach, as it a very straightforward game.
A: 

I would say this very much depends on what you want to do with the ball. If you simply want to fire off an animation and forget about it Core Animation will probably be fine. However, if you are trying to interact with the ball, for example by changing the direction of the ball mid-flight based on user interaction, then you probably want to consider OpenGL ES. Of course, you're other option is to use neither Core Animation or OpenGL ES and simply redraw your view on a timer.

If you're a fairly competent C programmer I wouldn't be too put off the OpenGL ES stuff. Apple supply a lot of the framework for hosting OpenGL ES views in their templates. Although OpenGL can get fairly involved, if you're not trying to render huge multi-object 3D scenes then the basics are fairly straightforward and you should be able to get some nice results quite easily. Although it is for OpenGL rather than OpenGL ES, I would recommend this set of video demos as a good starting point:

www.videotutorialsrock.com

Gavin Maclean
Thankyou Gavin for replying. The ball will be launched from the bottom with a swipe gesture. Then animated all the way to the top (no user input during this time). Only one ball will be displayed at one time. As it is only a small one-off project, I wanted to determine if CA would be fine ... unlikely to writing games in the future (I do LOB apps usually).
+3  A: 

OpenGL ES I suppose isnt too hard.

But at the end of the day Core Animation is going to be fine, its super powerful and not to hard to work with. It will also get you up and running so quick that you will release you game "sucks" a bit and you want to change it and you didn't even have to learn OpenGL.

I highly recommend looking at cocos2d. A very simple game engine for 2d stuff. http://cocos2d.org/

Have a look at that.

Cheers, John

John Ballinger
Thanks John, I will have a look at the engine.
+1  A: 

This is a commonly asked question. Other questions like this include:

Brad Larson
Yes, I did this before posting. In this situtation the game is very simple and the fact that it is probably a one-off ... as I normally write LOB apps.
+1  A: 

Just jump to something like Cocos2D so that the OpenGL is done for you. OpenGL ES is significantly faster and more adaptable than Quartz, plus it's not any harder. I even think Quartz is a big pain in the butt and difficult to figure out, although I came from an OpenGL background on desktop computers first, so naturally that jump is pretty small. The point is, though, that either with Quartz or with OpenGL ES you're going to need to spend a lot of time with resource management, etc., so you might as well go with Cocos2D.

Eli
+2  A: 

OpenGL ES isn't that hard, there are lot of really good resources in the web and step by step tutorials. Can be hard at first, but once you get the grip of It things will be easy. 71 Squared has very detailed tutorials:

http://www.71squared.co.uk/iphone-tutorials/

About the question, Core Animation Is great for most apps, but in a videogame It's fundamental to draw your game efficiently and have as much control as possible.

Cocos2d Is great and I recommend It If you need to write a good game, but if you're doing It for educational purposes I recommend OpenGL, You will learn a lot with It and gain a lot of experience.

José Joel.
The 71 squared tutorials are dated now. You'll find functions used that are now renamed or have had their functionality placed elewhere. Hopefully they'll update them.
kirk.burleson
Could you point me to any place with updated tutorials, a list of the differences, ect. ?. I would love to actualize myself, but I don't know which functions are outdated or replaced by now.
José Joel.