"If it wasn't luck, it was the lack of bad luck that made this work out so well in the end."
- Ola Ullsten (Fp)
More pages: 1 2 3
My first 1K demo
Sunday, February 13, 2011 | Permalink

Even though I have written demos for over a decade now, I have never been part of the demoscene, never gone to a demo party, and only once in a long while have I ever really run the demos that come out of the demoscene. This tends to surprise people when they get to know me if they happened to have followed my site before. In general, I've been more interested in pushing the boundaries in terms of visual quality and performance in general, rather than squeezing the most out of a particular machine or shoehorning things into tiny executables. I did at some point in my early years give 4K demos a try, maybe around 1999 or so, but I gave up pretty quickly. With even an empty main() I got an executable that was 27KB IIRC. So I figured I had a few things to learn. Well, skip forward to 2011 and I got a renewed interest in the subject, and after a little research on the subject I was up and running with a simple OpenGL app that compiled to like 950 bytes or so. Given the small size I thought it would be cool to aim for 1K instead of 4K since that was within reach.

So I made another Mandelbrot viewer, since it's something relatively compact I thought I would be able to do quickly. A Mandelbrot viewer is perhaps the most original idea, I mean, it's not something that hasn't been done before, in fact I've done several myself before, although this one has the smoothest gradients I've managed to make so far. However, the project took far more time than I had originally anticipated. Once it was visually and functionally complete, I was somewhere over 1400 bytes. In the beginning it was rather quick to trim it down, shaving off dozens of bytes with every change. Until I got down to like 1100 bytes, after which I was happy to cut off another 5-10 bytes after an hour's work. Eventually after I got down to 1045 bytes I got kind of stuck and rewriting it all in assembly might have removed another few bytes, but I wasn't sure if it would be enough to shave off 21 bytes, so instead I changed the functionality a little. Thus there are two versions of the executables, one that's small enough to fit within the 1K limit, and one that contains the originally intended functionality, and thus is like 55 bytes larger.

If anyone knows any good tricks for slimming it down further that I might have missed, please let me know.

Update 2011-02-14:
Some sources I used to get started on this project:
1k/4k demo framework and examples
Crinkler
Crinkler secrets, 4k intro executable compressor at its best
Graphics Size Coding

Name

Comment

Enter the code below



mondi
Sunday, February 13, 2011

Translating to OS X, it's your fault if I'm late to work tomorrow

mondi
Sunday, February 13, 2011

Translating to OS X, it's your fault if I'm late to work tomorrow

jason
Monday, February 14, 2011

no download link?

MaciejS
Monday, February 14, 2011

@jason: http://www.humus.name/3D/1K-Mandelbrot.zip

nothings
Monday, February 14, 2011

I assume this was your starting point, but if so you probably ought to mention it anyway (and if not maybe it'll help you get smaller):

http://www.iquilezles.org/www/material/isystem1k4k/isystem1k4k.htm

(Since he says his OpenGL shader 1K is 948 bytes, that seems suspiciously close to your initial "like 950 bytes or so".)

Jasper
Monday, February 14, 2011

seems I also needed to download "crinkler" in order to build properly in release mode.

http://www.crinkler.net/

downloaded, copied 'crinkler.exe' to my sln directory and renamed it to link.exe


very cool setup! I am inspired to make some tiny code now.

Humus
Monday, February 14, 2011

nothings: I started this project from scratch, although in my research that link was indeed one of the most important sources to get me up and running. There are other sites and blog posts worth mentioning too. I'll put together a small list of related reading tonight.

Nuninho1980
Monday, February 14, 2011

Hi! I have GTX480 w/ 266.58whql. I got min 118fps-zoom inner and 260fps-zoom outter at 1600x1200-FULL.

you should enabled vsync and MUST change to 64Hz for get pure smooth because any other vertical frequency (most LCD's at 60Hz) may get lag/micro-stutter. therefore, not to have pure smooth.

More pages: 1 2 3