Averaging fire
1993Random bottom row, four-neighbour average, cooling by one per row, a 256-colour black-red-yellow-white palette.
heat = avg(below) − cooling
1993 to today
Seed the bottom line with random heat, let it rise and cool, colour it black-red-yellow-white. A few lines of code that every coder of the '90s wrote at least once, and that still looks alive.
The algorithm
Keep a buffer of heat values. Every frame, write random hot and cold values into the bottom row. Then, from top to bottom, set each cell to the average of the cells below it, minus a little cooling. Heat drifts upward, spreads and fades. Map heat through a palette that runs from black through red and yellow to white. Doom's version instead copies each value one row up with a random sideways jump and a random decrement.
The old-hardware trick
Heat is one byte per pixel and the palette does the colouring, no RGB maths at all. The average of four neighbours is three additions and a shift by 2. On VGA mode 13h the heat buffer can simply be the screen.
bottom_row = random(0 or 255)
for y in 0..h−1:
for x in 0..w−1:
heat[y][x] = ( heat[y+1][x−1] + heat[y+1][x]
+ heat[y+1][x+1] + heat[y+2][x] ) >> 2
− cooling
pixel = palette[heat] // black → red → yellow → white
// Doom PSX: heat[y−1][x − r + 1] = heat[y][x] − (r & 1)Documented milestones, with a source for each. Famous examples, not claims of who did it first.
Javier ‘Jare’ Arévalo / VangeliSTeam · DOS · VGA
Coded 9–10 May 1993 and released with source: the first famous fire effect, months before Iguana's Inconexia. Hans Wennborg's walkthrough quotes Jare on how it works.
SourceIguana · Inconexia · DOS
Shown at Assembly 1993: the fire as part of a complete production, beyond a stand-alone experiment.
SourcePlayStation Doom team · PlayStation
The title-screen fire moves palette-indexed heat upward with random decay and sideways displacement, not the four-neighbour average.
SourceFlugeldufel · Fire [256 byte] · Commodore 64
A tiny fire on the old 8-bit machine, as a size-coding challenge.
SourceAndrei Tatarinov / NVIDIA · GeForce 8800 · shaders
Volumetric flames from 3D and 4D simplex noise, animated per pixel instead of propagating a 2D heat buffer.
SourceFabien Sanglard (after Samuel Villarreal) · JavaScript
A compact, inspectable reconstruction of the palette and transport mechanism, building on Doom 64 reverse engineering.
Source4rknova · GLSL
Weighted upward heat propagation and a colour lookup in shader passes, the original mechanism preserved instead of noise-only flames.
Source6 live versions, from the oldest platform to today: 4 on the CPU, 2 on the GPU. Retro versions run at their original resolution and palette. Demos pause when off screen.
Random bottom row, four-neighbour average, cooling by one per row, a 256-colour black-red-yellow-white palette.
The same algorithm in fat 2:1 pixels and the C64's own muted fire colours: black, red, orange, light red, yellow, white.
Fabien Sanglard's reconstruction of the PSX Doom fire: 37 palette indices, each copied one row up with a random sideways hop and decay.
The intro classic: the letters themselves are the heat source, so the name burns. In a cooler, violet-to-white palette.
No buffer, no history: domain-warped fractal noise scrolls upward through a flame-shaped falloff, evaluated per pixel.
A turbulent cone of density marched along every view ray, glowing by temperature, while the camera circles it.