45

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?

9

5 Answers 5

39

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.

8
  • I just thought that the textures are pretty accurate. So they just draw it with code and without any texture files I guess? Aug 6, 2011 at 22:07
  • 1
    Yes that's right. Aug 6, 2011 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 :) Aug 6, 2011 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, 2011 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.
    – Mauricio
    Aug 7, 2011 at 6:47
10

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.

6
  • 1
    I'm left wondering what AV company you have in mind as even possibly being non-lame... Aug 7, 2011 at 7:57
  • +1 Awesome stuff. Do they use the Nvidea APIs or draw directly to the graphics card?
    – user23157
    Aug 7, 2011 at 8:27
  • 1
    They usually set up a minimal OpenGL framework and kick off some shaders to do the rest Aug 7, 2011 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, 2011 at 11:00
  • Here are some assembly 2011 demos: archive.assembly.org/2011 Aug 7, 2011 at 13:40
4

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
4

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.

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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