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
Seven
Sunday, February 27, 2011
Right, I should have seen that was a power of two.
One other trick that I think you haven't used yet: splitting up your initialised data segment. Using #pragma data_seg directives, put every initialised global variable in its own datasegment, like this:
#pragma data_seg(".pfd"
static PIXELFORMATDESCRIPTOR pfd=...
#pragma data_seg(".coords"
static const float g_Coords[] = ...
Then, use Crinkler /ORDERTRIES command to let it try a few thousands(*) ways to order the data segments, and pick the most compressible one.
*May be overkill, depending in how much datasegments you create.
Seven
Sunday, February 27, 2011
And those smilies should be double-quote and close bracket... " ), not "
Humus
Monday, February 28, 2011
sqrt[-1]: Cool stuff.
I definitively have to get my hands dirty in WebGL soon.
Seven: I tried poking around a little with that, but didn't note any gains.
Edgar
Wednesday, March 21, 2012
Nice work!
Trying to build in Vs2010. I got an unresolved external: __fltused. Solved this by adding:
extern "C" int _fltused = 0x9875;
Vs2010 debug is about 400kb :-)
Vs2010 release is about 3.5Kb, so I will be checking the Crinkler as well.
Eric
Thursday, July 25, 2013
DL contains malware? Are you sure your files aren't compromised?
Location: www.humus.name/3D/1K-Mandelbrot.zip
The requested location contains malicious content, identified as Mal/Generic-S and was blocked from downloading.
Return to the page you were previously viewing.
Nuninho1980
Friday, March 20, 2015
My new GTX 780 Ti Classified gets min 389 fps woww!
after my old GTX 480 (see feb 14th, 2011)
Nuninho1980
Saturday, July 30, 2016
I've new GTX 980 Ti SC+ again and I got min 599 fps - look my old GTX 780 Ti Classified.
More pages: 1 2 3