views:

55

answers:

3

making a game like 'doodle jump' requires opengl or core animation is just enough? which is the poit from where one should consider using opengl?

+1  A: 

I've been toying with a small isometric 3D game for a few weeks now. I've first used CA, but switched to OpenGL. The reasoning for me was thus:

  • Switching makes sense considering that I'm doing 3D
  • I'm not using Cocoa nor any Obj-C constructs in my code, it is pure C
  • OpenGL lets me test my application with only a slightly different wrapper on other platforms

For me, that makes OpenGL a worthwhile investment.

YMMV

ivans
good point. still, making a 2d game such as 'doodle jump' does not necessarily require opengl, does it? I want to make a game. I am just starting learning this so I am also wondering where should I start first? CA or OpenGL
It really depends where you intend to go with it in the future. If this is a single game and you have no interest in game development whatsoever, just go for CA. If you would eventually like to develop more complex games, learning OpenGL is a fun and very rewarding experience that'll certainly help you in the future.
ivans
+1  A: 

This is my personal opinion, I think making game with CA is complicated. I recommend OpenGL.

In OpenGL based project, you should manually draw and move elements frame by frame to make animation. It requires bit longer code than CA, but you can easily sync screen and game status. It is hard to sync graphics and game strictly in using CA.

Course, performance of OpenGL is much better than CA. And, learning OpenGL is not much harder!

fish potato
A: 

If you don't have any existing experience with opengl and iphone development, I would recommend working out your basic game using quartz first since it will provide you with the easiest learning curve. For your needs, it might even perform well enough for the final game.

Here is a simple custom view that renders a single sprite with a 30fps animation loop.

@interface GameView : UIView{
  NSTimer* animTimer;
  UIImage* sprite;
}
- (void)animate:(NSTimer*)theTimer;
@end

@implementation GameView
  - (id)initWithFrame:(CGRect)frame {
    if((self=[super initWithFrame:frame])){
      sprite=[[UIImage imageNamed:@"sprite.png"] retain];
      animTimer=[[NSTimer scheduledTimerWithTimeInterval:1.0/30.0
        target:self selector:@selector(animate:)
        userInfo:nil repeats:YES] retain];
    }
    return self;
  }

  - (void)animate:(NSTimer*)theTimer{
    [self setNeedsDisplay];
  }

  - (void)drawRect:(CGRect)rect {
    [sprite drawAtPoint:CGPointMake(0,0)];
  }
@end
kasperjj