[In this Intel-sponsored feature, part of the Visual Computing microsite, an Intel duo introduce Horsepower, a demonstration of enhanced, multi-CPU specific ambient animation -- with full, redistributible source code included.]
Game developers want to deliver the best experience possible for each
player, but they also want a game that is fair to all players. A
higher-performing machine for one player can and should lead to a better game
experience, but not a gameplay advantage in a multi-player situation.
Many
solutions to this dilemma exist; one approach is to use the extra power to
render more frames. Another approach is to take incidental effects and amplify
them on multi-core machines. This leaves gameplay consistent across all
computer platforms, but rewards those with higher-end systems.
This article
introduces a demo called Horsepower that shows such a technique: enhanced ambient
animation when run on a multi-core CPU. The source code for Horsepower is
free to use and improve.
Horsepower started
with the code base of the Intel Smoke demo, which features a multi-threaded
game framework with tremendous flexibility. Smoke is a free application and its
source code can be downloaded.
Most of the existing
Smoke systems were carried over to Horsepower. Smoke already contained a threaded
AI system so this capability was migrated to Horsepower. The Smoke framework also utilizes Havok Physics, which
is threaded, and Horsepower benefits from this as well.
Horsepower was created
to showcase a perceptible difference for users with a multi-core CPU. By
threading to take advantage of multi-core CPU power, a few horses running in a
field are multiplied to hundreds of horses (Figs. 1-3). Dynamically adjusting
the number of horses drawn on-screen maintains a consistent frame rate of 30
frames per second (fps).
The demo decreases the number of horses drawn on
screen until 30 fps is hit and maintained and, on the flip side, increases the
number of horses on screen until the target 30 fps is hit. Although the horses
are the main animated objects in this demo, you can use this technique on any
ambient animations in a game for a better game experience.

Figure 1. On an Intel Core i7 processor-based system
using eight threads, we can maintain almost 600 horses.

Figure 2.
On the same Intel Core i7 processor-based system using four threads -- which
means no Intel Hyper-Threading Technology -- we drop to 570 horses. So simultaneous
multi-threading gives us about 20 additional horses by adding logical cores
(and not adding any physical cores).

Figure 3.
When we drop to two threads, and therefore are only using two of the four physical
cores and no Intel Hyper-Threading Technology, we can maintain roughly 235
horses.
In this article, we
introduce the technique of threading an animation system, and you'll see how to
apply it to your ambient animations. We'll show you the code we built to
explore the idea, show how we changed an animation system so it would scale as
desired, and describe some issues you might find as you try this in your game.
Your gamers will thank you for providing a richer gaming experience!