Apple Developer Connection
Advanced Search
Member Login Log In | Not a Member? Contact ADC

Westlake Puts Halo on
			the Mac: The Right Tools at the Right Time

Using a combination of OpenGL, clever programming, and great developer tools, Westlake Interactive has helped make the popular game Halo a big hit on the Mac. Halo is a spectacular sci-fi action epic that takes advantage of the pixel shaders found in many recent NVIDIA and ATI video cards, so that grass looks like grass, vehicles shine in the sunlight, and alien buildings reflect like mirrors—all adding to the excitement and sense of realism that make a great game.



“In doing game conversion for the Macintosh, we've always wanted tools that will identify where problem areas in our code are—and now, with the developer and OpenGL tools that come with Mac OS X, we have exactly that,” says Phil Sulak, president of Westlake Interactive, the company that put MacSoft’s tremendously popular game Halo onto the Mac.

“Games commonly contain between one half and three quarters of a million lines of code,” Phil says. “They require huge amounts of CPU power, and our job is to provide the software with that power in any way we can. With Halo, we were pushing the limits of gaming technology—it’s an extremely popular game with cutting edge graphics and extensive use of vertex and fragment programs. We had to make it look and perform like nothing else on the market.”

Halo was optimized for the Mac and for OpenGL using Xcode, the development tools suite that ships with Mac OS X. Using Xcode—specifically the hardware analysis tool Shark and the OpenGL tools Profiler and Driver Monitor—Westlake was able to take a game originally designed on the Mac, then moved to Xbox and then to Windows, and create a new and stunning Mac version in a very short period of time. “The PC version was completed in September,” Phil says, “and we needed to finish our development in time for a pre-Christmas release. It was quite a challenge, but exceptional tools and developer support from Apple helped us meet it.”

Games today take advantage of very high-end graphics cards, using vertex and fragment programs to talk directly to the cards themselves, and allowing developers to create much richer looking special effects essentially by coding effects on an individual pixel level (thus sometimes referred to as “pixel shaders” or just “shaders”).

“A good example of this is the water in Halo,” explains Ken Cobb, Senior Developer and Vice President for Westlake. “It has a very realistic rippling effect, and reflects light like real water, changing color depending on what it’s reflecting and the angle it’s viewed at. This happens using shaders—we actually program each pixel to calculate how it has to look to get this overall reflection effect. The same thing happens with textures. When you apply a texture, each pixel within that texture is also programmed to reflect the texture appropriate to its position in the scene.”

Pixel shaders can also provide improved metallic special effects, adding “a very cool shininess, vibrancy and life to the object because of these cutting edge lighting effects,” Ken says. Halo is the first retail game to ship using pixel shaders on the Macintosh.

The Big Fish of Tools: Shark

Using Shark, Westlake was able to get a very detailed view of how the program was executing, down to the CPU instruction level. “Shark is amazing,” says Phil. “It is extremely good at pointing out areas in the code that are running slower than the rest of the software, telling us what each command is doing. This allows us to pinpoint the hotspots we need to focus on and optimize, to tweak the code and get the most power out of the CPU that we can.” Shark is designed to profile and analyze code and offer optimization advice, and is designed to be used with a minimum of effort.

“One of the bugs we had during Halo's beta cycle,” Phil says, “was very choppy performance when playing back QuickTime movies under certain screen resolutions. Using Shark, I was able to trace the games’ program flow down and see that the video drivers spent far too much time decoding full motion video. I spent an hour recompressing all our movies but specified different playback parameters, and once I did that, playback was smooth as silk. The really great thing about Shark was that it showed me the actual QuickTime API calls that were slowing down movie playback and allowed me to identify and solve the problem quickly.”

The Enabler Technology: OpenGL

OpenGL is a cross-platform graphics standard that exists on the Macintosh, Unix, and Windows platforms. It works with two- and three-dimensional data and gets data to the graphics card better than any other API on the Mac. It’s an enabling technology—it gets things to the screen fast. Three-dimensional applications of OpenGL include games, molecular modeling, and animation.

Optimizing the data flow to the graphics card is the key to efficient use of OpenGL. OpenGL Profiler shows developers the use scenario for their data flow, allowing them to put their data into optimal storage states, while Driver Monitor looks at the graphics card and its efficiency. Westlake took advantage of both these tools in their Halo conversion.

Halo and OpenGL

Halo spends much of its time in OpenGL, and so Westlake found OpenGL Profiler critical for profiling and debugging OpenGL code. Profiler monitors a running OpenGL application and collects a variety of data pertaining to the application’s use of the OpenGL library, such as function call frequency and performance overhead. It has the ability to suspend an application and display the frozen state of the OpenGL state machine, the frame buffer, and any loaded texture maps. It essentially provides statistics—the amount of time spent in every function so developers can see exactly where the trouble areas are located. The Profiler also collects resources loaded by a running application, so that any texture image, vertex program string, or fragment program string specified by an application can be captured and examined by Profiler, allowing developers to visually ensure the integrity of the data passed to the OpenGL library.

“OpenGL Profiler keeps track of ‘resources,’ such as what textures are loaded,” explains Ken. “Many times during development I would notice that some object wasn't drawing with the right texture, or any texture, and then I could check with OpenGL Profiler to make sure the texture was actually loaded and what it looked like. I used this many times for the Halo development, especially because Halo uses not just plain two-dimensional textures but also volume and cube textures and normal textures, which we’d never dealt with before. With Profiler we could make sure these texture types were loaded correctly.”

Ken continues, “Another extremely useful feature of OpenGL Profiler is that it shows you the current state of all the OpenGL settings. There are literally hundreds of these states that control things like color and alpha blending and texture filtering. Before Profiler, if I had bugs in OpenGL states, I would have to write debugging code to print out the states, but then would still have to guess which states were causing problems. It was a very slow and tedious process. Now I can use Profiler and see all the state settings at once, and of course no longer have to write my own debugging code. It was great—I used this feature of Profiler over and over while developing Halo.”

The OpenGL Driver Monitor looks at the graphics card and performs a kind of EKG on it, examining the heartbeat of the card and how it is interacting with the rest of the system-capable of monitoring a large set of low-level statistics related to the Graphics Processing Unit (GPU). It looks at the number of textures on the card and how much space is left, and will indicate if the card is spending a lot of time waiting, or is not saturated. The statistics collected reflect the combined activity of all OpenGL applications running on the host computer, providing clues for where to focus optimization efforts. “The real key to getting good game performance is optimizing data flow to the graphics card, and this is exactly what the Driver Monitor helps us do,” Ken says. “It was a real time saver, and helped us improve Halo's performance.”

“We accomplished the Halo conversion so well because of Mac OS X and its full support for pixel shaders,” Ken continues. “That support, combined with the OpenGL tools in Xcode, allowed us to create these exceptional, cutting edge graphics in a game that performs perfectly—all in a really short period of time.”

A Rich Macintosh Heritage

Halo has a rich Macintosh heritage; the game was created by long-time Macintosh developer Bungie Software. Acquired by Microsoft, it was then developed exclusively for Xbox until 2003, when it was released for both the PC (by Gearbox) and Macintosh—and was enhanced for play on the Mac.

Published for the Mac by MacSoft, it contains all the action-packed combat and thrilling gameplay that made it a smash hit for video game fans around the world, plus a host of new features that are exclusively available in the Macintosh and Windows versions.

“An Exciting Time for Us on the Mac”

Westlake Interactive was founded in 1997 with four partners, as a development house focusing on Macintosh porting. Many Macintosh game publishers license games from large PC publishers, and then use companies like Westlake to convert them to Mac versions. Westlake has converted The Sims, Tomb Raider, Madden NFL Football, Harry Potter(tm), NASCAR(r) Racing, Jedi Knight and Unreal, among many others.

“What we do is almost a black art,” says Phil, “We have to be expert Mac developers, but we have to know other systems very well too. With the advent of Mac OS X, and its ongoing support of OpenGL, games support on the Mac has never been better. It’s a very exciting time for us on the Mac, with mature tools, hardware, and software, and really outstanding developer support.”

For more information about Westlake Interactive, visit their website at www.westlakeinteractive.com. For information on the publishers, MacSoft, see their website at www.macsoftgames.com.


“With the advent of Mac OS X, and its ongoing support of OpenGL, games support on the Mac has never been better. It’s a very exciting time for us on the Mac, with mature tools, hardware, and software, and really outstanding developer support.”


Westlake logo