Can a team of scrappy game programmers save Sony's monster chip?
Up All Night: Insomniac Games hopes it has created an addictive addition to PlayStation 3’s launch lineup. (Clockwise from top) P.J. McNerny, Alex Hastings, Ted Price, and Eric Ellis. Photo: Gregg Segal
Last month saw the introduction of the PlayStation 3, Sony’s first new game console in five years. Loaded with new hardware, including a Blu-ray optical disc player, a blazing-fast graphics card, and the nine-core Cell microprocessor, the PS3 has the horsepower to run the most complex and photo-realistic console games ever conceived. But despite all the careful engineering that goes into the hardware of a new game console, its fate really rests on whether the games it runs can draw an audience. To a great degree, maintaining Sony’s top spot in the US $30 billion game industry rests with a small company called Insomniac Games, a star among the groups that have churned out a game in time for the launch of the PS3.
When IEEE Spectrum visited Insomniac’s Burbank, Calif., headquarters, it was a stellar blue day in July, but the creators of the best-selling atchet & Clank franchise were thrilled to be inside and hard at work on Resistance: Fall of Man. As the Insomniacs worked, Sony clung to its position ahead of both Microsoft and third-place Nintendo Co., which was to release its new Wii system within days of the PS3 launch. Sony’s original plan was to beat Nintendo to market by several months, but the PS3 launch has been plagued by delays, the most recent due to problems with the Blu-ray optical disc drive. This past September, Sony unveiled scaled-down plans to dole out only 2 million units in the United States and Japan by Christmas, down from an expected 4 million. The company also said it would not have enough stock to roll out the PS3 in Europe until March.
Despite the delays, there’s something inside the PS3 that burnished Sony’s reputation as a hardware company. The heart of the machine is the powerful new Cell Broadband Engine microprocessor. Developed over the last five years by Sony, IBM, and Toshiba on a reported budget of $400 million, the Cell is not just another chip: it is a giant leap beyond the current generation of computer processors into a next-gen muscle machine optimized for multimedia tasks. Packing nine processors onto a single chip, the Cell can do up to 192 billion floating-point operations per second, a 36-fold increase over the chip that drove the PlayStation 2 to the top of the gaming world [see “Multimedia Monster,” IEEE Spectrum, January 2006].
The potential payoff for all three companies goes beyond gaming, of course. Toshiba plans to incorporate the Cell in its high-definition televisions. IBM and Mercury Computer Systems, in Chelmsford, Mass., are making Cell blade servers. And Sony might try to capture control of the living room via its Cell-powered gaming console.
“Sony may have the vision that its box will morph into something more like a media center,” says analyst Michael Pachter of Los Angeles–based Wedbush Morgan Securities. But that won’t happen if people don’t buy the console, and they won’t do that unless the games are the best they’ve ever experienced.
That experience won’t come cheap. At press time, the expected retail price in the United States was a whopping $499 for a console with a 20-gigabyte hard drive and $599 for one with a 60-GB drive. Microsoft’s Xbox 360 debuted last year for $399, and Nintendo’s Wii is expected to come in at about $250. “The pressure’s on Sony, because they have to justify the cost for this monster in an expensive box,” says Michael Wolf, director of the New York City–based digital home group of ABI Research, a market research firm.
As some of the people responsible for justifying the cost, the Insomniacs were feeling the heat, too, back on that July day. At that point they had been cranking out code for the Cell for roughly six months, trying to produce an addictive, eye-popping game that would demonstrate the power of the new processor.
To pull this off, they had to learn to squeeze as many calculations per second as they could out of an unfamiliar chip. The Cell is capable of number crunching that would choke other top-of-the-line processors, but only because its architecture is like nothing game developers have ever seen. Each chip contains a single processor that coordinates the work of eight others. And each of those eight differs greatly from the kind of processor you’d find in a PC or game console today. The Cell lets the programmer ask many things of it at once, but it requires those tasks to be molded to the particular abilities of the eight specialized processors. That means programmers will have to learn new ways to code games. It could be that programming the Cell is the most challenging game that developers have ever played, with one big difference: the fate of one of Sony’s most important products hangs in the balance.
If you want clues to where Insomniac is taking gaming with the Cell, look at the company’s roots. When the company’s cofounder and chief executive, 38-year-old Ted Price, was a kid, he spent his time coding games in Basic for his Apple II and dreaming of starting his own computer game company. The graphics were impressive at the time, but by today’s standards look like a glorified Lite-Brite toy. “I would spend all day writing a program that displayed a person who looked like a block,” Price says. But when he attended Princeton University, Price quickly gave up coding for a degree in English literature. “Programming felt way over my head at the time,” he says.
Nevertheless, Price found himself coding again after college as part of his first job at a medical company, where he programmed marketing research databases. Yet his passion for games and the dream of getting into the industry drove him to found Insomniac Games in late 1993. While attempting to write a design document for the company’s first game and doing the general organization needed to get the company off the ground, he realized that he needed some serious help. Fortunately, in the summer of 1994 he met two star programmers, Alex and Brian Hastings. The brothers joined the fledgling company with the same dream of creating cutting-edge console video games. The trio built a PlayStation shoot-’em-up called Disruptor while sharing an apartment in Los Angeles.
The game world is divided into games played on consoles or other dedicated hardware and games for PCs. Though Disruptor sold 200 000 copies after its release in 1996 and won Insomniac several industry awards, it failed to match the splash associated with PC game companies like Id Software, in Mesquite, Texas, maker of the hit shooters Doom and Quake [see “The Wizardry of Id,” IEEE Spectrum, October 2005]. Id’s powerhouse graphics engines pushed PCs to their limit and single-handedly created a new market for three-dimensional graphics cards from companies such as Markham, Ont., Canada–based ATI Technologies and Santa Clara, Calif.–based Nvidia. Id set the bar for Insomniac. At the time, PC games—particularly first-person shooters like Doom —were getting all the attention for pushing technology to its bleeding edge. “Our goal was to create a first-person shooter as good as or better than Doom, but on a console,” Price says.
While consoles didn’t get the press for pushing computing technology, they held a special appeal for the Insomniac guys that continues to this day. “Consoles are easier to develop for because the technology moves in chunks,” says Price.
Unlike PCs, which are constantly and rapidly improving in terms of performance and memory while sticking with the same basic architecture, consoles progress in waves, roughly every three to five years when the new generations of machines are released. Console programmers must periodically acclimate to a new machine, but then they have several years to optimize their programming before the next console arrives.
Insomniac has taken advantage of knowing the ins and outs of PlayStation machines. In less than a decade it has sold more than 20 million copies of titles like Spyro the Dragon, which followed the adventures of a bratty purple dragon, and the fantastical action series Ratchet & Clank. And Insomniac’s success hinges on what’s become its trademark—innovative game play. In Ratchet & Clank, for example, players have a giddy assortment of weapons beyond the usual railgun and rocket launcher. A gun called the Morph-O-Ray turns enemies into cackling chickens. Another weapon, the Inflato-Ratchet, burps out inflatable decoys of the hero in order to dupe would-be attackers.
The company had a few goals with its new PS3 game. While other game companies are porting existing games onto the PS3 or developing new installments of existing titles, Insomniac wanted to break from its Ratchet & Clank franchise and develop an entirely new title. The company also wanted to show its versatility and impress the hard-core gamers who, it believes, put any new system on the map. “We wanted to make the type of game that would be attractive to them,” says Price. That meant returning to its roots and the industry’s hotbed of technological innovation, the first-person shooter. Powering it all would be the Insomniacs’ greatest weapon yet: the Cell.
But, as they discovered from the start, showing off the Cell would require the company’s 40 programmers to figure out how to take full advantage of the chip’s multiple processor cores. “It raises issues of complexity management,” Alex Hastings, Insomniac’s chief technology officer, says. “Wrangling a system as large as a modern game is a huge challenge.” Wrangling a system for an entirely new kind of chip is an even bigger one.
In a PS3 game, the graphics are rendered mainly by a separate graphics processor, while the Cell orchestrates the rest of the in-game action: keeping track of players and monsters, computing the physics of how bodies rag-doll off buildings, and coordinating the collisions of bullets with alien flesh. The Cell conjures its magic by dividing the work among the nine processors.
Having multiple processor cores on the same chip is nothing new; in fact, it has quickly become the norm. The Xbox 360 also has a multicore chip, but the Cell is different in both scale and kind. The Xbox 360 relies on a chip with three virtually identical cores. The Cell, on the other hand, has cores of two different types.
The real brains of the chip reside in the Power Processor Element (PPE), which is similar to the PowerPC processors found in previous generations of Apple computers. Essentially, the PPE organizes, schedules, and doles out tasks to the eight other processors, preferably in the most efficient way.
The eight remaining processors are completely different animals. Known as the Synergistic Processor Elements (SPEs), they are specially designed to do the kind of fast but not necessarily precise calculations needed for multimedia tasks, such as compressing and decompressing sound files and decrypting data.
“[The Cell’s] architecture is very well suited toward running a game and not terribly suited toward running a desktop computer,” says Alex Hastings. “You have to customize code for the Cell processor. If you want to take advantage of these [SPEs], you have to write code specifically targeted to them.”
That’s not so easy. The SPEs were built around a new but limited list of instructions—the basic set of things a processor can do. These instructions are devoted to data crunching as opposed to controlling things, which is the job of the PPE. In other words, they can blast through a simple process like audio decompression, but they’re incapable of running an operating system.
What’s more, each SPE has access only to its own 256 kilobytes of on-chip memory. The programmer must ensure that the SPE’s memory is filled with the data it needs before it needs it.
Game programs have historically been written as serial sequences of instructions. With the exception of graphics rendering, which has long been off-loaded to specialized chips, the program generally requires that the processor do one thing at a time. But the Cell offers the chance to accelerate gaming by executing some parts of the program in parallel.
Moving to a system where there are potentially nine processors computing at once improves the game play dramatically, but it also vastly increases the complexity of the programming challenge. In game-development lingo, the work of a program is divided into what are called systems. A system can range from a bit of code that draws a puddle to something more broad and complex, like computing the gore-splattering details of the meeting of a bullet and an alien’s leg. Last summer, Insomniac was in the process of moving roughly 12 major systems onto the SPEs at once.
Bringing a game to life on the Cell is a tightly syncopated process. It revolves around queries sent by the PPE to the team of SPEs. The queries request information on real-time events--such as at what point a piece of shrapnel hits an object in the game. By off-loading functions to the eight SPEs, the system has more time to devote to the delectable details: more characters onscreen, more complex artificial intelligence routines, more realistic skeletal structures within the game characters’ bodies, and, overall, an environment that makes you feel like you are inside the game. There is surround sound instead of stereo, with over 100 sounds happening simultaneously versus the 24 possible on the PlayStation 2. In Ratchet & Clank on the PlayStation 2, Insomniac was able to support 10 players competing against each other online; in Resistance: Fall of Man, they set a new record—40. On the PlayStation 2, a character could have only 30 different animated movements in a game; on the PS3, there are over 330. The payoff: the characters won’t resemble awkward manikins anymore—they grimace, scowl, and follow you with their eyes.
So how do programmers decide which tasks the PPE should be doing and which tasks the SPE should tackle? Alex Hastings asks two key questions about each task to make the choice. First, would the task take up a lot of the PPE’s time if it ran there? And second, is it the kind of job that lends itself to what the SPEs do well? “We looked for the easiest wins first,” he says. Animation and calculating collisions between objects are perfect fits, says Hastings. So those are the primary jobs Resistance doles out to the SPEs.
Even such perfect fits require some compromises. Ideally, software could automatically allocate tasks to whichever of the SPEs has the most time on its hands, but in order to simplify the programming, Insomniac was forced to dedicate two SPEs exclusively to collisions. Two processors are needed in the most demanding situation, one with lots of players, monsters, and bullets all moving around at once. “In games you’re more concerned about the worst-case scenario rather than the average,” explains Hastings. If you aim for the average, then there will be many times when the processors can’t finish the job in time and the game stalls. But by the same reasoning, most of the time those two processors aren’t being used to the fullest.
Ultimately, in future games, Insomniac will try to get almost all tasks running on the SPEs. “The holy grail that people writing games on the Cell are ultimately trying to reach is to get…the real highest-level decision making [onto the SPEs],” says Hastings. “I think that, based on where we are now, that’s still a few years away.”
That July day, with the shades drawn inside Insomniac’s conference room, Price and Alex Hastings start up a demo of Resistance. The game takes place as a sort of alternate history of the world. World War II never happened. Instead, it’s 1951 and Europe and Asia have been taken over by a sinister alien race called the Chimera. Game play unfolds from a first-person point of view, as the player--in the role of U.S. Army Ranger Nathan Hale—battles through bombed-out cities, fighting the Chimera forces. Price is marauding through a stunningly photo-realistic European city. A legion of sharp-fanged and bloodthirsty beasts closes in around him. To defend himself, he hurls a spiky ball called a hedgehog at the encroaching monsters. And then, with a few quick taps of the controls, he freezes the demo to show how the Cell is pulling off the action.
The action within the game is divided into what are called “time slices,” lasting roughly one-thirtieth of a second. During each time slice, the PPE is responding to triggers in the game and sending off requests to the SPEs. Take the hedgehog. When the vicious ball explodes, it hurls 50 deadly spikes at the enemies surrounding it. During each time slice, the PPE asks the SPEs if any of the spikes have collided with anything, what that thing is, and where on that thing the spike hit [see illustration, “Spiked”].
When a spike meets a beastly Chimera, for example, the SPE informs the PPE. Each creature in the game has a certain amount of so-called hit points; once they’re gone, the creature dies. In this case, the PPE determines that the Chimera is out of points, so the hit by the hedgehog spike causes its demise.
Though the physics of the collision and the resulting animation are calculated on an SPE, the PPE packages the problem into its simplest form first. In this case, it isolates the spike and beast from everything else in the game so the SPE can figure out how the spike’s momentum transfers to the Chimera’s soon-to-be-mutilated body. All of this happens in a flash: the player sees the ball fly and the enemy collapse into a quivering bloody heap.
But within this elegantly designed display lurks the challenge. The most precious resource in the Cell, Hastings says, is the PPE. With dozens of actions unfolding onscreen, the goal is to maximize the call-and-response of the PPE and SPEs without losing any time. “When the [PPE] is sitting around,” Hastings says, “you pay a dear cost for that. Ultimately, the risk is that you don’t finish the frame loop and drop a frame within the game.” That’s a big no-no. The updates to the screen occur within a 30-hertz cycle. Miss an update and the game will noticeably stutter.
To avoid such a situation, the Insomniac programmers carefully schedule when the PPE should ask something of the SPEs and when it should expect a response. The PS3’s operating system can make such schedules, too, but not as well as the programmer can, according to Hastings. That’s because the programmers can determine, by experimentation, exactly how long a job should take. And if they manage to optimize that bit of code so that it runs faster, they can also tweak the PPE’s schedule to reflect the change and accelerate the game.
Hastings acknowledges that some programmers disagree with such a labor-intensive, hands-on approach, and he expects that other groups are working on improved automatic schedulers. “We’ll do it by hand. With expertise and familiarity, it will get easier,” he says. “I think other teams will have an überscheduler that’s customized to their needs more than the operating system itself. I imagine both models will work.”
In coming years, an “überscheduler” will not be the only trick up game designers’ sleeves. Future tools that help to automatically divide up the work of a program into the format that best plays to the SPEs’ strengths will be key to getting more games out the door. According to Ted Maeurer, IBM’s software development manager for the Cell, IBM is making tools only for general software development and leaving the game-tool servicing to Sony. While Sony provides tools as part of its software developer kit, companies like Insomniac, in order to take full advantage of the Cell, have been designing their own custom tools. One of Insomniac’s several tools is called Luna, a program used when placing and navigating characters through the gaming world.
“Designers and game-play programmers need a solid, fast interface to place characters and other dynamic objects in the game,” Price says. “Luna provides that interface. Luna also allows us to create behavior scripts, which are necessary to tell some of the characters what to do. Not all characters use scripted behavior—many use reactive AI routines or innate behavior. But these routines are generally initialized by scripts created in Luna.”
Working out the kinks, in its PS3 game has been a trial by fire for Insomniac. With no foundation to build on, the work for the PS3 has been a big metagame of experimentation. But it’s been rewarding.
Resistance made the developers push both the hardware and their imaginations. With the added muscle power of the Cell, some of the best new game-play experiences are ones they’ve stumbled upon. In one scene, there’s an enemy character patrolling on top of a large structure of scaffolding. One day when they shot him, they saw how it could fall off the scaffolding and bring a stack of steel beams crashing down on a character beneath him. It was something impossible to render with the limited physics of the PlayStation 2. “We never thought about using objects stacked up that can collapse on another character,” Price says. Now they’ve made it a gleefully devilish part of the game.
As Price set the game back into full speed, he giddily hurled a few more hedgehogs. There were plenty more enemies to slaughter and, more important, plenty more tricks of the Cell to discover. “Coming out of the gate, we already have a lot of power to work with,” he says, “but we’re still unlocking more every day.”
About the Author
DAVID KUSHNER, a journalist in New Jersey, writes frequently about the game industry. He is the author of Masters of Doom (Random House, 2003), the story of Id Software.
To Probe Further
For an overview of the Cell microprocessor and what it can do, see “Multimedia Monster,” IEEE Spectrum, January 2006.
The January 2007 issue of Spectrum will include an article on tools for programming the Cell and other multicore processors.