tAAt 2006 new year demo breakdown writeup

Remember the game scorched earth? It had this landscape with falling sand. Now, what if you tilted the screen?

This demo started my new year's demo streak that's still going on (as of this writing, i.e, 2014). I had done some of the older (DOS-age) tAAt new year demos, though, so this wasn't a completely new experience to me.

I've played around with simple pixel-based sand simulations before and since, but this is a fun example. In simple terms, the box has a number of sand particles, and each time you check if they can fall or not; if yes, they are moved, otherwise they stay put.

In the simplest form, you go through the buffer pixel by pixel and if the pixel is live, you check if the pixel below it is live, you mark the pixel below as live and the current one as dead. If you only use one buffer, the order by which you go through the buffer matters, or otherwise some pixels travel through the whole buffer in one go.

If you use two buffers, however, this doesn't matter.

It's trivial to make the pixels slide in 45 degree angles if they can't fall directly down, etc. This one generalizes that further. The "gravity vector" is calculated from the rotation of the cube, and the pixels in the box are moved based on that (with a lot of tweaking to make it actually work). To render, each "live" pixel is rendered as an OpenGL line.

The result was a demo that was pretty mesmerizing to watch.

Music was by Nitro.

Comments, questions, etc. appreciated.