Title: EA Namco Bandai Flagship Studios Hellgate: London
1EA / Namco BandaiFlagship StudiosHellgate
London
2Thread for features
- Why not reward users with high-end CPUs?
- Well look at how Hellgate London tackled this
issue
3What do you do when FPS enhancement is not enough?
- Threading for performance has been done.
- Framerate is maxed out on 2-core.
- What about 4-core? What about n-core?
- Add features that only appear or become more
intense on multi-core. - Dont change gameplay!
4Amdahl was a buzzkill
- Speedup is limited by serial portion of code.
- Features are limited only by creativity and
effort.
Faster
Awesomer
5Short on ideas? Use these!
6Hellgate London was a natural choice to thread
for features
- Hellgate London was already targeting a broad
range of hardware. - Graphics would scale depending upon GPU.
- How should it scale depending upon CPU?
- Threading for performance deemed not enough
return on investment. - Hellgate London didnt have a profile which
seemed to benefit from threading the graphics
engine. - Lets thread for features!
7Hellgate London is architected for the future
- Hellgate London has two scaled thread pools
- First thread pool is for loading assets.
- Speeds up level loading.
- Avoids framerate hitches when new sounds or
models are loaded. - Second thread pool is for arbitrary jobs.
- Texture color swizzling to make armor sets appear
cohesive. - What else could be done here?
8Let it snow?
9Weather particles were a small part of the
overall frame time
- Weather had a small time slice of the frame
calculation. - Calculation of the weather was moderately
time-consuming, rendering not so much. - Just ramping up particles impacted CPU severely,
and started to impact GPU somewhat. - 2x, 4x weather wouldnt be a noticeable
improvement must go big! - Comparing weather particle time to overall frame
time showed a ratio of 150. - 50x weather particles possible on dual-core, in
theory. - Must remain aware of GPU impact.
10An initial fork-and-join approach didnt work out
- First try was to do a fork-and-join approach.
- Primary thread would do half the work on
dual-core. - Dedicated thread would do the other half.
- No data copying! Memory is consistent.
Render
Render
Original
Fork-and-Join
- Half of 50x is still 25x!
11Second try asynchronous update, synchronous
render
- Asynchronous update wont stall the primary
thread. - Memory is no longer consistent.
- Weather particles are redrawn when new positions
are available (probably every frame).
Render
Render
Original
Asynchronous
- Trickier, but looks like a winner.
12Heres the code changes that were made
- A callback was defined to update weather
particles. - This used the existing job task pool.
- Vertex buffers were created to hold the weather
particles. - Particle systems were marked as regular or
asynchronous. - Asynchronous systems were split into the good
twin and the evil twin - During draw, good twin draws the evil twins
particles from last frame, then captures draw
state for the evil twin. - During update, evil twin is processed in the
callback and fills the vertex buffer.
13Impact to memory and GPU prevents theoretical 50x
maximum
- One frame delay means that more memory is
required. - Also, there are more weather particles than any
other kind of particle. - 50x particles impacts framerate, but 30x...
14Wheres my hot chocolate?
15We could keep going...
- This could be taken further by
- Using additional weather particle systems for
other ambient effects. - Using the same technique to scale the weapon
effects. - Adding forces to the weather particles to
simulate localized wind.
16Threading for features has a lot of potential
- Every additional core supplies an additional
thread in the pool. - Every additional thread an additional feature?
- Well see an example in the next section, after
the break.
17We learned some dos and donts
- Do
- Target features in addition to performance.
- Take advantage of existing threading
infrastructure. - Dont
- Give up on threading if your first approach fails.
18What do you think?
- Have you tried something like this?
- Have you rejected trying something like this?