BLCK4777

694 words ~ 3-6 minsMathieu 'p01' Henri on July 31th, 2015

BLCK4777

Winning 1kb intro at Assembly 2015, BLCK4777 is a JavaScript explosion of light and triangles in 1023 bytes

This may take a few seconds to generate the ~2min music before the animation starts.

Additional links

Technical tid bits

The techniques used in BLCK4777 are pretty basic. There is no webGL, shaders or web Audio API. Instead it uses good old PNG bootstraping, an Audio element and 2D canvas with shawdowBlur to make the triangles glow.

Unfortunately shadowBlur is slow in Firefox.

The ~2mins of music are synthesized on the first call of the script, where it runs the whole simulation to know when the big triangles shine or intersect with the white beam.

As for the compression, I used the now classic PNG bootstraping technique, which consist into making a polyglot file that's both a PNG image and an HTML page. The PNG image is our code, seen as shades of gray. The HTML page loads the PNG image, reads the pixels back to reconstruct the code and run it.

In BLCK4777, the code is a single line of JavaScript code that is run using a setInterval(...,13). This approach is not CPU friendly but it compresses better.

Tooling

The lack of automation remains the biggest pain point in my tool chain for this kind of productions, but things improved significantly with BLCK4777.

For the most part I used a private gist. When things got real I would minify the script with JSmin, make a PNG image out of it, rezop, deflopt, defluff, bootstrap it and finally run gzThermal to get some hindsights about the defalte stream. These steps allowed me to optimize over 150 bytes in less than 2 weeks. Also, this approach seem to give ~10 bytes gain over a regular JSEXE PNGxHTML file.

Thanks

Thanks to Adinpsz @kaneel @frksr TBC Loonies, and everyone pushing the limits with style!