I want to program a board game (similar to checkers) for the iPhone. Would OpenGL ES or CoreGraphics be a better option? What do most games of this type on the App Store use?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Actually, what I’d suggest in this case is Core Animation or even just UIViews themselves. If you do direct drawing of all of your elements in a single view via Core Graphics, then refresh that view for every animation frame, you’ll get horrible performance.
I’d suggest drawing the discrete elements of the game board (pieces, counters, board squares, etc.) as individual UIViews or CALayers, then animating those layers or views around. UIViews aren’t too much heavier than CALayers, and they use Core Animation behind the scenes to do simple movement, scaling, or fading animations. They can also respond to touch events. CALayers are useful if you want to build a more cross-platform (Mac and iPhone) game, or if you need to do more complex animations.
For a 2-D game, I’d hold off on OpenGL until you were absolutely sure that you couldn’t get the kind of performance you want from Core Animation. OpenGL is a lot less elegant to code for.
For a good example of how to do a board game using Core Animation, Apple has provided the GeekGameBoard sample code. Although it’s a Mac application, the Core Animation code can translate right across to the iPhone.