Site icon Mariusz Bartosik's website

Let’s Make a Demo!

Do or do not. There is no try.

It’s time to write about the project I’m going to develop and what I would like to talk about in forthcoming posts. The basic idea is to create a demo.

Now, if you just thought “A demo of what? And can’t you just code a full version?” please read on. Those who just did a big facepalm may skip the next section :).

What is a demo?

In short, it’s a computer program that shows (demonstrates) various graphics effects synchronised with music. The effects are calculated and drawn in real-time, just like in a 3D video game, except that they’re not interactive. The purpose of creating such programs is to show off skills of the creators and to express their artistic vision. Demos are created by groups of people made of programmers, musicians, graphic artists, designers and others. Such demogroups compete with others during demoparties. All the groups forms a computer subculture called the demoscene.

There is no way to select just one best demo as an example, but you may want to check out this one. It was released at the Breakpoint party in 2007, and what’s interesting, the executable’s file size is only 177 kB.

Obviously, there are newer demos and this is a topic for a separate article, but if you would like to watch some more productions, visit www.pouet.net and check out “all-time top” entries in the left column. The proper way to watch a demo is to download it and run on your computer, but most of them have captured version on YouTube.

Motivation

It’s always nice to create something, especially if you can have some fun while doing it. Some programmers would like to make another Web API or Sudoku solver in their free time, and that’s fine. For me it’s more interesting to explore 3D graphics programming as there’s always something new to try. It’s also a good way to review and refresh my existing code.

Technology

I considered two options. First was to use C++ with OpenGL, and the second involved JavaScript with WebGL. Both would utilise GLSL shading language.

The first one allows to use the full capacity of the CPU and the GPU, but it also requires more work on setup and you have to recompile whole program after each change. To show the results you have to make a screen-shot or capture animation and upload it on YouTube. Using JavaScript and WebGL you don’t have to care how to open a window or play the music – the browser will take care of this. And if you changed your source just refresh the page to see the results. That’s a nice feature to have. On the other hand, JavaScript is just a scripting language, and WebGL is based on OpenGL ES, a limited subset of OpenGL designed for embedded systems like smart phones.

I’m not a big fan of JavaScript, so let’s keep using “the real thing”: C++ should provide the maximum performance, without any restrictions and you don’t have to automatically release all the source code of your precious routines ;). But, of course, this project will be publicly available on GitHub. I may use WebGL as an illustration in articles, where applicable.

The effects

Most of the demos are prepared by a group of people. That is, even if there are some multi-talented people out there, you probably won’t be able to compose music, draw pictures, model complex 3D objects and prepare textures for them on your own. As this is (almost) a solo project, the effects should be based on math and algorithms, rather than hand-made 3D scenes. Good candidates are: procedurally generated 3D objects, particle system, fractals, all kinds of physics simulations.

Some post-process filters will be required to put on top of the actual effects. The most common are: depth of field, glow, color correction, ambient occlusion, chromatic aberration etc. We will take care of writing them if needed.

Exit mobile version