Mac Game Programming Roadmap
Author: Mark Szymczyk
Last Update: October 10, 2007
Mac OS X does not have a set of libraries like Microsoft’s DirectX specifically for writing games. The lack of game-specific libraries can be difficult for people new to Mac game development because they don’t know where to start. This article provides an overview of the technologies you need to learn to write Mac games.
There are three technology paths you can take to write Mac OS X games. The first path is Cocoa, which is Apple’s Objective C development framework. The second path is Carbon, which is Apple’s C API for writing Mac applications. The third path is to use a game library like SDL or Allegro.
What path should you choose? The path to choose depends on whether you want your game to run only on Mac OS X or if you want your game to run on multiple operating systems. If you want your game to run on multiple operating systems, you should use a library like SDL or Allegro. Those libraries handle a lot of cross-platform issues for you so one set of code will run on Linux, Mac OS X, and Windows with minimal changes. I’m not familiar with Allegro, but I know SDL works well on multiple platforms. Learning SDL is going to be easier than learning multiple technologies to get cross-platform compatibility.
If you want to write a Mac-only game, you have a choice between the Cocoa and Carbon paths. One thing to keep in mind is that Cocoa and Carbon are frameworks for writing GUI applications. You’re going to use a tiny portion of them in your games: creating a window to draw into, and running an event loop. Most of Apple’s game technologies have a C interface, which means they consist of C functions. Both Cocoa and Carbon applications can call C functions so you can write games in both Cocoa and Carbon. Should you use Cocoa or Carbon?
Both Cocoa and Carbon are suitable for games so the path you choose depends on personal preference. One thing to consider is that on Mac OS X 10.5, you can write 64-bit Cocoa applications, but most of Carbon will not have 64-bit support. I can’t imagine you needing to write a 64-bit game right now, but Cocoa’s 64-bit support is an advantage. I would strongly recommend Cocoa for creating tools for your game, such as level editors. Cocoa is easier than Carbon for GUI programming.
One disadvantage of Cocoa for some people is it uses Objective C, which looks strange to C and C++ programmers. But you can mix Objective C and C++ code using Objective C++ so you can write most of your game in C++, writing only a small amount of code in Objective C.
Next (Technologies to Learn)