问题
How is it possible that in a 64kb compiled exe, these programs can generate such crazy visuals, complete with matching music?
An example: Ars Nova By Phantom Lord (YouTube video of the demo running)
This program's only 64kb in size! How did they do that?
Are they using some sorts of pre-existing objects, shaders, etc. inside DirectX or something like that?
What languages do they even use? Is there some sort of guide to this stuff?
EDIT: Another mind-blowing demo. How?
http://www.scene.org/file.php?file=/demos/groups/farb-rausch/fr08_final.zip&fileinfo
EDIT: More demoscene stuff.
I found some link to a group who make stuff like this and they released a product named .werkkzeug1 and some compression and audio tools but I can't still figure it out how it's possible. They even made a game with in 96kb.
theproduct
回答1:
64K demos such as the one you linked save space by procedurally generating textures and models. Module files are typically used for the music, with most of the instruments being synthesized in code.
That's the main point. Whereever possible, they generate stuff using code rather than storing the data explicitly. (And when they do store stuff explicitly, it is heavily compressed).
Executable compressors and other tricks are then used to minimize the size of the compiled code itself.
Unfortunately, demos are rarely released with source code. I did find a collection of some demo sources on scene.org, but I haven't checked any of them out myself.
There aren't many comprehensive guides either that I'm aware of, but there exist guides for various topics scattered around the web. The Hugi Magazine is one good source of such articles, in particular I would recommend checking out Special Edition #1 as it contains lots of demo coding articles.
回答2:
It's a cool demo, and I'm glad people are still doing this sort of thing...but I wouldn't say there's any 'magic' at work.
In terms of the "DNA" of the objects, there's nothing too detailed here. Cubes, a race car, chess pieces, spherical marbles, torsos. They're pretty much free to pick what models they want that compress well...or to throw out any details that don't compress well. The lack of expectations or meeting some kind of spec works in their favor, here. They can even sort objects in a 3D library by size and go "Oh, that one's small but still looks cool, let's use that." :)
There's lots of ways to mess with sizes of code if you're going to get tricky. I found this to be an interesting read:
http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
But I doubt they're getting that fancy with this. They are probably just avoiding unnecessary dependencies and coding at a fairly low level. Common sense and executable compression can push the size down quite a bit:
http://en.wikipedia.org/wiki/UPX
Music for things like this is typically done with a "tracker", and the files are more on the scale of the size of a MIDI file than an MP3. The playback routines are fairly small...this one called "MiniFMod" can play XM files and claims to add just 5K to your EXE size:
http://www.fmod.org/index.php/download#FMODMini
Syncing with the music isn't really a technical issue so much as one of artistic choice. The demo presumably is throttled to run at a consistent speed...and the music takes the same time to play each time.
回答3:
The main code itself generates textures, and sound and all objects in demo. Fractals, deformations, extensive usage of already generated objects (in demo timeline) and some other techniques are used for compact algorithmic coding of objects. Then code is compacted using exe-compressors. Also some very non-trivial techniques are used to minimize code size.
See also subculture around this.
回答4:
there is asembly competitions since the begining of computation. Like any competition you create tricks and those tricks found the reference for that competition.
the langage generally used is assembly language (the closest language to the machine after the binary ...) Why it is called the closest to the machine after binary. Because it involve complex memory managements, complex set of instructions to reach a device etc...
来源:https://stackoverflow.com/questions/6261731/what-languages-or-methods-allow-graphics-music-demos-to-fit-in-64kb-exes