Behind Incubation

After months of work, we’ve finally released our first demo: B – Incubation. As I love reading how other demos are made, I’m going to share a few things.

Zavie and I seriously started Incubation in January. At this time, we had no real experience in size coding, and almost no code base. We didn’t even know how to write a shader. All we had was a texture generator. We decided to start from IQ’s 64k framework (to get compiler options and basic code optimized for 64k intros). We planned to release our intro at Breakpoint in April, but it was so crappy that we decided to delay it. We finally released it at Evoke, in August.

Some groups (e.g. Farbrausch, Conspiracy, Fairlight) create their demos with a tool, while other groups like ASD prefer pure code. In Incubation, everything is hard-coded, but we used some tricks to improve our productivity and reduce the number of compilations. When the code is compiled in debug-mode, many shortcuts are available, such as time-control (play, pause, backward, forward), and camera control with mouse and keyboard. Camera data is stored in an array, and we use a spline to interpolate positions (thanks IQ!). This array is in a separate file: In debug-mode, we can reload it at any time; in release, the file is simply included. The same goes for the light position.

We also use a tricky macro, called Tweakable Value, to tweak our constants at runtime. For instance, we use it to update text position, fade in / fade out dates, and so on. As you can see, there are many things we can edit and update without recompilation (shaders are obviously reloadable at runtime, too).

In Incubation, we use about 50 colour textures, 25 normal maps (for parallax mapping), and 25 specular maps. Everything is generated in code – we don’t have any fancy node-based editor. I wrote a minimalist script language to call the texture generator functions and get immediate feedback without recompilation. We later replaced this broken language with picoc, a C interpreter.

For fun, I put this texture generator on my webserver. Imagine: You enter a few lines of code in your browser, press a button, and see the generated texture within a second. As everything is shared, we can see when other people’s textures, copy and edit their code, etc. Although a browser is not the best tool to write code, it is awesome for social interactions. We started making many textures for fun, we invited our friends to play with the online texgen, and we got many interesting results. For example, Rubix made a Pacman shape for fun, I decided to put it on a wall, and it ended up in the demo.

Pacman on a wall

Here is a random list of things we’ve used: kkrunchy, v2, game of life, L-system, Voronoi cells, Perlin noise, convolution filters, parallax mapping, godrays, depth of field, glow, Bresenham’s line. Nothing new here, but this might help some beginners.

Size limit has not been an issue for us; 64 kilobytes is a lot when you have only code and no external library. We didn’t even apply the planned optimizations, but we’ll probably do the following for our next intro: truncate floats, reorder data, do delta encoding, obfuscate shaders… Here is the estimated compressed size of a few parts:

  • Music: 15.5k
  • Textures: 10k
  • Camera data: 4k
  • Animations data: 5k
  • Shaders: 3.5k

Yes, this is very different from Panic Room, about which Smash mentioned that “You might be surprised to learn that the shaders are the biggest single (yes, compressed) data block in the 64k, bigger than the meshes, samples, music data, texture data etc. modern rendering apparently doesn’t come for free.”

Next time, we’ll improve our rendering and get meshes. :)

This entry was posted in 64k, Prod. Bookmark the permalink.

6 Responses to Behind Incubation

  1. @lx says:

    Cool little making of! Tell us more about the texture generator, Is it completely generated on shaders or mixed with c? I assume also that everything was written in opengl?
    Indeed, 3.5K of compressed shaders is really low, next time for your next 64k, you will probably run out of space for this part! ;)

  2. LLB says:

    The texture generator is pure C++ code (no shader at all). I think that’s much easier to do. The only problem was the speed. As it was loading time was a bit slow, we decided to parallelize it (that’s easy – most textures are independant) using one thread per core.

    Yes, next time we’ll use more space for shaders and meshes, but we can optimize and save several kilobytes.

  3. Pingback: [Demoscene] Incubation: a Very Cubic 64k Prod - 3D Tech News, Pixel Hacking, Data Visualization and 3D Programming -

  4. Tom says:

    Very nice demo, I really liked it but apparently my antivirus (AVG) detects it as a worm…

    It has to be a false virus…

  5. Zavie says:

    A couple of antivirus softwares have false positives with exe files compressed with kkrunchy unfortunately.

  6. Patapom says:

    Very nice job on the intro ! Lovely ! ^__^

Leave a Reply

Your email address will not be published. Required fields are marked *