
How DOOM fire was done - ingve
http://fabiensanglard.net/doom_fire_psx/
======
xabi
This effect was first developed by @thejare in 1993.

[http://www.pouet.net/prod.php?which=15071](http://www.pouet.net/prod.php?which=15071)

Old discussion:

[https://news.ycombinator.com/item?id=15828773](https://news.ycombinator.com/item?id=15828773)

More info here:

[http://www.iguanademos.com/Jare/wp/?p=2756](http://www.iguanademos.com/Jare/wp/?p=2756)

[https://www.hanshq.net/fire.html](https://www.hanshq.net/fire.html)

[https://www.gamedev.net/articles/programming/graphics/simple...](https://www.gamedev.net/articles/programming/graphics/simple-
fire-effect-r222/)

~~~
djmips
Web version of
[http://www.iguanademos.com/Jare/files/Fire/](http://www.iguanademos.com/Jare/files/Fire/)

~~~
gvd
Iguana! omg I still remember their hearthquake demo. It inspired me to become
a developer

------
htk
I ported this effect to Pascal in Delphi, and won first place on the "Set the
World on Fire" contest by Borland. Good Times!

[http://edn.embarcadero.com/article/20487](http://edn.embarcadero.com/article/20487)

~~~
dmix
Neat, what prize did you choose? I'm guessing the Delphi Pro?

~~~
htk
If I remeber correctly it was Delphi 3 at the time. I loved Delphi, but I only
got proficient on it thanks to Marco Cantu's "Mastering Delphi" book. I don't
know what I would think of the book today, but it was a huge help at the time.

------
unixhero
I love these DooM posts on my holiday break. There is some kind of mindfulness
- zen like - ie. anti-stressing - reading about something so directly fun,
trivial and specific.

------
sovietmudkipz
The mobile view of this website is an absolute pleasure to see. I’ve not
really had a reaction this powerful before. The site is gorgeous to look at
and the content is unhindered by poor design.

I’m impressed!

~~~
fabiensanglard
Thanks! Since I wrote the book I try to take extra-care of the overall
typesetting. I have an iPad Pro that I use to benchmarks the overall "appeal"
of each article.

For a time I considered writing only one-pager that would entirely fit on an
iPad screen without need to scroll (like an actual granite tablet). It is
unpractical but keeps coming back to me every times I scroll down.

------
billfruit
I am kind of surprised, at the attention and fond rememberance Doom is still
getting, compared to Descent, which though released around 2 years later,
appears to me much more accomplished: levels of tunnels with complex spatial
arrangements, the 6dof motion, even had a sterographic 3d mode.

~~~
pjc50
DOOM was the first. Well, really Wolfenstein was the first, but it was limited
to a grid. DOOM was many people's first networked game too. And the level
editors were easy enough to use that they created a community.

Descent's 6dof control system rather counted against it in the days when
people had keyboard, mouse and two axis joysticks. I remember struggling with
it a lot, even trying two sticks at one point.

DOOM was also more memorable in its black metal aesthetic - the music and gory
graphics. The E1M1 theme will stick with me while I can't remember a note of
descent.

~~~
cma
Ultima Underworld was released before Wolfenstein:
[https://en.wikipedia.org/wiki/Ultima_Underworld:_The_Stygian...](https://en.wikipedia.org/wiki/Ultima_Underworld:_The_Stygian_Abyss#/media/File:Ultima_underworld_1_screenshot.png)

But Wolfenstein had lower requirements by not supporting the same amount of
geometry variation.

Hovertank/Catacomb were released even earlier than the two and done with some
of the same tech as Wolfenstein I believe.

~~~
leoc
Ultima Underworld successor System Shock (1) deserves mention here too.
Another big step forward, and a couple of years before Quake.

------
ASipos
Also see:

[https://lodev.org/cgtutor/fire.html](https://lodev.org/cgtutor/fire.html)

which is part of:

[https://lodev.org/cgtutor/](https://lodev.org/cgtutor/)

------
baruchthescribe
Haha - I did an mmx version of this in assembler about twenty years ago for
Konstantin Boldyshev's asmutils package. Doing things 8 bytes at a time made
it ridiculously fast.

~~~
bananaboy
Nice! I did a size optimised version in assembler for MS-DOS a long time ago
myself in 173 bytes: [http://www.humbug.net/projects/download/demos/js-
fire7.zip](http://www.humbug.net/projects/download/demos/js-fire7.zip) It's
not the smallest fire I've seen but I thought it was the smallest that still
looked nice.

~~~
baruchthescribe
Very cool. Works like a charm in DOSBox.

------
samstave
Funnily enough - I was just watching this mini-documentary on DOOM cheats this
morning before getting out of bed:

[https://www.youtube.com/watch?v=L76uEtX4b7c](https://www.youtube.com/watch?v=L76uEtX4b7c)

------
enneff
I read the Doom Black Book over the holidays and it was a real treat.

~~~
fabiensanglard
:)

------
qha
This is only for the PSX port of DOOM, not for the original DOOM.

~~~
bluedino
I was very confused at first. Fire effect in doom?

------
robertAngst
>Notice that by adjusting how the fire propagates up, wind can also be
simulated. I will leave that as an exercise for the readers who had the
courage to read up to here.

This is what I cared to see.

The rest was not a mystery and seems like a pretty simple math/logic problem.

Although, now that I type this out, I am thinking the wind would be simple
too...

Can anyone explain why the interest? I imagine there are college kids who do
this type of logic.

~~~
blondin
yes, i am surprised that Fabien is doing the "leaving it as an exercise for
the reader" on us. all authors have to do this at some point heh?

anyways, you see that "dst = src - randIdx + 1" line? that's what the "reader"
needs to play with. right now "randIdx" is 0, 1 or 2. when it's 0, "dst" is
one pixel to the right of "src", when it's 1 "dst" is at "src", and 2 is to
the left. also remember we are placing it "below" because we are moving up, so
we do "firePixels[dst - FIRE_WIDTH] = ...". hope that helps.

this article has renewed my interest in demo scene effects. canvas2d seems
very friendly now. last time, i had a hard time with the animation boiler
plate, manipulation of the canvas element and colors. colors manipulation
seems to still be awful. i see Fabien had to write 15 lines of code for
palette conversion. but that createjs library makes many things easier. hope
Fabien can go through other popular effects... or maybe i should lol : )

------
Impossible
Seems similar to Hugo Elias's fire effect also
([https://web.archive.org/web/20160418004150/http://freespace....](https://web.archive.org/web/20160418004150/http://freespace.virgin.net/hugo.elias/models/m_fire.htm)).

------
kakarot
Heads up everyone, the DOOM Blackbook is 50% off on Amazon right now, which
puts it down to a very reasonable $25. I just purchased it along with the
WOLFENSTEIN 3D Blackbook which is also 50% off.

------
Zardoz84
This effect was used on the original Unreal engine to generate realtime fire
effects that looked awesome. I don't know if the actual Unreal engine supports
this anymore.

------
dublo7
Memories. Is this a lost art or do people still do this starting out? I mean
now that everyone has unity to play with do people no longer have to know
about the actual hardware?

~~~
k__
I have the feeling many game devs do their own engine, but yes, the new people
start with a existing engine.

~~~
hurricaneSlider
Most game developers do not code their own engines. In fact unless you're
doing something special (e.g. claybook, Miegakure, anything with true videos,
or an unusual development pipeline/platform), it is immeasurably more
economical to use an engine like unity/unreal with their large communities,
asset stores, support and decent tooling. Even many 'AAA' games are now
starting to use these commoditised engines (possibly with their own
extensions/forks)

~~~
gambiting
Uhmmm....I work for one of the top 3 largest game publishers in the world and
all of our games are made using our own engines that were done in-house. Unity
and Unreal Engine are only used for prototyping(with maybe one exception in
Unity, but that was a small project done by a very few people).

~~~
holoduke
I would fire you for your lack of knowledge. The top 100 mobile gaming apps
are mostly unity based. Top 100 on steam heavily populated with unreal and
unity based games.

~~~
eropple
You'd fire somebody for not knowing what people outside of a closed-loop
corporate environment happen to use?

I mean, I posted 'cause he was wrong, but this is Bad Boss garbage.

------
richm44
I remember coding this effect in C a long time ago. Back in the day we used to
use the frame buffer as the data store too, not really feasible today!

------
ohiovr
The effect looks a little like the moon fire effect in the genesis
presentation from Star Trek II

------
wohoo
Interesting articles, infortunatly it has many typos: framebuffer is initiated
full yellow, not black; pixel in code should be firePixel[src]; randomness
should be applied symmetrically with rand+1 in [-1;1].

~~~
cravay
I love these kinds of articles but I also think there is a slight mistake. In
my opinion it should say "upper-left is at array index zero" instead of
"lower-left is at array index zero".

I don't think it matters if the randomness is not applied symmetrically and
the fire moves slightly to the left. I also can't comprehend the part about
the framebuffer being initiated yellow and not black.

