The good thing about game programming is that many aspects are operating-system independent, such as artificial intelligence, physics, and game logic. Information about these topics will be usable on a Mac. But there are some aspects of game programming that differ between operating systems. The rest of the article discusses the technologies to use for these aspects on a Mac.
Use OpenGL for your game’s graphics. It’s the way to take advantage of hardware acceleration for 2D and 3D applications on Mac OS X. It also runs on Linux and Windows, which means there is a lot of information on OpenGL available on the Internet. Mac OS X ships with the OpenGL framework so all you have to do to use OpenGL is link to the OpenGL framework. In Xcode you would add the OpenGL framework to your project.
What is operating system dependent is creating a window for OpenGL to draw in. Apple has Cocoa OpenGL for Cocoa programs, AGL for Carbon frameworks, and GLUT, which is a cross-platform window and event library. GLUT is good for learning OpenGL, but it’s not suitable for a shipping game. SDL has support for creating OpenGL windows.
In Carbon and Cocoa you use event handling to read keyboard and mouse input. The HID Manager provides support for joysticks and gamepads. It’s not well-documented, but Apple provides the HID Utilities source code that you can use in your games. SDL comes with support for keyboards, mice, and joysticks.
The technologies you need to learn for game audio depends on your game’s needs. For positional and 3D audio, use OpenAL, which is a cross-platform 3D audio library. If you have simpler audio needs where you just want to play background music and sound effects, use QuickTime with Cocoa and Carbon. SDL games should use SDL_mixer, which is a library for playing audio in SDL games.
OpenGL games make heavy use of texture maps, and loading the textures from disk is not part of OpenGL. Using an image loading library simplifies the loading of the texture files. Cocoa and Carbon programs can use QuickTime to load textures. SDL games can use SDL_image, which is a library to load image files in SDL games.
Mac games normally use Unix sockets for networking. You can use sockets directly, or you can use one of the many networking libraries that use sockets. Apple provides the CFNetwork class that sits on top of sockets. SDL programs can use SDL_net, which is a wrapper around sockets.
Apple also has an open-source network library called OpenPlay. OpenPlay is a higher-level library than CFNetwork and SDL_net. It runs on Linux, Mac OS X, and Windows. But it hasn’t been updated much in the past few years so I don’t know how well it runs on Intel Macs.
For more information on Mac game development, go to Apple’s game development page. It has links to the OpenGL and OpenAL pages, as well as a link to iDevGames, a Mac game development site. iDevGames is a good place to go with your Mac game programming questions.
The Mac game development page also has articles, guides, and sample code. I recommend reading the Getting Started article as well as the OpenGL Programming Guide for Mac OS X.
Previous (Technology Paths)