Game Engine Architecture

(Ben Green) #1
325

CPUs. Moore’s Law , which predicts an approximate doubling in transistor
counts every 18 to 24 months, still holds true. But in 2004, its assumed cor-
relation with doubling processor speeds was shown to be no longer val-
id. As a result, microprocessor manufacturers shift ed their focus toward
multicore CPUs. (For more information on this trend, see Microsoft ’s “The
Manycore Shift Whitepaper,” available at htt p://www.microsoft post.com/
microsoft -download/the-manycore-shift -white-paper, and “Multicore Erod-
ing Moore’s Law” by Dean Dauger, available at htt p://www.macresearch.
org/multicore_eroding_moores_law.) The net eff ect on the soft ware industry
was a major shift toward parallel processing techniques. As a result, mod-
ern game engines running on multicore systems like the Xbox 360 and the
PLAYSTATION 3 can no longer rely on a single main game loop to service
their subsystems.
The shift from single core to multicore has been painful. Multithreaded
program design is a lot harder than single-threaded programming. Most
game companies took on the transformation gradually, by selecting a hand-
ful of engine subsystems for parallelization, and leaving the rest under the
control of the old, single-threaded main loop. By 2008, most game studios had
completed the transformation for the most part and have embraced parallel-
ism to varying degrees within their engines.
We don’t have room here for a full treatise on parallel programming
architectures and techniques. (Refer to [20] for an in-depth discussion of
this topic.) However, we will take a brief look at some of the most common
ways in which game engines leverage multicore hardware. There are many
diff erent soft ware architectures possible—but the goal of all of these archi-
tectures is to maximize hardware utilization (i.e., to att empt to minimize
the amount of time during which any particular hardware thread, core or
CPU is idle).


7.6.1. Multiprocessor Game Console Architectures


The Xbox 360 and the PLAYSTATION 3 are both multiprocessor consoles. In
order to have a meaningful discussion of parallel soft ware architectures, let’s
take a brief look at how these two consoles are structured internally.


7.6.1.1. Xbox 360


The Xbox 360 consists of three identical PowerPC processor cores. Each core
has a dedicated L1 instruction cache and L1 data cache, and the three cores
share a single L2 cache. The three cores and the GPU share a unifi ed 512 MB
pool of RAM, which can be used for executable code, application data, tex-
tures, video RAM—you name it. The Xbox 360 architecture is described in


7.6. Multiprocessor Game Loops

Free download pdf