Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Arnaud Carré, posted on April 14, 2002

Image Description, by Arnaud Carré

As all programer, I like to write unusefull things... Some time ago I decide to write a DirectX8 library called "TinyD3D8". Tiny because the challenge was to produce EXE as small as possible.

I hear some of you saying : "Today computers have so many disk space, so many memory that's stupid to spent effort writing little programs !". And I totally agree : that's stupid for a commercial product. But, many of us in the industry are about to forget an important programming rule: the fun ! Yes, that's just fun to try to push the software limit ! On the other hand, you have to learn many techniques to build little DX programs: we learn about the compiler, the linker, the FPU and so on.

To test my library I write some various funny programs. All these programs runs under windows platform, directX8 (or better :-)). Here is a brief description of the "image of the day" picture, left to right, up to down...

Knot: EXE size: 5.5Kb
Knot is a nice program computing and displaying random knot. Every 3 seconds appair a new generated knot with random geometry and random colors.

Physics: EXE size: 6Kb
A true real-time rigid body physic program. You can rotate the cube or invert the gravity field in order to see the pink tetrahedron moving and bouncing around :-) I write it after reading a really nice article by "Thomas Jakobsen". Use Verlet integration for stability.

Mandelbrot: EXE size: 5.5Kb
Real time "deep" mandelbrot zoomer. Zoom with a factor of 2^55, ( ~1e16, so that's the range between you and the universe !). Use recursive optimized mandelbrot computing routine (Avoid to compute large flat area). Do you ever imagine a simple formula "z' = z^2 + c" can generate such colored lands ? :-)

OldSkool: EXE size: 24Kb
Whaoo 24Kb ?? that's too big !! :-) This is the first eavy use of my TinyLib. There is some graphical resource packed in the EXE (textures and music). This is an "oldskool" animation as you can see on AMIGA or ATARI 12 years ago :-) Please note the music use a YM2149 sound chip emulator. Pump up the volume all of you nostalgic freaks ! :-)

You can download all that unusefull stuff here:

Please don't ask me for the TinyLib source code for the moment, maybe I'll post it a day. (have to make it clean :-)).

Have a nice day !
Arnaud Carré

Image of the Day Gallery


Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

April 15, 2002, 04:03 AM

Small is good !! (sometimes ;D )
I hate those "3 CD for some bunch of polys" productions, keep it small and be happy!
Visit if you want to see very impressive things in 256 BYTE!

Tobias Franke

April 15, 2002, 04:16 AM

Praise the lord, he's back!!!! Yeeeeeeehaaaaaaa!


April 15, 2002, 04:30 AM

Oo°. ???


April 15, 2002, 04:34 AM

"Sure they can be smaller. If I coded it all in assembly, nothing would remain, probably."

bullshit. no assembly required, just brains and knowhow.
take a look at some farbrausch 64kb intros. we all know how to do that if we have a massive overdose of time. (or..?)

even 4kb's can easily be done in visual cpp. (oh yeah now we'll require a little bit assembly for the fpu operations and a few compiler-required functions that are integrated with the vc crt by default).


April 15, 2002, 05:03 AM

Yeah, that's similar to what I've heard from others, yet living w/o the help of D3DX seems daunting! :p

I suppose one really should avoid including the standard windows includes as well, just using those one figure out to really be necessary, since those seems to seriously bloat the exec.

Btw, it seems like every STL container (i.e. vector, list etc) you include under the MSVC implementation adds approx 200 kb to the compiled exe.


April 15, 2002, 05:14 AM

Yes, UPX has an excellent packing ration, at avarage around a fifth of the original size. However, it is more interesting to know how small exec you can produce WITHOUT using exe-packers. What is the size of the minimal app above before packing it?


April 15, 2002, 05:23 AM

Matt Pietrek has written about keeping executable size small. See his articles in MSDN Magazine

The physics article by Thomas Jakobsen is easy to understand and contains enough code samples to do something like this, check it out here

Ron Bakker

April 15, 2002, 05:27 AM

Indeed .. I've noticed that these IOTD's are packed with UPX .. you can decompress them to find out for example that the torus is about 20 Kb.
Well .. I suspect that someone could create a nice COTD from all this :~)


April 15, 2002, 06:17 AM

Ack! A BSOD on the oldschool one (which was the only one I tried, because I wanted to listen to the music) - I haven't seen a BSOD in months! (p850, 384 RAM, WinXP, latest drivers)

Nice screenies, though...



April 15, 2002, 06:53 AM

we had a little discussion in The code was following:

#include <windows.h>

void WinMainCRTStartup()

With a little bit of parametertweaking the file was 640 bytes ( or something like this)

Linker-parameter were:
/nodefaultlib /entry:WinMainCRTStartup /subsystem:Windows /opt:ref /opt:nowin98 /merge:.rdata=.text /align:32

Uncompressed 640 bytes is in my mind realy okish.

With this prog I got a 608 bytes big file ( !not compressed! ).

#include <windows.h>
void StartUp()

Ron Bakker

April 15, 2002, 06:59 AM

There's allways a coder above a coder (with sizing-qualities :~)

I'm just here to watch and learn, and eventually share .. not to flame. What's the point in that.


April 15, 2002, 07:00 AM

People forget that you're able to download the SDK in components. If you're not developing for VB, don't download the SDK. :D


April 15, 2002, 07:01 AM

The SDK for VB that is.

Ron Bakker

April 15, 2002, 07:05 AM

Cool .. hadn't thought of that .. I have more experience in the algorythmic/functional area.

I knew there was a lot of space going elsewhere, looking at the object file, and the linked executable. Thanx for pointing it out.

Ron Frazier

April 15, 2002, 07:24 AM

Since were on the topic of small file sizes, has anyone seen ".the .product"? Its a very impressive demo weighing in at under 64KB. That includes code, models, textures, and sound. You can find it here:

Tim Aidley

April 15, 2002, 07:37 AM

Er.. dude, most of those demos are in the 5-6kb range... perhaps you're getting your size measurements confused?


April 15, 2002, 07:54 AM

Now I'm impressed, and I've yet again learned that one should *never* allow assumptions to fester into prejudices - I've always thought it was litteraly impossible to write space-wise small code for Windooze, but I stand corrected. Nice hacking, sir!


April 15, 2002, 08:10 AM

Dude... shut up.
Show us your "l337 sX1!zS", or to me... your just another newbie with an ASM handbook.


April 15, 2002, 09:08 AM

It's a bit OT. But can anyone explain why the
default alignment in VC6 is 8 byte? Shouldn't
4 byte be appropriate for current systems?


April 15, 2002, 09:32 AM

Win98 Optimization, yeah. Try it with /opt:nowin98 . And look at ;)


April 15, 2002, 10:27 AM

That's the demo I always think of when on the topic of small, recent windows executables. Did that use anything like upx?


April 15, 2002, 10:48 AM

Yes. It use a changed version of upx.


April 15, 2002, 10:49 AM

much respect on your tight code.

does anybody remember a 64kb demo that managed to pack an entire 3d engine, with procedural geometry, procedural scripted texture generation and a sound synthesizer into the above mentioned 64kb?
anybody remeber a name for it?

i remember all their geometry was tessalated from deformed primitives like cylinders, spheres etc. the texture maps were generated from scripts using base operations like draw rectange etc. they has some voodoo ultra-small synth to go along with it. very impressive.

how cool would it be to use such a compression and content system for online distribution of subscription based games?



April 15, 2002, 11:57 AM

You mean, the one Ron Frazier just mentioned? :)
Anyway, there are hundreds of great 64k demos - even heard of ?


April 15, 2002, 02:46 PM

no actually i've been researching computergraphics and the size-optimizing subject for over 5 years.

i wasn't talking assembly btw, READ before you WRITE.

Wim Libaers

April 15, 2002, 02:50 PM, PE file Format (last one in the list). 608 bytes, and it puts "hello, world" on the console. Doesn't work on Windows 95 or 98, must be NT-based. The tutorial explains how all pieces fit together. The whole thing was written with a hex editor. Not even intended as a small size demo, just as a tutorial on PE.


April 15, 2002, 03:44 PM

To write a small app ( also in win32) isn't the problem. the problem is how to make a small program with vc++.

When you use nasm for example you do not need to write the whole shit in hex. ok, when you write your own pe header you need to know the pe format.

for help with pe you can look at hugi 21.

Jim Dosé

April 16, 2002, 12:14 AM

It sounds like you're talking about "Heaven 7" by Exceed. Here's a link:


April 16, 2002, 02:04 AM

Sometimes MS screws up the registry for their media files and god knows what in a multi-part download. Usually I download the entire thing because of the above problems.


April 16, 2002, 11:37 AM


As soon as I get my broadband connection I'll download them ;)

This thread contains 62 messages.
First Previous ( To view more messages, select a page: 0 1 2 ... out of 2) Next Last
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.