Making it in Unreal: how voxel magic makes the world burn in Firefighting Simulator

Firefighting Simulator Unreal Engine 4

A flashover is one of the most dramatic events that can happen in the dangerous world of firefighting. Once a room has burned for so long that it’s filled completely with smoke, the fire finally goes out. But that’s when it can be particularly dangerous. 

“If you have a room that fills up with gas, it basically doesn’t contain oxygen at that point. If you open the door then…” Firefighting Simulator’s creative and art director, Gregor Koch, pauses ominously.

“…then oxygen streams in, and it’s so hot that anything will ignite – even the smoke gas itself will start to combust.”

The explosions we witness in games are often triggered by a collision or scripted to happen just as we step into view. But in Firefighting Simulator, natural explosive phenomena like the flashover happen, well, naturally. It’s one of the results of the unparalleled fire simulation developers Chronos have put together. Here’s how it works.

Read more: the best games of 2017 so far.

Voxels in vogue

Firefighting Simulator Steam

Voxels are a technology most tend to associate with a previous era in PC gaming – namely the undulating plains of 1999’s Outcast. But they’re the same stacks of cubes that power Chronos’ fire propagation system.

“Fire propagation is something that Unreal Engine 4 doesn’t do by default,” Koch points out. “We actually built it up from scratch.”

With access to Unreal Engine 4’s source code, Chronos have built a system that generates voxels for every piece of geometry in the game world. Simple walls, which don’t burn in a particularly complicated way, are assigned bigger, chunkier cubes – while staircases and sofas are made up of far denser collections of tiny voxels, the better to capture their complexities.

“The main idea about this system is that fire is a rather complex thing, and simulating fire on a molecular level is absolutely impossible,” Koch says. “But voxels, if they’re set up right, will allow us to go ahead and do this in real-time.”

The system is automated – it would be “really problematic” to fill every building with voxels by hand. Chronos then use a brush-like tool they’ve developed for the Unreal Engine 4 editor to handle fine detail – painting a line for the flame to follow along the floor, for instance, to simulate the idea that an arsonist has spilled gasoline there.

The studio’s level designers and artists can set what materials an object is made from, which in turn determines how it burns and whether it’ll break. If a part of the geometry is holding up something else, it can trigger a collapse.

“When the fire simulation burns through the voxels, it will also at some point trigger structural damage,” Koch says.

Simulating fire

Firefighting Simulator

You won’t notice any of those voxels when you play Firefighting Simulator. The simulation is handled entirely by a second game thread, which runs alongside what the player sees. “The game is just visualising it,” Koch explains. “The second thread is doing all the heavy lifting and computation.”

This separation of powers comes with a huge advantage: the fire propagation system doesn’t have to update 60 times a second, in line with the game itself. Instead it can update just five times a second, allowing for far more computation than if it were linked directly into Firefighting Simulator’s main thread.

What’s shown on-screen will be only the information you need to make life-or-death firefighting decisions. “Currently the effects artists are really busy making the fire effects look better, and improving on how the [simulation] works with the visualisation for the player,” Koch says.

Firefighting Simulator quote

Behind the scenes, the fire works its way through the simulation. It starts to claim the level voxel by voxel, travelling inexorably upwards in mimicry of real-life heat.

“Every voxel contains information about the available fuel, about its current temperature, about the ignition temperature of its fuel, and about the amount of combustion and type of gas it extracts when it burns,” Koch says.

That’s important: a piece of wood might produce smoke, but a styrofoam object the same size could fill a room with toxic fumes much more quickly, with serious gameplay repercussions.

“As soon as something burns in a room, the toxic smoke and fumes go up to the ceiling and start filling the room from the ceiling-down,” Koch says. “Then it goes out through the windows if something like that is available – otherwise the room will eventually just fill up with smoke gas, and at some point will eventually stop burning because the fire doesn’t have anything but smoke gas around it.”

Firefighting Simulator

And voila: a flashover. Of course, that’s hopefully something you can avoid when you’re saving the occupants of a burning building in Firefighting Simulator.

“Now we’re visualising the fire and how we expose that to the player with particle systems and volumetric fog,” Koch says. “[We’re using] everything we can come up with to allow a player who has a bit of knowledge about firefighting to look at the flames and know what is going on.”

Firefighting Simulator’s Showroom mode is available for free on Steam. Unreal Engine 4 is free too.

In this sponsored series, we’re looking at how game developers are taking advantage of Unreal Engine 4 to create a new generation of PC games. With thanks to Epic Games, Chronos, and Astragon.