Fire propagation is a class of algorithms use to simulate the spread of fire that fall under dynamic-systems. The complexities of fire propagation is that this involves destruction of the environment and requires a game engine that supports a degree of modifiable level geometry. Modelling fire can be done simply by determining which components of the game environment are combustible and then having fire spread to adjacent combustible elements with each clock tick, or by more completely modelling the elements of fuel, oxygen and heat which are required to spread a fire.
In a 3d game engine, fire is modelled using a particle system, using a small number of discrete particles which simulate the behaviour of flame. Weapons such as flamethrowers can be used to set game elements on fire and fire may be transmitted from one game element to the next based on proximity. For example, in Half-Life 2, fire is propagated between sources of fire such as gas cannisters and gas valves which when shot or lit by electric sparks, cause enemies in close proximity to begin burning and take damage continuously until the flames go out or the enemy dies. In this instance, the flames do not affect the level geometry, only NPCs and certain physics objects within the level.
Code Examples
In a 2d grid example, fire can easily be modelled by causing any grid adjacent to a currently burning grid to have a chance of catching alit, if the grid is combustible. This chance is checked every clock tick: equally the chance of a fire burning out and dying down is also checked every clock tick. In more sophisticated examples, the amount of fuel on a particular grid can be used to determine how long a grid can burn for, and the intensity of the flame causes fire to spread to adjacent grids faster, but use up fuel quicker. This can be modelled using cellular automata.
Download Biome and load the ForestFire.txt from the Example folder to see this in action. This models not only the propagation of fire between burnable forest locations, but also the growth of a forest from young, and free of fallen branches, to old forests which have more easily burnt litter and dead trees and therefore at higher risk of starting a fire and faster to burn when adjacent locations are affected.
Download UnAngband and start a new game. Throw one of the torches you are carrying onto grass using the throw command (t or v on the laptop key set). This simpler model shows how the grass ignites and fire spreads - and distinguishes between flameable (grass) and non-flameable (river) locations. UnAngband also makes fire less likely to propagate to diagonally adjacent grids, which gives the fire a more natural looking progression between grids.
The source code for the intel demo, Smoke, is on the download page.
PCG Wiki References
External Links
Fire - Wikipedia article on fire.
Technical Demonstration: Far Cry 2 - Video of fire propagation, procedural sky, and dynamic weather in action.
Interview with Jean-Francois Lévesque on fire propagation in Far Cry 2.
Technical Overview of the Fire Propagation in Far Cry 2 on fire propagation in Far Cry 2.
An Overview of Procedural Fire by Hugh Smith and Jeff Freeman of Intel on procedural fire generation.