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?
Enter your programming question at the top of this page and click Get An Answer.
Tell us how quickly you want your programming question answered.
Connect with your programmer via online chat or telephone call.
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?
based on the requirment we can choose open GLES or core graphics.
The iOS graphics APIs are layered. Even though some portion of the final render might go thru the GPU, most of the CoreGraphics drawing functions do not.
CoreAnimation/Graphics does use the GPU, but the types of graphics operations within its API (transforms of existing image data mostly) is limited.
OpenGL ES uses the GPU, but (re)compiling any changes to the rendering pipeline is reported to be quite CPU intensive.
And anything that uploads new bitmaps, images or textures to the display pipeline appears to be both CPU and GPU intensive.
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.
OpenGL, if done right, will probably look better.
That Sample code helps me alot. Thanks
Byron Narciso
Programmer
Whether you have a quick question while preparing your taxes, troubleshooting a computer problem, or need to hire an attorney, ExpertHelp is the most convenient and affordable way to connect with the right service professional to get the job done.
ExpertHelp has been in business since 2011, is an A+ Rated Better Business Bureau accredited member, and offers a 100% satisfaction guarantee on every question you ask!