iDevGames Forums
iPhone game programming for noobs - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: iPhone game programming for noobs (/thread-808.html)



iPhone game programming for noobs - Olnex - Aug 26, 2009 09:38 PM

Hello, I want to start game programming for iPhone but I am stuck, I started by learning Objective C 2.0, followed by reading the book "Beginning iPhone 3 Development: Exploring the SDK", following the examples in each chapter, then I watched online tutorial regarding to Core Animation/CALayers, then read source code of 2D games/programs, but now I am stuck, can anyone point me to the correct direction so that I can have a feel of the basic template/skeleton of a 2D game?

My questions are:

1 for a game with several "views", for example, a title screen with "start/load/about/exit" menu, and a game play screen when user clicks "start" in the previous menu, do I use multi views or multi CALayers(each layer represents a particular screen, with several sublayers for componenets in that screen)?

2 what the main loop looks like and where should I put it?

3 where do I put the initialization code? Some of the tutorials I read has put them to "applicationDidFinishLaunching", but others have either dedicated "init" method or put them to a method called "loadFromNib"(can't remember)

Thanks a lot!


iPhone game programming for noobs - AnotherJake - Aug 27, 2009 12:44 AM

First thing I'd do is ditch the CoreAnimation route and go with OpenGL. I tried CoreAnimation on iPhone last year when it was first opened up. It works great at first, but you'll find performance limitations sooner or later. Better to invest your effort in learning OpenGL instead, IMHO. It's great that you've already learned some Objective-C though, since that'll definitely help.


iPhone game programming for noobs - longjumper - Aug 27, 2009 11:50 AM

It depends entirely what you are doing. Core Animation is perfectly suitable for some types of games.

Typically, you want to think about the number of on screen objects. If you have a lot of on screen objects, you'll want to use OpenGL. If your game only consists of a few images being moved around the screen (like a chess game), Core Animation is going to be the better choice.


iPhone game programming for noobs - Amphro - Aug 27, 2009 03:31 PM

Quote:Typically, you want to think about the number of on screen objects. If you have a lot of on screen objects, you'll want to use OpenGL.

What would you define as "a lot" and are there ways to improve speed without reverting to OpenGL? I think I have about 15 screen objects and it was running a little slow. I freed up quite a bit data and other views I was not using during game play and have yet to tested how much speed I have gained from it.

I am also using timers and layer animations consistently throughout game play. Not sure if those can be re-factored.

The game I am making it simple and almost complete. I am going to learn OpenGL for my next game but would like to put it off until then.

Any suggestions would be greatly appreciated. Let me know if you need anymore information.