Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

So, I am here at assembly 2011 and there was this demo played: http://www.youtube.com/watch?v=69Xjc7eklxE&feature=player_embedded

It's one single file only, it says that in the rules. So I repeat, how have they made this to fit into so small file?

share|improve this question
    
Can this demo be downloaded? I would like to see how it works when run locally. –  David Aug 7 '11 at 11:05
1  
Yes, you can find that demo here: ftp.untergrund.net/users/atzAdmin/fltatz_uncovering_static.zip –  Samuli Lehtonen Aug 7 '11 at 13:45
    
Of course there are several megabytes of system libraries without which this thing wouldn't be able draw a single polygon... –  hobbs Aug 7 '11 at 17:57
    
Hmm, I wonder if this will run in Crossover/Wine? :P –  Omni5cience Aug 7 '11 at 21:35

5 Answers 5

up vote 37 down vote accepted

It's procedural based. The content is not included in the exe, only the rules of how to draw it. When launched, the program draws what it needs to at runtime it's not pre-rendered or pre-saved in any form.

This is the same method used by Elite to create a vast universe of star systems, etc.

It's pretty amazing what is possible today using procedural generation, i think games will feature more of this in the future.

share|improve this answer
    
I just thought that the textures are pretty accurate. So they just draw it with code and without any texture files I guess? –  Samuli Lehtonen Aug 6 '11 at 22:07
1  
Yes that's right. –  Gary Willoughby Aug 6 '11 at 22:07
1  
For these kind of demos the sound is also generated from code (no samples). Everything is synthesized on the fly... and of course some credits and fade scenes allow heavy precomputation :) –  Karoly Horvath Aug 6 '11 at 22:35
2  
As a former 3d artist, I've been wanting procedural generated textures to be included as standard tool-set in mainstream 3d art programs for a long time. Probably the closest is by using the built-in scripting language.... –  Darknight Aug 6 '11 at 22:51
    
You might be interested in such stuff as Project Frontier and Procedural World, which are two approaches to the same problem through procedural generation. –  Kyte Aug 7 '11 at 6:47

As @Gary Willoughby says, it extensively procedural.

Also, there is significant hand asm coding involved, along with extensive knowledge of how many of the windows/platform of choice systems work internally.

There is also a 4K demo category, if you want to see even more extreme examples of compact code.

Some of the DemoScene groups release their demos online, where you can download them and play them if you want.

Conspiracy
farb-rausch

Also See Wikipedia on the history of the DemoScene

Note - a lot of the demos will cause your antivirus to freak out. Basically it seems pretty much all demos use packed .exe files, and most of the demo groups roll their own packers. Unfortunately, because a lot of AV companies are lame, they generally claim that any packed binary executable is a virus of some sort.

share|improve this answer
1  
I'm left wondering what AV company you have in mind as even possibly being non-lame... –  Jerry Coffin Aug 7 '11 at 7:57
    
+1 Awesome stuff. Do they use the Nvidea APIs or draw directly to the graphics card? –  user23157 Aug 7 '11 at 8:27
1  
They usually set up a minimal OpenGL framework and kick off some shaders to do the rest –  Jasper Bekkers Aug 7 '11 at 10:44
3  
It's seriously impressive stuff. I think if I was about 15 years younger this would be what I'd spend my spare time doing. –  user23157 Aug 7 '11 at 11:00
    
Here are some assembly 2011 demos: archive.assembly.org/2011 –  Samuli Lehtonen Aug 7 '11 at 13:40

Like everyone is saying they widely relies on procedural generated code, but there's even more about this demo in particular, if you pause and look at some details, lets see for example those walls: look that bricks and how light reflects on them. They look natural.

That's because they are using a lot of vertex shaders and fragment shaders to bring life to the generated content.

I spent some time trying to understand how they make such things, and feel amazed with every piece of code I grab from those demos.

BTW, when doing those demos they also use compression tools to squeeze even more. check this compilation process:

all:
nasm -f bin -o intro main.asm
nasm -f bin -o stub stub.asm
gzip -n --best intro
advdef -z -4 intro.gz
cat stub intro.gz > intro
chmod +x intro
rm intro.gz
rm stub
share|improve this answer

As others have already stated, a lot of this relies on procedurally generated assets.

There is another element to it, which is compression. 4k and 64k demos use highly specialized executable compressors. The most famous of these are kkrunchy by farbrausch (for 64ks) and crinkler by TBC & Loonies (for 4ks). Moreover, modern demos make heavy use of shaders, which are plain text and thus get dramatically smaller after compression.

Now, as far as integration in video games is concerned, the main problem is that all this takes time. Generating procedural content takes time, and extracting the executable takes a huge amount of time. And people generally have more space on their hard drives than time to spend waiting for the game to load, so I don't think we will be seeing lots of this in widely available games anytime soon.

share|improve this answer

There is a PowerPoint presentation of how the rendering was done in this specific demo. This alone doesn't explain how everything fits into 64 kilobytes, but is the key for how the geometry was created in such a little space.

There is also lots of interesting read in his blog about his other demoscene productions.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.