Future Crew’s 1993 PC demo called Second Reality had a Brobdingnagian impact on my interest in programming. Much of what I researched and played with at a young age was due to this demo. The demo won a couple of prizes and eventually made it onto Slashdot’s Top 10 Hacks of All Time. The source code which contains lots of PAS, POV and ASM files was released to celebrate the 20th anniversary of the demo. A high quality video of the demo is also available.
This post is my first “memory bank” post. In these posts I’ll dig up some of my old code, make it run and preserve the code by committing it to github. In this post I’ll revive some of my old code for making fire and water.
Coding like it’s 1998.
Mode 13h was a standard 320x200 VGA graphics mode with 256 colours. Mode 13h provided a linear 320x200 block of video memory at 0xA000:0000, where each byte represents one pixel.
To set the RGB value of each of the 256 colours in the palette one would write the colour number first to the DAC Write Index register at 0x3C8 and then writing three 6-bit RGB components to the DAC Data register at 0x3C9 using the outp() function from conio.h in MSDOS. Michael Abrash’s Graphics Programming Black Book is a good reference for more info on how this all worked.
For interest sake, I looked up the compiler from the binaries I had compiled back then. The compiler was Borland Turbo C++ 3.2 Copyright 1991 Borland Intl. The IDE looked like:
Simple fire can be created by having a heat source with random noise that is continually convolved with an asymmetrical filter kernel. The asymmetrical filter creates a flow effect. On a modern processor this effect runs at almost a 1000 FPS.
Doom style fire can be created by having a heat source that is propagated up while being randomly extinguised and scattered. I generate one more random number than the method recently documented by Fabien Sanglard, but it is almost as fast as the simple fire above.