Live Coded Demoscene
January 8, 2012 4:07 PM   Subscribe

When Iñigo Quílez isn't hard at work at Pixar, he's active in the demoscene, creating 4KB programs that render incredible procedurally generated scenes. He also writes tutorials on both video and audio synthesis, but arguably the coolest section of his site features live-coding videos of him improvising both audio and video rendering code that will make any experienced programmer feel wholly inadequate.
posted by spiderskull (32 comments total) 80 users marked this as a favorite
 
The 4kB Elevated makes me feel plenty inadequate without seeing the guy crank something like that out in real time. And that is two years old. Sheesh.
posted by Western Infidels at 4:22 PM on January 8, 2012 [1 favorite]


Nice post! I was just enjoying this wonderful post of his about domain distortion (watch the video at the end).

He's often referred to as simply 'IQ', and for good reason.
posted by localhuman at 4:23 PM on January 8, 2012 [1 favorite]


Cool (I love those short code exercises) ! Note that Microsoft Security Essentials finds a trojan named Win32/Bumat!rts in some of the executables (at least for "Elevated").
posted by elgilito at 4:43 PM on January 8, 2012


I literally can't fathom how you could render something like elevated with a 4kb executable; even knowing it's mostly some clever- okay exceptionally clever- formulas, it still boggles the mind. I mean, am I to understand that the youtube videos are the sole product of 4kb executable, with only the music added later?
Western Infidels: The 4kB Elevated makes me feel plenty inadequate without seeing the guy crank something like that out in real time. And that is two years old. Sheesh
No kidding; I was reminded recently in the Evgeny Kissin thread why I stopped playing the piano. Well, isn't this guy great- I'm a "professional programmer", but I've always known inside what a fraud I was. And this proves it.

How utterly depressing, knowing that I'm nothing but a useless lump, with a mortgage, whose only talent is taking up space on this planet.
posted by hincandenza at 4:59 PM on January 8, 2012 [3 favorites]


You'll be pleased to know that "Trojan:Win32/Bumat!rts" is MSE's way of saying "this is suspiciously odd code, but isn't a known virus."

More details:

Technical Information (Analysis)
Trojan:Win32/Bumat!rts is a name used for trojan detections that have been added to our signatures after advanced automated analysis.

The generic nature of this detection means that the malicious behaviors exhibited by files detected as Trojan:Win32/Bumat!rts are highly variable and may vary from once instance of this detection to the next.

No further information is currently available on this threat. However, should we receive a significant number of reports, then a specific detection will be added to our signatures and a detailed analysis will be added to the encyclopedia.


The ethics of Microsoft just making up a virus name that applies to a mere heuristics analysis threat level and making it sound like a known, named trojan is left as an evaluation for the reader (and possibly a libel lawyer).
posted by jaduncan at 5:13 PM on January 8, 2012 [3 favorites]


*but isn't known malware."
posted by jaduncan at 5:15 PM on January 8, 2012


I mean, am I to understand that the youtube videos are the sole product of 4kb executable, with only the music added later?

No, that would be ridiculous. The music is generated by that 4KB executable too.
posted by teraflop at 5:16 PM on January 8, 2012 [13 favorites]


Go away or I will replace you with a very small shell script 4KB executable.
posted by ceribus peribus at 5:20 PM on January 8, 2012 [3 favorites]


I wish this guy would do terrain generation for Minecraft or a similar game. I can't imagine the awesomeness that would result.
posted by simen at 5:22 PM on January 8, 2012 [3 favorites]


I mean, am I to understand that the youtube videos are the sole product of 4kb executable, with only the music added later?

No, that would be ridiculous. The music is generated by that 4KB executable too.


Well, I'm not uber geek but I believe some of the work is done by libraries external to the 4kB. For instance, the description for Elevated mentions DirectX and the description for Kinderkrasher mentions OpenGL.
posted by juv3nal at 5:22 PM on January 8, 2012


That's true, I suppose the synth-y music, being largely repetitive, could be very small as a description of a few tracks of a few sets of notes repeated N times. Still... that's effin' nuts. The live programming videos are just... painful to watch.
simen: I wish this guy would do terrain generation for Minecraft or a similar game. I can't imagine the awesomeness that would result
Not Minecraft, but doesn't Dwarf Fortress do something similar in terms of an economy of code to generate frighteningly accurate environments in terms of their resources and geologic/geographic layouts? That was presumably the inspiration for a character in Neal Stephenson's Reamde, an autistic (?) geology nut who basically designs the virtual world to be as true-to-life as possible, and algorithmically generated.

So yeah, I agree it'd be pretty amazing to combine the rendering elements of demo work with Dwarf Fortress, and generate a unique Skyrim-esque world that is geologically and biologically accurate. However, aren't these demos designed such that the CPU is overtaxed to generate them- and thus aren't useful for doing much more than generating that exact topology in that exact way for that video?
posted by hincandenza at 5:33 PM on January 8, 2012


Whatever, I could do that I'd I wanted to. I just don't feel like it.

as I silently weep and contemplate a career change.

There are some software rendering demos, old school techniques like blitting a framebuffer to video memory aren't super interesting and nearly (maybe actually) impossible to do running in protected mode in a modern OS. I've tried to run Some of my old DOS assembly code that simply wrote to 0xA0000 to less than spectacular results. I may be wrong though, there may be a way to do it.
posted by Ad hominem at 5:41 PM on January 8, 2012


People reading this post may well be interested in Ibniz (Homepage) - a virtual machine, geared towards live programming, that lets you make...interesting demos...based on a sequence of characters. There's even a Javascript implementation.
posted by Jimbob at 5:53 PM on January 8, 2012


To be pedantic, the 4KiB executable is *after* compression; many (most?) demos these days are using Crinkler. The decompressed executable is much larger (sometimes 100KiB or more) - still impressive, but not *quite* as mind-boggling.
posted by nonlocal at 5:53 PM on January 8, 2012 [1 favorite]


However, aren't these demos designed such that the CPU is overtaxed to generate them- and thus aren't useful for doing much more than generating that exact topology in that exact way for that video?
You can generate once and cache the results
To be pedantic, the 4KiB executable is *after* compression; many (most?) demos these days are using Crinkler.
All of the information still needs to be there after compression. Crinkler, at most, simply strips out redundant bits.
posted by delmoi at 5:59 PM on January 8, 2012


hincandenza: "I literally can't fathom how you could render something like elevated with a 4kb executable"

There's a whole lot going on in that particular demo, although there are a few relatively simple mathematical formulae (specifically, a fractal) that generate realistic-looking landscape topographies. The textures are also presumably procedurally-generated (that is, the images are not contained in the executable, but a few simple formulae for generating those images are), while the all of the 3d rendering ("the hard part") is made simpler by the fact that the fractal landscape contains no convex surfaces.

None of this should detract from the fact that elevated is a fantastic accomplishment. However, there are some surprisingly elegant underlying mathematics, which help keep the demo down to its impressively small 4KiB size.
posted by schmod at 6:28 PM on January 8, 2012


Crinkler itself is pretty cool. Not only does it do some standard compression it optimizes the PE header, does some voodoo on DLL function imports it does various x86 ASM optimizations to use the pipeline better.

Not that all the procedurally generated stuff isn't great, but if anyone is interested in old school Mode X graphics and x86 assembly check out Michael Abrash's Graphics Programming Black Book it is available for free online and it has some great stores about John Carmack.
posted by Ad hominem at 6:40 PM on January 8, 2012 [1 favorite]


Something I found out awhile ago: Lots of these 4k (and 64k) demos will crash on Windows 7. Turns out, this is due to Crinkler and not the demos themselves. If you get the newest version of Crinkler and recompress them they work fine.

For example, there are Win7 binaries of "Elevated" at Internet Archive here (elevated_win7_test.zip) here if you want to check it out. It still makes MSE throw a false trojan error, though. (Rest assured there is literally no room for a trojan in a 4kb file. Well, unless one of these demo kids wrote it...)
posted by neckro23 at 7:09 PM on January 8, 2012


neckro23,

Rest assured there's totally room in 4kb to pack a trojan. Shellcode is counted in bytes.
posted by effugas at 7:15 PM on January 8, 2012 [3 favorites]


Demoscene stuff makes me smile -- my degree was in mathematics, and my computing roots are in writing programs to fit into the 16K RAM that was all I had on my first PC.

I wish I could remember the name of my favorite demo of all time (mostly because of the music) right now so I could show it to you. If I remember later, I will.
posted by stavrosthewonderchicken at 8:02 PM on January 8, 2012


while the all of the 3d rendering ("the hard part") is made simpler by the fact that the fractal landscape contains no convex surfaces.

The low level rendering is being done by the DirectX api code and ultimately by the graphics drivers and GPU; fitting those textures and geometry into 4k is still quite an accomplishment, but unlike the demos of a decade ago, he doesn't also have to squeeze in a software renderer.

Also, convex surfaces are the ones that are easy to render, but a fractal landscape isn't convex anyway.
posted by Pyry at 9:21 PM on January 8, 2012


Anyone know what the glsl editor is in the Apple video? I'd love to edit glsl like that.
posted by chairface at 9:43 PM on January 8, 2012 [2 favorites]


Despairing programmers with impostor syndrome, take heart. Have you been procedurally generating lots of textures or synths lately, pushing yourself to get the most impressive results with the smallest code? No? Because IQ has. He's just had a lot of practice at this sort of thing. Your practice is probably in very different areas.
posted by a snickering nuthatch at 9:59 PM on January 8, 2012


Very cool, but... "void main (void)"? Nnnngh.
posted by Joakim Ziegler at 11:01 PM on January 8, 2012


chairface - it seems to be of his own making; I was searching for it too, and all I could find on its availability is here. Haven't looked into that sexyvisuals thing yet.
posted by valdesm at 12:35 AM on January 9, 2012


So is everything in the 4K? Or is it 4K of links and call outs* to squillion gigabyte libraries** and directx*** thingies that actually do all the work?**** Could I run this in, say, dosbox and get the same result?

I knew a bloke back in the early 90s who showed me something he'd knocked together in a few minutes of his spare time. It was a tiny exe on a floppy, it ran from a dos prompt on a 486DX2, and it made a controllable, rotating cube that played animation or displayed images or colours on the various faces. Bastard.

*,**,***,**** oh you bet your sweet bippy I'm down with this programming stuff
posted by obiwanwasabi at 4:00 AM on January 9, 2012


Aether is the kind of the one I was thinking of, from here, but it turns out my memory had conflated two or three different demos, so that wasn't exactly what I was thinking of. Still, I do very much like that one, and there are a bunch of other great ones on that page.
posted by stavrosthewonderchicken at 4:36 AM on January 9, 2012


hincandenza: "I literally can't fathom how you could render something like elevated with a 4kb executable"

he has a presentation on his site about how Elevated was done.
posted by Z303 at 6:07 AM on January 9, 2012


So a picture is now worth 4096 words?
posted by double block and bleed at 10:49 AM on January 9, 2012


Chairface: here's Shadermaker, which I've actually used on the job, it seems barebones but once you start messing with the shaders that it comes with, it becomes kind of fun.

You'll also want to bone up on OpenGL a bit, I read through most of this book and it was pretty comprehensive, more-so than some online tutorials. Plus, it comes with a lot of code which you can sift through (which is how I learn, natch)
posted by hellojed at 11:26 AM on January 9, 2012


Some more on creating 4K/64K intros: Code4K, IN4K and The Farbrausch Way to make Demos
posted by Z303 at 1:42 PM on January 9, 2012


So a picture is now worth 4096 words?

1024 words, actually. 512 on 64-bit systems.
posted by qxntpqbbbqxl at 2:24 PM on January 9, 2012 [1 favorite]


« Older Get sideways for 1000 EUR   |   OpenCode Newer »


This thread has been archived and is closed to new comments