Skip to content

Four Kilobytes

You'll make a 4k intro, a few minutes of music and GPU visuals in a single executable no bigger than 4096 bytes, with a softsynth and a packer.

About

The 4k intro is where sizecoding meets a real show: music, camera, several scenes, in a file smaller than most icons. The usual path is Windows, with Crinkler as the linker and compressor, a shader through Shader Minifier, and a softsynth like 4klang, Sointu or Oidos, all free. A Mac or Linux user can build in a Windows virtual machine or borrow a laptop, or take the JavaScript route with a packer like roadroller, which the browser compos accept. What counts is a file of 4096 bytes or fewer that runs for at least two minutes with music and at least three distinct scenes at 1080p on a mid-range card. The thing nobody tells you is that the music decides everything: the synth's instruments cost bytes, so you write the song early and let its budget shape the visuals, not the other way round.

At a glance

Per requirement
50 XP
Completion bonus
600 XP
Requirements
7
Takes
A season
Skill level
Advanced (years of practice)
Cost
Free
Supplies
You need some
Where
At home
Other people
On your own
Locked for now
Earn two more Rare badges in Demoscene to open this one. Log in to see how far along you are.

Requirements

  1. 1
    Build a minimal executable that opens a fullscreen window and runs a shader, and show its size. On Windows that is a tiny C or assembly entry point linked with Crinkler and no runtime; on the JavaScript route it is a packed HTML file with a WebGL context. Take a screenshot of the shader running and the file size, which should be well under 1000 bytes before any content. Photo
  2. 2
    Minify a raymarched scene and measure what it costs compressed. Start from the scene you wrote for Raymarched Scene, run it through Shader Minifier, and read the compressed size the packer reports. Then make it smaller: shorter identifiers, fewer uniforms, constants folded by hand. Take a screenshot of the size before and after. Photo
  3. 3
    Compose a two-minute track in a 4k softsynth and get it under budget. 4klang and Sointu plug into a DAW as an instrument; Oidos has its own workflow. Write the song, export the player data, and measure its bytes. Cut instruments until the song and its player fit in roughly 1200 bytes. Film the song playing with the size showing. Video
  4. 4
    Sync the visuals to the song's clock and to one instrument's envelope. Read the synth's current time for the camera and scene changes, and pull one instrument's envelope out of the synth so a kick or a lead visibly hits something on screen. Film a section where the hit is obvious. Video
  5. 5
    Fit three distinct scenes, the music and the transitions under 4096 bytes. Three scenes means three looks, not one scene with three colours. Take a screenshot of the directory listing and the packer's final report showing the byte count. Photo
  6. 6
    Test it on two other graphics cards. Shader compilers differ by vendor, and a 4k that runs on your card alone is a 4k that dies on the compo machine. Borrow machines, use a library PC or ask on a scene Discord for testers. Take a photo of it running on each, with the card named. Photo
  7. 7
    Release it at a party or on Pouet with the size in the nfo and a capture. Write a short nfo with the byte count, the tools and your greetings. Record a full capture and post it with the file. Video