What languages or methods allow graphics & music demos to fit in 64kb EXEs?
Asked Answered
B

4

6

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?

Boyt answered 7/6, 2011 at 7:9 Comment(5)
I'm sure it's not programming as we'd think of it... probably made in a 3d or movie editing program, and then exported to a windows executable format.Berglund
@Berglund can't be cause many of demos at credit says coded by ... , and maybe there is a editor , but this is massive compression how this is possible why no one else do this :/Boyt
For those who don't like downloading executables off the internet to answer StackOverflow questions, a video is here: youtube.com/watch?v=odAIAfPEgmMMarkmarkdown
see @Petrs answer. The reason not more use this technology is that it is 1) CPU/GPU intensive. And 2) A bit experimental and controversial, and large studios are probably reluctant to jump on the bandwagon prematurely.Dissidence
I see, I guess I didn't get all that info from the link. Interesting question.Berglund
L
5

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.

Ladonnalady answered 7/6, 2011 at 8:5 Comment(0)
T
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.

Teador answered 7/6, 2011 at 7:27 Comment(2)
it's not just fractals some models can't for example human , car , chess models , ... in the example , camera movements with music match , even a math algorithm which can generate a human model is far bigger than this tiny filesBoyt
I didn't say it's all just fractals. Remember about compression, which can be also specifically optimized for data. It's hard to believe, but most part of such demos is programmatically generated, see: en.wikipedia.org/wiki/Procedural_generationTeador
M
3

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.

Markmarkdown answered 7/6, 2011 at 7:51 Comment(5)
thanks for the info but still there is lot of things behind this , look at this , i can't just believe it scene.org/file.php?file=/demos/groups/farb-rausch/…Boyt
@Synxmax: FR-08 was indeed a bit of a game changer in the world of 64K demos, but if you examine it carefully, you will notice that most if not all the models are constructed out of simple geometric shapes, the music and scenes are heavily reused throughout the demo, and the textures are also quite simplistic.Ladonnalady
@Synxmax: I was impressed by this sort of thing as well when I was younger, and seeing the Finnish demoscene for the first time. Stuff by Future Crew etc. seemed impossible. I still think it's neat, but it is very possible...and being done by mortal beings like you and I... :) If brevity interests you, it might be instructive for you to look at "Code Golf" examples just to get into the mindset of how outside-the-box thinking can cause order of magnitude savings in code size: codegolf.stackexchange.com/faqMarkmarkdown
@Synxmax: Another impressive demo is Elevated, a 4K (!) demo. Lots of small tricks are used here, but the main ones are that the music is synthesized and the fact that the only geometry is a procedurally generated heightmap.Ladonnalady
Thanks guys for great info , i am currently opened over 50 tabs in my browser and readingBoyt
C
1

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

Cliffcliffes answered 12/9, 2013 at 20:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.