
A dive into the making of a 64K Intro - kemenaran
http://www.ctrl-alt-test.fr/2018/a-dive-into-the-making-of-immersion/
======
guiambros
Really well done. It's a bummer that source code are rarely released for
demos.

For me one of the best of all times is Second Life [1], by Future Crew.
Developed in 1993 nonetheless, it was a big breakthrough at the time, with
almost 10 minutes of animation, and in early x86 hardware. Source code
available [2].

[1]
[https://www.youtube.com/watch?v=rFv7mHTf0nA](https://www.youtube.com/watch?v=rFv7mHTf0nA)

[2]
[http://fabiensanglard.net/second_reality/index.php](http://fabiensanglard.net/second_reality/index.php)

~~~
laurentlb
Demo source code is not often released, but there are many exceptions. For
example, if you're interested in 4kB intros, look at this:
[https://github.com/in4k](https://github.com/in4k) Since 4kB intros are
typically done in a shader, you can also look at
[https://www.shadertoy.com](https://www.shadertoy.com)

For Ctrl-Alt-Test specifically, we put our source code on GitHub (but not the
most recent productions)[1]. The tool to minify shaders is also on GitHub[2].

So I think you can get a pretty good idea of how we did it. If you have any
question, feel free to ask. I can give more details here, or it can be part of
a future blog post.

[1] [https://github.com/laurentlb/Ctrl-Alt-
Test](https://github.com/laurentlb/Ctrl-Alt-Test) [2]
[https://github.com/laurentlb/Shader_Minifier](https://github.com/laurentlb/Shader_Minifier)

~~~
guiambros
Thanks for sharing! Your _F – Felix’s Workshop_ [1] is pretty impressive, and
specially for the 64KB category. Thanks for publishing the source code[2] as
well.

[1] [http://www.ctrl-alt-test.fr/productions/f-felixs-
workshop/](http://www.ctrl-alt-test.fr/productions/f-felixs-workshop/)

[2] [https://github.com/laurentlb/Ctrl-Alt-
Test/tree/master/F](https://github.com/laurentlb/Ctrl-Alt-Test/tree/master/F)

------
no_identd
A note on the architecture from the demo:

The vast majority of ancient buildings follows quite simple procedural methods
that only very recently got reverse engineered:

[https://www.researchgate.net/profile/Francisco_Javier_Roldan...](https://www.researchgate.net/profile/Francisco_Javier_Roldan-
Medina/publication/283490185_Unraveling_the_Classic_Proportions_Through_the_Anthropometric_Analysis_of_the_Architectural_Heritage_The_Case_of_the_Pantheon/links/563a4dd908ae405111a5841f/Unraveling-
the-Classic-Proportions-Through-the-Anthropometric-Analysis-of-the-
Architectural-Heritage-The-Case-of-the-Pantheon.pdf)

(I suspect this method also permits approximating the plastic number [
[https://en.wikipedia.org/wiki/Plastic_number](https://en.wikipedia.org/wiki/Plastic_number)
], but so far it seems nobody has figured out a way to do so yet. I mention
this due to the architectural relevance of the plastic number.)

I speculate that leveraging this fact could likely permit even more complex
architecture in demos. (And, to mention an off topic point, it likely has some
relevance for automating UI layouting.)

~~~
AlotOfReading
So many issues. First, that paper doesn't claim what you say it does. Second,
it's just not a great paper. Even if we accept the sketchy premise, it fails
to distinguish overfitting from a successful test. Numbers of the form
(a+b*sqrt(2) can approximate almost any number to within 0.03 units, yet
there's no discussion of fitting errors to address it.

You should not take papers like these as fact.

------
royjacobs
I used to do a lot of demoscene stuff as well [1]. I've been trying to get
back into it but I've found that all of the software engineering I've done in
the meantime has kind of driven the "just get it working" mindset away
somewhat.

I used to just write code that "happened" to work, more or less. Nowadays I
would want to get unit tests in place, make it cross-platform if at all
possible and get a nice GUI going for easy tweaking. It's made it impossible
for me to get anything done in the limited free time I have :) ideally I'd
write it in Rust, but there, too, I am waiting for tooling to catch up. I get
the feeling that I'm not so much waiting for the tooling, but I'm using the
waiting as a sneaky way of procrastinating and fooling myself...

[1]
[http://www.pouet.net/groups.php?which=65](http://www.pouet.net/groups.php?which=65)

~~~
terhechte
The tooling for Rust is slowly becoming quite good. Intellij + The Rust Plugin
is a really good development environment. Other editors with RLS are not as
advanced yet though. So if you need an IDE environment for Rust, then Intellij
is really good already.

~~~
royjacobs
Yes, it's getting to a point where it's not really an obstacle anymore. I can
even debug on Windows using the latest version of clion, what is the world
coming to?

------
twic
A previous discussion of the source code of a 4K demo, 'Elevated', by Rgba,
with a link to a really good dive into it by Iñigo Quilez, who worked on it:

[https://news.ycombinator.com/item?id=11848097](https://news.ycombinator.com/item?id=11848097)

------
tnolet
Deep respect for this. Also humbled looking at my 1 page Vue + Webpack SPA
clocking in at about 1mb

~~~
digi_owl
What we get for being 3+ layers removed from the hardware used.

~~~
wiz21c
hell yeah, just looking at the length of a stacktrace under our good old Java
EE makes me sick (and I'm not even counting the additional calls to query the
database)

(I understand there's a trade off between productivity and performance, but
nonetheless, it's scary)

------
Annatar
This is the kind of stuff I grew up on, so when I’m critical of the software
and the implementations here, the bloat, the unnecessary dependencies, the
slowness... this is the standard I judge them against. The mentality and the
techniques in the article are applicable to any kind of software. When applied
correctly, they make any software small and fast.

~~~
myth_drannon
Well it's for profit software vs hobby just for the love of it. Different
goals.

~~~
vvanders
If your getting paid to work on a 8/16 bit mcu(or low SRAM ARM) same stuff
still applies.

~~~
Twirrim
Sure, but that's a very small fraction of people vs those that don't really
face those constraints (not that there isn't value in "thinking small and
efficient")

------
AHTERIX5000
Another great writeup of making of a 64k:
[http://www.lofibucket.com/articles/64k_intro.html](http://www.lofibucket.com/articles/64k_intro.html)

------
_o_
Well the first optimization would be to roll my own libc (not that hard at all
:) ) where i would load api calls by ordinal and only those that i really need
(ok, for the sake of compatibility, i would dig them from IAT table based on
16bit hash (folding fnv32) of API name + dll name). Same for all other
libraries, everything compiled with agressive optimization (at least /O2).
Next step would be to take compiler that is minimizing the bloat, tinyc
([https://bellard.org/tcc/](https://bellard.org/tcc/)), compiling 32 bit
binaries just to save some space. Maybe even go for .com to avoid PE header
bloat. At the end compress everything with something like upx, but probably i
would roll my own PE compressor. Instead of using functions, the macros would
be used, absolutely no classes, #pragma pack(1) all structures (i never tryed
what tinyc does :D). Also merging PE sections will save some bytes.

Size optimizing is fun and you can learn a lot but it is dying art, probably
99.9999% of todays developers dont understand what I have written in first
part (today, you are learning the programming, but very indequately what the
OS does, actually typical today programer understands the programing but is
clueless what his code does on low level) ... but +1 for anyone that goes into
that direction, my boss at my first job was saying that good software fits to
one 1.44 floppy but this is today violated by HHLL. Well business wise no need
for that unless you are making malware, but still cool.

~~~
pjmlp
On Windows a common approch is just to use Win32 directly, no libc APIs at
all.

Oh and link them by ordinal.

~~~
jsheard
Most demoparties forbid linking by ordinal these days, since ordinals tend to
change between Windows versions. Importing by hash is the go-to method now.

[https://in4k.github.io/wiki/import-by-
hash](https://in4k.github.io/wiki/import-by-hash)

~~~
_o_
>> ok, for the sake of compatibility, i would dig them from IAT table based on
16bit hash (folding fnv32) of API name + dll name

;)

------
bdickason
I’ve always been impressed by the demo scene but never tried my hand at one
because of the insane programming chops needed.

What are your top 3 favorite intros that you would recommend watching?

~~~
jsheard
These two 64K intros by Conspiracy are essential viewing:

[http://www.pouet.net/prod.php?which=67106](http://www.pouet.net/prod.php?which=67106)
/
[https://www.youtube.com/watch?v=qRVTI2y0BBg](https://www.youtube.com/watch?v=qRVTI2y0BBg)

[http://www.pouet.net/prod.php?which=75713](http://www.pouet.net/prod.php?which=75713)
/
[https://www.youtube.com/watch?v=hE6SZeAhZdM](https://www.youtube.com/watch?v=hE6SZeAhZdM)

Elysian by Logicoma is a favorite too, it's not as visually spectacular but
the music makes up for it :)

[http://www.pouet.net/prod.php?which=68375](http://www.pouet.net/prod.php?which=68375)
/
[https://www.youtube.com/watch?v=rWwNgVwQG1A](https://www.youtube.com/watch?v=rWwNgVwQG1A)

~~~
decko
The music part of Elysian is really cool since they wrote a synthesizer and a
tool allowing them to make music in Ableton Live (a very popular music
production application) and convert it back to code for their demos. Ferris
(the guy who wrote most of it) has a video on YouTube explaining how it works
and I was absolutely blown away by it.

~~~
molotovbliss
[https://countercomplex.blogspot.com/2011/10/algorithmic-
symp...](https://countercomplex.blogspot.com/2011/10/algorithmic-symphonies-
from-one-line-of.html)

[http://4klang.untergrund.net/](http://4klang.untergrund.net/)

------
zaarn
If someone is interested in small demoes, I recommend "A Mind is Born", a 256
Byte Demo. It runs for about 3 minutes (IIRC).

[ [https://linusakesson.net/scene/a-mind-is-
born/](https://linusakesson.net/scene/a-mind-is-born/) ]

------
kwoff
I still play
[https://www.youtube.com/watch?v=sWblpsLZ-O8](https://www.youtube.com/watch?v=sWblpsLZ-O8)
over and over, just for the song, not only because it is 256 bytes, but
because it is a compelling song too.

------
srj85
Awesome. Thanks for sharing

