Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do game companies handle programming for multiple platforms?

You often see that a new game will be released on Xbox 360, PS3 and Windows PC.

How do gaming companies do this? Is it a common source code compiled using different compilers? Are different source codes actually required?

There's an example of this phenomenon described in this news article.

like image 443
stormist Avatar asked Jun 08 '10 18:06

stormist


3 Answers

Generally speaking, the vast majority of multiplatform "triple-A" titles are implemented on top of an engine such as Unreal, Source, or other smaller engines. Each of these engines is custom-implemented and optimized for each platforms and may use a lower-level API such as DirectX/OpenGL which in turn uses the console. Each of these engines also has plug-ins for platform specific stuff (e.g., motion controls) that interact with the official drivers or APIs of the hardware.

Many of these engines support their own scripting languages or hooks for many things, so it is write once.

For example, take a look at the unreal engine: http://www.unrealtechnology.com/technology.php

Most of the biggest engines, like Unreal are so flexible and robust that they allow developers to write all kinds of games. For instance, the Unreal engine was used not only for shooters, but also for shooter-RPGs like Mass Effect.

Remember that most of the manpower in making games is devoted to graphics, set designers, audio design, level design, etc., and there are custom editors for all of that. Many of the set pieces are usually programmed via scripting languages. Only a small portion of folks in gaming companies actually write code in low-level languages like C.

like image 92
Uri Avatar answered Oct 08 '22 12:10

Uri


The engine takes care of this by providing a platform independence layer. Things that varies between platforms for instance graphics library. threading, clock and filesystem etc; are implemented for each platform in the game engine.

I can make a call to the engine to render a 3D model consisting of triangles. The engine in turn render this model by calling down into the platform independence layer which uses an implementation for the currently used platform.

like image 45
Daniel Dimovski Avatar answered Oct 08 '22 11:10

Daniel Dimovski


There are two ways game companies do this:

1) Writing/using a multiplatform engine 2) Porting a game

A multiplatform engine will feature abstractions for platform-specific actions (making a Windows API call, rendering in DirectX vs OpenGL, etc etc) so that all of the work can be done once, then built for both machines. Usually it's a matter of writing simple wrapper methods for things like Direct3D calls and what not. Most newer game engines are being built from the ground up with multiplatform support. Others are adding multiplatform support.

If a game engine isn't multiplatform, it has to be converted to run on the target platform. This is usually a two-part operation. First, all of the API calls and interfaces with the hardware need to be redone for the target platform. The second part involves debugging and optimizing the game for performance. Typically a direct port will not perform very well, as the code will feature platform specific optimizations that do not apply to the new target platform.

For various reasons, ported games can suffer from performance issues, usually in spite of watered down visuals. Take a look at The Orange Box on PS3 or CoD: Modern Warfare for the Wii to see two examples of ports gone wrong. For the OB, Valve outsourced the task of porting the game(s) to EA. In the second instance, Activision decided that it made more sense to port a game on an engine designed for more powerful hardware over to a weaker platform instead of building the game on top of a new engine designed to get the most out of the Wii.

like image 41
ravibhagw Avatar answered Oct 08 '22 10:10

ravibhagw