andrewducker: (drama llama)
[personal profile] andrewducker
This video was generated by code that fits into 4k.

That's 4096 bytes. The equivalent of about 1000 words.

No, I have no idea how they did it.

But you can download the original from here (final version on the right hand side), and it runs just fine on my PC.



Generated video from here.

Date: 2010-10-17 01:48 pm (UTC)
From: [identity profile] momentsmusicaux.livejournal.com
I wanted to say fractals, but I think it's simpler than that. The end sequence in particular shows that the world is built out of intersections of simple shapes, like concentric cylinders and spheres. I bet if you take off the texture (which itself is dead simple and repeats, just that it's on lots of surfaces so it looks complex), and could zoom out, you'd see primary shapes cut into chunks like a chocolate orange.

Date: 2010-10-17 02:16 pm (UTC)
zz: (Default)
From: [personal profile] zz
I'm wondering if a lot of it (including camera path & sound) is just seeded off a random number generator, and this one was a particularly nice run of many they looked at. means the code can just deal with generating and texturing shapes. i'm also guessing 4k is 4k of high level directx instructions or something, not 4k of machine code?

Date: 2010-10-17 05:29 pm (UTC)
From: [identity profile] octopoid-horror.livejournal.com


This is .kkrieger, an FPS game.

It's 96k

:-D

Date: 2010-10-17 07:29 pm (UTC)
From: [identity profile] hirez.livejournal.com
Demoscene FTW!

Date: 2010-10-17 10:31 pm (UTC)
From: [identity profile] doubtingmichael.livejournal.com
I think this is a really interesting practical example of quite how much Chaitin-style information density there is in a number that is quite small (even for small numbers, by which I mean, those that fit into the universe).

I didn't see many fractals in the animation, but I have a few thoughts about how they may have compressed some of the data. Firstly, I suspect these are not all proper three-dimensional objects - the part where floating spheres gradually merge I think will actually be some other mathematical process, there is no model of the 3-d shape at each point in the merge. Similarly, some of the visual effects are probably hardwired in, rather than laid over with separate code. Secondly, I bet there's a lot of data reuse: some of the shapes we see, and some of the musical phrases, may be what you get when you treat some of the operating code as positioning data. (With 4k of data, you have a lot of substrings available.) Thirdly, yeah, I agree - a random number input can give a lot of payoff if you're patient about tweaking it.

None of which is meant to detract from their achievement, of course!

Similar issues are discussed in the chapter on Elite in Francis Spufford's Backroom Boys, where the Fibonacci sequence breeds planets like rabbits. (As you probably well know, Professor.)

Date: 2010-10-18 11:48 am (UTC)
From: [identity profile] martling.livejournal.com
You'll not get much from looking at the EXE with standard tools. Most of the code will be compressed, with a tiny bootstrapper/decompressor at the start to unpack it. The resulting program image will be a lot bigger than 4k. And then it will start generating data. The key to all these demos are simple procedures that generate complex patterns.

The rendering code will be leveraging the graphics hardware via DirectX/OpenGL to do a lot of the work. In particular, the hardware can render textures onto surfaces and apply lighting functions to them. So much of the "look" of the surfaces comes from just generating (and animating) the simple line pattern textures you can see. The tweaking comes from shader programming.

As [livejournal.com profile] momentsmusicaux points out, the world is built from simple geometric shapes. More specifically, it's boolean functions over solids. If you take a bunch of spheres and cuboids scattered in space and find the intersection of the volumes they occupy, this is what you get.

But I doubt it's that random. Demo crews are too picky. The details will come from some sort of PRNG, but I expect the overall flow and major shapes are deliberately designed.

If you want to see something actually hacked in 4k of machine code including the rendering, just look up 4k demos on DOS / Amiga / other platforms.

E.g. this one which reproduced a lookalike of the Descent game engine and a copy of the first level. You can run it under DOSBox although it comes out slow.

Backroom Boys

Date: 2010-10-19 10:21 pm (UTC)
From: [identity profile] doubtingmichael.livejournal.com
I think Backroom Boys is a good book - though don't go reading it for code compression techniques. It's much more about the people involved in various British engineering and scientific endeavours, with one chapter per story. Some are successes, some aren't. Spufford is a very easy read (a little like Bill Bryson, perhaps), and explains the technicalities involved well. The entire book has a very British atmosphere to it: nostalgic, but with a modest sort of pride in accomplishment.

Date: 2010-10-25 07:03 am (UTC)
From: [identity profile] meico.livejournal.com
Very cool. Great aesthetic sense.

It looked to me like:

They had a nice scalar field renderer (marching cube meta-ball renderers are common in the demo scene) and and realized that you can put any function into it (not just meta-ball based functions, though they did a bit of that too)... The also had some nice texturing code, but were using the same texture everywhere.

All the boolean operations were actually simple done as a sum of simple functions to produce the the scalar field...

Of course they also did all the standard demo scene tricks such as self unpacking code and in this case I'm certain they were making high level calls in DirectX or OpenGL...

March 2026

S M T W T F S
1 2 3 4 56 7
8 9 10 11 12 13 14
15161718192021
22232425262728
293031    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Mar. 15th, 2026 08:24 am
Powered by Dreamwidth Studios