My primary goal for this program was to learn how to make a modern (i.e. Windows) demo that fits into 4096 bytes. In addition to this I wanted it to make 3D graphics and music, have scrolling text (for nostalgia), and have the graphics synchronized precisely with the music. I also wanted to make a guide for others on how to make a 4k intro, since I had to cobble together the knowledge I needed from scraps here and there, which is why I have made the source code available.

bunchbox.zip 9/18/2009, ZIP File 25kB
Pouet.net 9/19/2009, Link
Video 7/30/2011, YouTube

This zip file contains the demo (bunchbox.exe) as well as its full source code for those who are interested. The program runs in a 1280x720 window and can be closed by pressing the escape key.



To compile this program you will need:

  1. Visual C++ 2008
  2. The Crinkler

4k Guide

Creating a 4k intro is not a task for someone who isn't interested in experimenting with their compiler and learning some nitty gritty details, so I'm not going to explain everything here; I'm just trying to give enough to get you started. Take a look at the source code, and look up the compiler settings you don't understand. Try changing them and see what happens to your code size.

  1. Some of my compiler settings:
  2. For suitable linker settings, read the Crinkler manual, or check my settings for the Release or Best build. A lot of the Microsoft settings are ignored by Crinkler.
  3. Don't link with the C runtime library.
  4. Define your own entry point.
  5. Define atexit.
  6. Without the C runtime library you will need this magic line somewhere in a cpp file in order to use floating points:
  7. Define your own memset and memcpy
  8. Use Crinkler's build information output to analyze your source and how big each part of it is. It is an amazing tool.
  9. Create a debug build with diagnostics you can define out.

Anyhow, if you have questions or have found this useful, please e-mail me. Have fun!


Return to my main page.
brad @ rainwarrior.cabr /> 7/30/2011