Valve’s Source Engine Goes Multi-Core

News Posted 16/11/2006
Author: PV5150
Source: The Tech Report


Valve logo

You won’t have to wait for Half-Life 3 to enjoy the benefits of Valve’s multi-core efforts. Multi-core optimisations for Source will be included in the next engine update, which is due to become available via Steam before Half-Life 2: Episode 2 is released. With the megahertz era effectively over and processor makers adding cores rather than cranking up clock speeds, game developers looking to exploit the capabilities of current hardware are faced with a daunting challenge—”one of the most important issues to be solving as a game developer right now,” according to Valve software’s Gabe Newell. Valve has invested significant resources into optimising its Source engine for multi-core systems, and doing so has opened up a whole new world of possibilities for its game designers.

Game code tends to be single-threaded because games are inherently serial applications—each in-game system depends on the output of other systems. Those dependencies create problems for coarse threading, though, because games tend to become bound by the slowest system. It may be possible to spread multiple systems across a number of processor cores, but performance often doesn’t scale in a linear fashion.

Valve initially experimented with coarse threading by splitting the Source engine’s client and server systems between a pair of processor cores. Client-side systems included the user interface, graphics simulation, and rendering, while server systems handled AI, physics, and game logic. Unfortunately, this approach didn’t yield anywhere close to a linear increase in performance. Valve found that its games spend 80% of their time rendering and only 20% simulating, resulting in an imbalance in the CPU utilization of each core. With standard single-player maps, coarse threading was only able to improve performance by about 20%. Doubling performance was possible, but only by using contrived maps designed to inflate physics and AI loads artificially.

Valve was also able to apply multithreading to the Source engine’s renderer. Game engines must perform numerous tasks before even issuing draw calls, including building world and object lists, performing graphical simulations, updating animations, and computing shadows. These tasks are all CPU-bound, and must be calculated for every “view”, be it the player camera, surface reflections, or in-game security camera monitors. With hybrid threading, Valve is able to construct world and object lists for multiple views in parallel. Graphics simulations can be overlapped, and things like shadows and bone transformations for all characters in all views can be processed across multiple cores. Multiple draw threads can even be executed in parallel, and Valve has rewritten the graphics library that sits between its engine and the DirectX API to take advantage of multiple cores.

Feel free to read more on the multi-core overhaul here

Feel free to discuss this article in our forum