开发者

64kB demos, how do they work?

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 t开发者_JAVA技巧hese programs work?

64kB demos, how do they work?


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).


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 ;)


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!!!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜