How do game companies handle programming for multiple platforms?

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.


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.