Halo 2 and Havok
Although most people consider Halo 2 to be a thoughtfully paced strategy/puzzle game, Bungie’s original intention was to make a fast-paced, action-packed shoot ‘em up. It’s true! Now, in the original Halo, we got props for our physics, but to be blunt, those were actually only germane to the vehicles. They flipped, tumbled, rolled and careened. They spun, they flew, and they somersaulted. But they alone moved. In Halo 2, we wanted to move everything!
Now, we had a decent object physics system in place, and we certainly used our experience with it building Halo 2, but the sheer scale of what we had in mind for Halo 2 necessitated something a little more ambitious; so we turned to the folks at Havok for a partnership that would benefit us and Halo players alike..
Havok, for those unfamiliar with it, is a brilliant set of physics solutions for interactive software—and one of the only pieces of middleware to ever achieve anything like broad consumer awareness. Havok and its’ employees have almost single-handedly filled this generation of video games with life-like moving objects—objects with weight, heft, and real gravity.
"A moviemaker can’t make Spider-Man with a Handycam and a flashlight"
Middleware initially had something of a lukewarm reception from video game fans, which were, after all, reared on a generation of do-it-all wunderkinds, programmers who built their own games from the ground up with a keyboard and a working knowledge of 6502 machine code. Well, it’s been a few generations of hardware since a genius in a basement was able to tap out an entire game. As the game business becomes more and more like the movie business—at least in terms of scale and complexity—so too do its needs. And just as a moviemaker can’t make Spider-Man with a Handycam and a flashlight, a game studio must invest in all the quality resources it can. Enter Havok.
The physics in the original Halo, while fun, were sorta simplistic, as Code Gorilla Charlie Gough explains: “Basically, we had this homemade physics engine that we created out of my understanding of high school Newtonian mechanics and the basic concept that if you made things out of a bunch of spheres that were springs, that it would all kind of work... hopefully!”
Charlie’s optimism and grasp of bouncing spheres led to a fair amount of acclaim for Halo and Bungie, but the shift to Halo 2 required a shift in thinking, too. “Fundamentally, the problem was that our system wasn’t scalable, it couldn’t support a large number of objects in our world, and basically we weren’t able to do the cool stuff we were seeing come from the guys at Havok.”
For Bungie, it was important to find a solution that could integrate well with the Halo 2 code, and of course a partner that could work closely with Bungie to ensure the best fit with the game and its needs. Bungie engineer Chris Butcher pushed the team to watch a demonstration of what Havok could do, and the decision was made. Havok’s tools looked like they would work well with the Bungie code base, and the results were attractive, convincing, and most of all, fun.
The next step was to perform some test integration of Havok into Halo 2 and, as Charlie illustrates, the decision was simple. “It didn’t take very long and, once we saw this, we knew there was no going back.”
The natural fear was that Havok’s physics would feel different from Halo’s in either tangible or intangible ways, and they were legitimate concerns. “In the end it’s just physics,” says Charlie. “I think one of the biggest differences is that their stuff is a little more stiff than ours—the vehicles in Halo 1 tend to bounce more and ended up having spongier interactions because it was again this spring-based system. But things worked out pretty well for the most part.”
It wasn’t all smooth sailing (game development seldom is). “Getting the Havok technology up and running was simple enough. But to get it to work and not have Halo 2 crash and not use too much memory, that took a long time,” Charlie explains.
The first time the public got to see Havok working in Halo 2 was at the E3 Expo in 2003. Bungie showed off the single-player demo, the creation of which was a fraught-filled race against time to patch together working elements of the game in time for a long-awaited public unveiling. Ironically, while much of the content of that demo ended up on the cutting room floor, the physics integration was remarkably successful.
"Crates are just so danged useful"
The joke object often associated with Havok (and actually, video games in general) is the ever-so-humble crate. Crates are just so danged useful. You can stack ‘em, blow ‘em up, climb over ‘em and more importantly, stash gold coins inside them. But Havok can move more than packing crates.
Eamon McKenzie, Bungie’s self-titled "Programming Soldier Ant" is quick to point out some surprising non-crate Newtonian pawns. “The bipeds (Halo 2’s human and alien combatants) in Halo 2 are special because they are physical objects in the same way that vehicles and crates are; they all work on the same playing field—they just have a different controller moving them around.”
Bipeds in Halo 1 were treated to some related but accidental indignities, as Eamon explains: "What some people may not know is the reason we killed bipeds by running over them in Halo 1 was because it was cool of course, but also that we couldn’t solve the collision well enough. It was easier to kill them than to bounce them."
Bipeds illustrate another useful aspect of Havok—the ability for a Havok object to undergo invisible transitions of complexity. When a biped is walking around, shooting, jumping, and running, it's ironically in its simplest state as far as Havok is concerned. Havok treats it as if it were a capsule standing on end. The complexity inherent in an animated Halo 2 biped is all our code and animation. When it dies, however, Havok has a larger role—tossing a flung corpse, for example, or making a body tumble from a ledge. It then interacts with our rag-doll system. A corpse, in fact, is a great deal more work for Havok than a live specimen. The tradeoff in processing power is perfect—a corpse is no longer chugging AI cycles.
The only objects in Halo 2 that remain untouched in some way by Havok’s magic are weapons and projectiles. Projectiles are a bizarre hole in this generation of Havok (although the problem is inherent to particle systems, not unique to Havok). Charlie calls it the "bullet through paper" problem.
Basically, the old version of Havok didn't deal well with objects which move quickly relative to their size—at least in terms of how they collide with other surfaces, although Havok version 3 has since addressed that. Bungie chose to solve the problem with custom tools, but Charlie has an interesting experiment for folks to try: "The Warthog has a hubcap that can fall off and, if you play around with it, it is not that hard to make it go through the world, to make it fall through the geometry so you don’t see it anymore."
"Don't make anything smaller than a PC monitor "
Charlie also ruminates on his need for big vs. the need for artful detail. Laughing, he states - "That was the thing I used to say to all the artists: don’t make anything smaller than a PC monitor, in any dimension, like nothing can be smaller than a foot-and-a-half or two feet! Originally it was three feet, but it kept shrinking ‘cause they kept making crap anyway. Then of course the Warthog hubcap was like six inches—they just blatantly ignored everything I said."
The important thing to remember is that Havok is a tool that allows Bungie to move, modify, and generally molest. Havok moves not a pixel without a designer or programmer’s imagination and instruction. As a matter of fact, the thing that most impressed Bungie about the software was not the code base, or the support from Havok, but rather, the art that other game developers had created with it.
Havok, while a commercial enterprise, shares some of the advantages of open source code. It constantly evolves with the input of new users as software developers continue to apply it to new uses. The code is actually supplied as a set of tools, libraries, and a chunk of the original source code. As developers find new ways to use it, these aspects can be added to the next iteration of the software. Bungie implemented some cool stuff and also used Havok for a somewhat unexpected purpose—calculating what is and should be in the camera's field of view, or “frustum.”
Havok's Lead Architect Nick Gray admits, "Every new release has some new stuff in it. Some of the stuff the Bungie guys mentioned putting in for the camera display, quickly determining which parts of the world are visible, was something that we didn’t have before, now we do[a2].”
He adds, “The feedback that we get from our clients is what really drives the development of Havok. Clients immediately see things we might not have seen, bugs that are important that need to be fixed versus things that don’t really matter, small tweaks that can be integrated to make it more usable.”
"The Hog is still the Hog "
Detail-oriented players will immediately blame any change in the “old” Halo physics on Havok, and one commonly leveled accusation is that Havok “changed” the Warthog. Nothing could be further from the truth. One of the first exercises using the Havok tools was to recreate the Hog’s every nuance, loss of traction, and force of friction. It worked perfectly and very quickly—identical in every regard. The changes added to the Hog after the fact were game balance tweaks: making the Hog more of a challenge to master. The introduction of the “e-brake” basically forced players to learn one more skill to recreate the feel of the old Hog. The Hog is still the Hog, but the controls have certainly evolved.
Charlie is quick to separate what Havok does from what Bungie did: “I don’t know if people know this but the Warthog actually has three gears, and if you listen to the engine sound you can hear them. We added this whole system of multiple running gears, and the designers tweaked the way the tire friction stuff works. We probably made some minor changes, but they were all centered on what the designers wanted. Havok didn’t change a thing.”
But the only thing better than Havok moving objects around, is having those objects collide and explode. Charlie alludes to this point: “One of the cool things we got out of Havok is the whole contact point system. Knowing where things were touching and whether or not they were going in the direction we wanted, we got this ability to deal with damage from the physics engine itself in terms of how hard objects are reacting with each other.”
That aspect of Havok had other benefits in unexpected areas. It allowed our audio engineers to apply audio to Havok objects where they interacted with specific surfaces. That meant the sound of a Ghost scraping against concrete, or a Hog colliding with a Wraith, could be altered based on information being tracked by Havok.
"You should basically feel like a kernel in a popcorn popper "
Havok doesn't actually do anything with sound, but it's simply a useful tool for the sound engineers to associate objects with principles—thing falling in water goes “splash,” for example. But it's interesting to note that working with Havok allows our audio engineers to actually add simulated effects on-the-fly to the sound of, say, a barrel rolling on concrete, rather than simply playing back the barrel sample with no adjustment made for surface properties.
But Havok had some even weirder benefits for the Halo 2 team.
There are instances in Halo 2 where “realistic” physics would actually suck when applied to gameplay. Think of the Scarab as a good example. If the enormous Covenant spider-tank-‘Mech were being accurately modeled in terms of Newtonian physics, everything on its surface would simply be tossed off. Eamon describes it more colorfully, saying, “You should basically feel like a kernel in a popcorn popper.”
Havok is flexible enough to apply realism where needed and ignore it where gameplay demands it. The reasoning in gameplay terms is that when you're on a ship, you automatically adjust your balance for the sway of the ocean without thinking about it. For purposes of fun, we assume Chief and the Covenant on board are also doing that, so they don't all tumble off into the canal...
The interaction of AI with Havok objects also poses some unique problems. A Covenant Elite in Halo 2 knows how to engage the Chief and attack him, but when an explosion dumps a stack of crates in front of him, Halo 2 AI has to compensate. So many moving Havok objects created challenging scenarios for the Halo 2 team, but challenges they were able to overcome.
"If Bungie's next project requires physics, Havok looks like it will be ready "
The next generation of consoles is going to be a huge deal for Havok as the need for 3D and physics becomes even more essential than the near-saturation point of today. If Bungie's next project requires physics, Havok looks like it will be ready for the complications inherent in new architectures.
Havok's Nick Gray takes that fact seriously, saying, "A lot of the new consoles have quite different architecture and they will have massively greater computational power, but it might be represented in a different way, so it will likely be massively parallel. The bottleneck might switch from being actually computing the data to getting it out of the parallel processors. And so fundamentally the architecture is going to change dramatically for the new consoles and to some extent that will affect the design of the software. We’ve known that for a while, so we've had that in our minds and have made changes towards that. So I don’t think there will be any major surprises."