Demos are programs that encompass graphics, audio and coding techniques that display a short video in real-time. Generally speaking, everything you see is generated by the code (there are techniques used by some demos that have some elements re-rendered or regenerated and played-back, but by and large, they are considered real-time).

What makes demos so special, and part of the reason why I was enthralled by them when I first saw them on the Commodore 64 (many, many years ago), is that they are works of computer art and the heart and soul of programming efficiency.

They’re not just about programming though; the graphics and audio combine with the code to produce something (usually*) very inspiring. Indeed, it’s probably because of demos that I like goa and psy-trance music. (* I put usually in parenthesis because there are some (so-called “acid” and “kaos”) demos that to me are quite annoying.)

I think the main reason why I love demos is because they are a concentrated dose of inspiration. The graphics, music and the code combine together to make a production with a unique style and quality that really gets the creative juices flowing. Perhaps something you see in a demo triggers a thought or an idea that you might not of have thought of through traditional sources of inspiration.

However, because I am a programmer, I always go back to the code. There are demo parties in Europe such as here’s a list) that have competitions for the best demo. There are several categories for entries, mainly involving the program size, but there are other categories where size isn’t important. I’d like to focus on the size categories here though. Categories can be as high as 64KB, and even as small as 32 bytes.

This is where things get really interesting (especially for programmers). Imagine doing a program on modern machinery in just 4KB, that includes audio, and has something interesting to look at. Don’t think it can be done? Take a look at this:

Elevated by RGBA and TBC

and this one:

Michigan by Loonies

Pretty impressive, right? (Yes, the 4K includes the audio.)

Why I’m including this in a blog post that game developers read is not just about programming efficiency, though that is a big part of it. It’s more about what you can do with these techniques in your own games. In fact, many demo coders (and coding groups) go on to have careers in the game industry (you might have heard of a game called Little Big Planet).

A game that we did for iOS called Polyhedra (and Polyhedra XL for the iPad) uses a demo effect called “plasma” (just one of many) for the background on menu screens. The result is a sort-of psychedelic lava lamp. It’s all math so there’s very little impact on the bundle size, which is a reason why we used it. Here is a screenshot of what it looks like. (It looks much better in motion…see below.)

Source Code

If you want to see how some of these effects are programmed, a guy did his NYU final project on the subject and released the source code.

And a video of the effects (with great music) is here:

Here’s a really cool thing. A programmer wrote a demo effect (in just 224 bytes) by creating an image. :) He included the source code in his blog post.

Jolt of Inspiration

Whenever I need a shot of inspiration, or just want to watch some really great productions, I look through demos. I invite you to do the same! If you want to see the most impressive ones first, look at all the winners from a demo party such as Breakpoint or The Assembly.

Here are some of my favorites:

Mental Hangover by Scoopex

Iconoclast by ASD

Masagin by Farbrausch & Neuro

Matamorphosis by ASD

Here’s a practical example of how you can put these nosebleed efficiency skills to good use. Check out this video from David Crane’s Pitfall postmortem he gave at GDC2011.

Links Awards
PAiN diskmag

(thank you, McFunkypants!)