Cocoa and the big picture

Posts: 1
Joined: 2010.01
Post: #1

I've been reading the forums for a little while.

My interest in Mac programming goes back a long while (Oregon Trail and the Apple II). It hasn't been until recently that I've been able to really get on the ball and dive into it. I have a bit of a C background as well as some Java. Making the move to Objective-C was a little disorienting at first, to be honest; but it clicked quickly and I've been enthralled by it ever since.

I've been crawling through Aaron Hillegass's book: Cocoa Programing for Mac OS X (Third edition). I've been trying to comb over it as closely as possible. Each pass it sinks in more and more.

The problem I'm having is this: As I've mentioned, I've had a strong interest in game design for the Mac for a while. As I move closer to the end of the book, for some reason what the book poses for examples, and what my end goal is (to produce a small 2d game ala pong or break out) seems to maintain the same distance.

In short: I really feel like I'm missing the big picture. Is there some sort of primer or tie-in book that is recommended that I can read in tandem with the Cocoa Programming book that will make the connections; or am I missing them out-right/all-together?

Thank you for reading.
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #2
It sounds like you're looking for magic. There isn't any. By the end of the Cocoa book you should ( I think! I haven't read it Smile ) be happy creating a new application, with a window containing a custom view class, handling key or mouse events in the view, and drawing in the view with Quartz. That's more than enough to create Pong or Breakout.

If you go much further with game programming in Objective-C you'll need to learn OpenGL too, but for Pong or Breakout there's no need.
Quote this message in a reply
Posts: 22
Joined: 2009.08
Post: #3
Hello there!

I'll admit that I'm not the best programmer in the world. I bought many, many books and read through them all. However, I found myself in the same spot as you. I was confident that I'd be able to program the numbers part of it (all that behind the scenes stuff), but it was how those numbers translated to making an actual game that really seemed alien to me.

Learn OpenGL. Once I was able to visually SEE things on the screen to represent my numbers, it all fell into place. I program for the iPhone. To be blunt, this site bridged the gap for me:
It teaches OpenGL ES and how to make a 2D game engine from scratch. Watching these then going off to try out my own engines and playing with the different functions taught in these tutorials helped me switch to making a game come to life and truly making sense out of all the books I had read on Objective-C and Cocoa.

Hope this helps.

**Edit** I read the above post and agree. However, I skipped out on Quartz. I knew I'd have to learn OpenGL eventually anyway, so I went straight there. That site above made the skip pretty painless.
Quote this message in a reply
Posts: 245
Joined: 2005.11
Post: #4
Aaron Hillegass's book is really aimed at app development, but it does show you how to put together an app with an NSOpenGLView and draw something in it, and how to create classes. A lot of the other concepts, such as memory management, first responders and so on, are useful or even vital (memory management!) whatever you are programming.
However there are a few concepts specific to game programming that you will have to pick up elsewhere. Responding to keypresses isn't covered (as far as I can remember), but if you know about NSView and the NSResponder protocol then you can work out one way of doing that. (Or you can just use GLUT, at least to start with). You'll need to learn how to program OpenGL from somewhere else, but there are books and tutorials around.
I'd recommend figuring out enough to put something basic together (Pong is a favourite, you could try Space Invaders or something if you prefer). You might go off down the wrong track at first, but if you remember that your goal is to learn, rather than to complete this game then that shouldn't matter. I think that the best way to understand how a game goes together is to try it and see what works. As you encounter problems, have a look at how other people deal with the same issue.
In short, if you've been through Hillegass's book a few times and understood it then you are probably ready to branch out and experiment a little.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Picture in Interface Builder skyhawk 1 4,134 Jun 15, 2006 02:10 PM
Last Post: OneSadCookie
  Create a Layer in Cocoa from a picture Simon 19 12,236 Feb 16, 2003 11:31 AM
Last Post: Simon