
Personal – ongoing
My First 4k Demo
I've always been fascinated by the demoscene...
The demoscene fascinates me.
I regularly lose hours on pouet.net or watching the streams from Revision.
I've always wondered how these wizards manage to squeeze so much performance out of such limited, old machines.
Okay, at the peak of the demoscene they weren't old machines, but still, I've always been in awe of what they pulled off.
Today, with our ridiculously powerful graphics cards, getting these effects is no longer much of a challenge. You can't really talk about feats or technical genius like you could back then.
But some demo categories bring the challenge back.
The 4k category, for instance, caps the executable at 4096 bytes.
That's tiny. A plain "hello, world!" in C++ will probably give you an executable around 15K, even in release...
So I decided to give it a shot. I had to understand and crack the secrets of these sorcerers.
The result is this little demo. I chose not to use the GPU and to stick to a single CPU core, to make recreating some classic effects more of a challenge, while still staying under the 4K mark.
It was a really interesting challenge, and I learned a lot about compiler and linker settings. I even had fun making versions for Windows, Linux, web and GIF.
With what I learned, I was even able to set up hot reload both natively and on the web. In the end it's not that arcane as long as you make sure not to change the memory layout between two hot reloads.
I could also use the few bytes I have left before hitting 4k to add some music; I should try that at some point.
Anyway, I'm very happy with this exercise. I really learned quite a few things that will be useful on other low-level projects.