Mac Game Programming Book
In 2002 I wrote Mac Game Programming, published by Premier Press. To support the book I created this page, where you can find the latest information, news, and updates.
About the Book
The book is now out of print, but if you are able to get your hands on a copy, you will see that the book covers the following topics:
- HID Manager
- Keyboard Input
- Carbon Events
- Finite State Machines
I had a request to upload the source code on the book's CD-ROM. Mac Game Programming has been taken off the publisher's site so I'm honoring the request.
I decided to upload only the Mac OS X version of the code. I must warn you. The source code is ancient. I would not recommend using much of it in your own projects, especially anything Mac-specific. You would be much better off using SDL and OpenGL to write a game on Mac OS X today. But you may find the HID Manager, physics, AI, and pathfinding code helpful.
I have modernized some of the code for the book, using OpenGL for graphics, Carbon event loops, nib files, and universal binaries. When I update a chapter's source code, I will place it here. The following items are available to download:
- Chapter 4 Source Code (Universal Binary)
- Chapter 12 Source Code (Project Builder Version)
- Pathfinder Source Code
Frequently Asked Questions
Why do the Project Builder projects on the CD-ROM not compile?
The Project Builder projects on the CD-ROM are missing the file InfoPlist.strings, which the projects require to compile. Add that file to the project or create projects in Xcode and add the source code files and other files to the project.
Why does the program from Chapter 4 display only a yellow screen?
That is all the program does. If you want to display a different picture, open the resource file Chapter04 Resources in a resource editor like ResEdit and substitute your picture.
Why do the Project Builder programs on the CD-ROM crash on Mac OS X 10.2 and above?
Apple added keyboard and mouse support to the HID Manager in Mac OS X 10.2 that broke the code on the CD-ROM. The programs that use the HID Manager (Chapters 8, 10-16) will crash if you don’t have a game controller connected to your machine. The temporary solution is to turn off HID Manager support. You can see how to do this by downloading the Chapter 12 source code in the Downloads section of this page.