Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

64kB demos, how do they work?

Tags:

3d

demoscene

I've seen some programs showing amazing highly detailed 3d scenes with soundtracks, but what shocked me is that they are all smaller than 64kB! How do these programs work?

enter image description here

like image 959
xzhu Avatar asked May 21 '11 11:05

xzhu


3 Answers

They generate their content procedurally. i.e. they don't add 3d models, bitmaps, sample based audio-files,... but generate that from code or some low detail representation.

Using self similarity(fractales) and building complex data by combining simple building blocks and formulas is usually the key to a compact representation.

The audio could be stored in some midi like format where the different notes are stored.

The textures are generated combining filters, fractales,... google for "Perlin noise" for a simple example. Shows how to create very different textures from perlin noise

3D models probably have some geometric description using formulas and the detail is added with techniques similar to procedural textures.


And most use some runtime unpacker. i.e. your normal executable is larger than the limit and gets compressed with an exe packer. Demos usually don't use UPX, but specialized packers which have a very small loader/unpacker and might even leak memory(who cares about memory leaks if you can safe a few bytes).

like image 73
CodesInChaos Avatar answered Nov 03 '22 06:11

CodesInChaos


Back in the day they were written in assembly language as COMs. There were even 16kb demos. I liked those demos very much and that's why Assembly was the first programming language I learned. I never managed to create a real demo but I was able to create a virus that cleared my hard disk. I don't have source code ;)

like image 22
Piotr Perak Avatar answered Nov 03 '22 05:11

Piotr Perak


They are:

  • code without useless (sic!) external libs (you really should know what you need to make it),
  • shaders compilers, compressors etc.
  • functional 3d graphics and 2d texture makers (but deterministic and constant, but related with many parameters),
  • procedural audio makers (the same each time).

Examples (code examples!) could be found here:

http://www.displayhack.org/2012/the-great-demoscene-sourcecode-giveaway/

Don`t be stupid guys - just use google!!!

like image 2
Volodia Avatar answered Nov 03 '22 05:11

Volodia