The Problem With Porting Games

Written by Ben Hardwidge

August 18, 2009 | 07:10

Tags: #multi-format #port #ps3 #wii #xbox-360

Companies: #bit-tech #microsoft #nintendo #sony

Multi-threaded complexity

“In the grand scheme of things,” says Baranec, “the actual CPU differences don't have nearly as much of an impact as the higher level architectural differences – particularly when it comes to multiprocessing.” He has a point. After all, you have a single 729MHz PowerPC chip on the Wii, a 3.2GHz triple-core PowerPC chip on the Xbox 360, a central processing core with seven SPUs on the PS3, and then you have one to four x86 cores on most PCs.

Not only that, but each system also handles multi-threading in a slightly different way. For a start, some PC CPUs have HyperThreading, while others don't. To further complicate matters, Baranec points out that “on the Xbox 360 you have three cores and six hardware threads, all of which can access all available RAM. On the PS3 you have one core and two hardware threads that can access main RAM, and seven SPUs that can only access a local store of 256KB at a time”. He also points out that the PS3's SPUs can also “be used in a way as to make them coprocessor-like for the GPU, further muddying the waters”.

This complicates matters when you're developing for all CPUs at the same time, and Bozz says that you have to “try to design games to a somewhat abstract processor design”. The trick is to work out the precise algorithmic work that you need to do on the CPU and then figure out how to do that best on each type of CPU. “Even though you might be dealing with multiple cores on a PC and SPUs on a PS3, the fundamental algorithms don't change that much; it's just that the implementation details might be different,” says Bozz.

At Visceral, the developer of Dead Space, this is a job for specific “domain experts” rather than the core game developers – these are the people who know the processor of each platform inside out and can work out how best to implement the algorithmic content of the game on each CPU. “It's a hard job,” says Bozz, “but not impossible.”

Sometimes, however, the way in which the CPU works is so fundamentally different from platform to platform that developers end up having to shift work from the CPU to the GPU, and vice versa. “The way you actually get the character skinning information onto the GPU differs from platform to platform,” explains Bozz. “The basic algorithmic principle is the same, but the actual implementation details can be very different. Sometimes we'll do some of the skinning on the CPU and some on the GPU, sometimes we'll do it all on the GPU and sometimes we'll do it all on the CPU.”

The problem with porting games Different GPU architectures
It's often hard for developers to justify the budget needed to include extra graphical features in the PC version of a multi-platform game, especially if only a few gamers with Quad SLI rigs such as this will be able to take advantage

Different GPU architectures

There's also a big difference between the GPUs on each platform. When it comes to the PC and Xbox 360, Telltale uses Nvidia's FX Composer tool to write the shaders for its games, using high-level shader languages such as HLSL for DirectX, and GLSL for OpenGL. As with the CPU code, the graphics code is then run through a readily available shader compiler that creates shader code for the target platform. There's apparently no easy way of doing this between the PC and the Wii, however. “The Wii is still hand-coded,” says Bruner, “we'd have to write our own shader compiler at that point, so instead we just write the shaders again.”

Telltale's games still use exactly the same textures on each platform though. “We keep the original TGAs [the texture files],” says Bruner, “so we'll take the TGAs and turn them into DXT versions of the textures if we're going to Windows or Xbox, or we'll run them through the Wii texture conversion and turn it into the Wii texture format if it's going to the Wii.”

Although Telltale still hand-codes shaders for the Wii, it has developed its own in-house automation tool to help speed up the process of porting games to specific platforms. “You basically describe the beginning resolution,” says Bruner. “On a PC that's generally 1,024 x 768 and on the Wii, it's 640 x 480. After that it just follows a bunch of rules for remapping data, using different types of data, bump maps and so on, for each platform, based on our own experience of what works.”

Bruner describes the automation process as “relatively aggressive”, as the Wii has comparatively limited resources. The end result is a game that will definitely run on the Wii, but with headroom for further hand-tweaking. Telltale's next task is to delve into the code and tweak parts of it that can be improved without killing performance. “We typically go in for critical shots, or elements that are really important for the critical path of the game,” says Bruner. “We'll start dialling up the settings in certain areas, such as the user interface – that's something that you want to look good on the target platform.”

The situation appears to be a bit simpler when going between the PC, the PlayStation 3 and the Xbox 360. In Dead Space, Bozz likens the process to that of translating code for different CPU architectures. Again, more complicated aspects are handed over to domain experts who really know the graphics architecture on each platform, but Bozz points out that on each platform, you're still performing the same task, but in a different way. “You're always creating a bunch of vertices, you're assigning materials and you're rendering those on the screen,” explains Bozz. “At the core level, you're always doing the same thing, so we do have some abstraction for different APIs, and a small amount of code that might be unique on each platform that will do the low-level interface work.”
Discuss this in the forums
Mod of the Month January 2021 in Association with Corsair

February 19 2021 | 17:15