For a real time game, Should I use core animation or redraw images frequently?

Say I have to move a image across the screen according to user input....

Should I?

  • Use core animation periodically to animate the movement in small chunks.

Or

  • Redraw the image frequently at different locations.

If there is no clear answer, what are the advantages of using each method?

Answers


CoreAnimation is not generally made for game programming, and doesn't have the performance characteristics that it generally takes to make a real, playable game. You may be able to make a very basic game very easily with CoreAnimation, but it's likely that at some point you will run into these performance limitations, and at that point you will probably need to rewrite your codebase using a real gaming engine.

To be clear, CoreAnimation is amazing and is ideally suited to the task for which it was created, which is application UI development. But it doesn't take much in terms of sprite count and size before you hit the performance wall when using it in a game. I say this because I have tried it.

My recommendation is to use one of the easy, off-the-shelf gaming engines available on iOS, like Cocos2D, to write your game. It's easy enough for a relative beginner, but is more suited to game development both in terms of performance characteristics and API.


Core Animation was made for you. The whole point of Core Animation is move images around the screen really fast. Core Animation works even better when the actual content of the images don't change.

EDIT: Redrawing the image is less preferable because

  • If you redraw the image with Quartz and override drawRect: you will be relying the CPU to draw all of those images
  • If you use OpenGL and accelerate your app with the GPU--using it only to draw images onto the screen and move them around--you have replicated the functionality of Core Animation
  • Core Animation has animation primitives built-in

Need Your Help

Focusing to the .next() td textbox in a table row using jQuery

javascript jquery focus

I want to be able to press tab once the .editbox is clicked and it take the focus to the next .editbox. I have been messing with the code for an hour now and cannot "find" the next element.

How to deal with spaces within paths when using the system()?

c++ system

I am still new to C++ and am working out a way to open a program within my C++ program.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.