Danger Zone

Danger Zone on Xbox One X – Development Postmortem

By 31st October 2017 December 7th, 2019 No Comments

Danger Zone on Xbox One X is about to release. We thought we’d share some thoughts on what it’s like for us to develop for it.

With great power comes great responsibility

Danger Zone has been enhanced specifically to take advantage of the power of the Xbox One X. Microsoft talk about the Xbox One X by describing it as “the world’s most powerful games console”, promising to herald in the long promised era of 4K gaming. Does the hardware live up to the hype and did it allow us to deliver a true 4K game?

Developer’s Cut?

At Three Fields Entertainment we were lucky enough to receive early development hardware from our partners at Microsoft many months ago. We have been working since then on ways to use all this extra power to make the definitive version of Danger Zone.

Ignoring The Hype

So is the machine as powerful as they say it is?

In short, yes! The Xbox One X is, without doubt, the most powerful games console in the world right now.

Forged In Fire

For the first time we have been able to add two, user-selectable, performance modes to one of our games: “Best Quality” and “Best Performance”.

Quality Street

“Best Quality” not only renders the game at an incredibly crisp native 4K but also manages to add dynamic shadows while still maintaining a steady 30Hz frame rate.

Performance Management

“Best Performance” renders the game at 1080p to achieve a super fast 60Hz frame rate while still having GPU performance left over to draw our HUD and text at a sharp 4K resolution. The vastly improved hard drive also slashes our already short load times to be almost non-existent.

Optimus Prime?

In case you can’t tell I’m already a big fan of the hardware. It wasn’t all plain sailing though and getting here took a lot of hard and painstaking optimization effort to squeeze out the best possible results.

 

The Path to Native 4K…

Unboxing our first Xbox One X development kit all those months ago was an exciting day. I was excited by the prospect of getting Danger Zone up and running. Then we could start to see what we could expect to achieve. We received our hardware not long after we had begun development on Danger Zone on Xbox One and were already deep in the process of optimizing our physics CPU cost, rendering calls and GPU performance to target 900p at a solid 30Hz.

Chubby Checkerboard

Having heard all about the performance boosts that we could expect from the Xbox One X from Microsoft I wasn’t 100% confident that scaling up to native 4K from 900p would be achievable. I thought we would have to compromise with an upscaling solution, such as checkerboard rendering to deliver a reconstructed 4K image.

Sharp Objects

As with any new hardware we had teething problems getting Danger Zone up and running for the first time. Thanks to our friends at Epic and the amazing Unreal Engine we got over these hurdles relatively quickly and soon had an Xbox One X version of Danger Zone. Our efforts were rewarded with the first native 4K console game any of us had ever seen – the sharpness of the visual really blew us away.

Framed Out

Unfortunately the game was not rendering 4K at an acceptable frame rate. We had read about 4K gaming being around the corner for a few years. Now we had just seen what Danger Zone would look like at 4K on a games console. Thus, anything other than delivering native 4K felt like it would be a real let down. We re-doubled our efforts to find the performance so we could get there.

Full Transparency

By the point we had completed all our optimization for the Xbox One version of the game the native 4K target seemed a lot closer. Our biggest problem was transparency. Transparency is the ability to see through something to what is behind it. Glass and smoke (which we have a lot of in a game about cars crashing) need to be rendered using transparency to look right in game. Unfortunately transparent pixels are expensive for the GPU to render – not only do you have to render the transparent thing but also the thing behind it too, requiring the pixel to be drawn twice. It gets worse when you have transparent things overlapping one another which then require pixels to be drawn many times for each overlapping transparent thing.

Smoke Gets In Your Eyes

Things get worse still when you start having complex effects like lighting transparent smoke. You see this on our Starting Line. This is adding even more GPU cost per pixel drawn. We have more than 4x as many pixels to draw as our Xbox One version. The GPU was not managing to hit native 4K.  We desperately wanted to achieve this at a consistent frame rate. A lot of hard work and some clever smoke and mirrors (literally!) tuning to get the best effect for the cheapest render cost later and we were in touching distance of the target. The final GPU push for Xbox One performance got us over the edge and we had a native 4K game.

The Shadow Knows

Where the raw grunt and clever architecture of the console really did help was on the render side. Sadly we were unable to have dynamic shadows in the Xbox One version of Danger Zone. The CPU cost of dispatching the data to draw them to the GPU was simply too high. The faster memory and simpler hardware architecture of the Xbox One X meant that this cost was dramatically reduced. As a result in addition to running at native 4K we were able to turn on dynamic shadows while still hitting a constant 30Hz framerate.

Translucent smoke fills the screen overlapping a lot of other translucent effects and cracked transparent glass

Translucent smoke fills the screen overlapping a multiple other translucent effects and cracked transparent glass. A fiery nightmare vision of hell for a graphics programmer, “wow” for anyone else.

Speed Limit 60hz!

Having taken full advantage of the GPU grunt and clever hardware architecture it seemed a shame that we weren’t really making full use of the additional CPU horsepower at our disposal. Not wanting to rest on our laurels we set about seeing if we could run Danger Zone at 60Hz. We knew that we could comfortably run at 60Hz on the GPU if we rendered at 1080p, since there would be 4 times less to draw. We had also already done all the optimization work to always run the physics simulation at 60Hz, regardless of frame rate, as this gave such a significantly better game experience. Running some profiles we were still some way off a 60Hz CPU performance. The main culprit turned out to be quite counter-intuitive.

Lost Toys

From all our experience and all the advice we had received from expert help and talks at conferences the accepted way of making things run fast on modern console hardware is to go as parallel as possible. Specifically this means keeping as many of the cores on as many of the CPUs doing work for you a the same time as possible. A great visual metaphor from Danny Chen at Microsoft was his daughter’s toy box. When she put her toys away they would only just fit in – there were lots of gaps between toys but at least the lid would close, although sadly there was no space for new toys. When Danny cleaned up, being a king of efficiency, he managed to squeeze everything in with no gaps. Now not only did the lid close but there was space for even more toys.

Toy Story

In the case of a video game there is only a fixed amount of time each frame to get all our CPU work done. This is represented by the space in the toy box. If we can efficiently pack our CPU work in leaving no gaps on any CPU core then we can do more work in the same amount of time. This would deliver better frame rates . Or more features running at the same frame rate.

Packed In

We had taken this to heart in Danger Zone. We thought we had made great use of packing in our physics-based animation. This allows our car wheels to turn and the doors, trunks and hoods to flap when they are hit. We had made it hugely parallel, distributing the work for the physics animation. This was over all of the 140 cars we were simulating per level across all of the available CPU cores. Our performance profiles looked great. They showed we had packed work across all the CPUs. We felt very pleased with ourselves.

Parallel Lines

Unfortunately on closer inspection things were not so great. Firstly, the performance cost of dispatching all this parallel work vastly outweighed the calculations that actually needed to be done. Secondly, there was a bug in all this complicated code. This was preventing cars that were no longer driving or crashing being removed from the physics simulation. This was costing us even more CPU time for no obvious benefit. Thirdly, replacing all this complicated parallel code with a simple once a frame loop over all the vehicles to update their physics animation made our total physics cost much cheaper.  This freed up a lot of CPU time to allow us to get to 60Hz. In conclusion then, challenge every assumption and really interrogate all performance captures. They might look great. It doesn’t mean that they are.

Doors flap and unhinge as cars crash

Doors, trunks and hoods pop open and unhinge as cars explode and crash

There’s no great power than the power of X

We are incredibly proud of what we have achieved with Danger Zone on Microsoft’s new hardware.

The Danger Zone Xbox One X Update is now live for Xbox Danger Zone . In addition to beautiful 4K visuals and super-smooth 60Hz frame rate the update also adds 6 new bonus levels. Players also get a Pickup vehicle.

Happy downloading.

Buy Danger Zone for Xbox One X herelogo_xboxonex

 

 

 

 

Psst! To be the first to hear our news sign up to our Fan and Press Mailing lists here. We guarantee we will always tell you our news first before we put it out on social media.