Skip to content

ljaaskela/4KB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

4KB

A 4k intro for Windows, 3073 bytes binary.

screenshot

A Menger sponge tumbles in space with light leaking from its core; the camera dives into it on the bar-6 downbeat, flies the gyroid-carved tunnel of its innards, and toward bar 12 the tunnel walls dissolve away, revealing an endless lattice of tumbling cubes — which itself dissolves during the kick-drop break until only the home cube is left, the camera settling back onto the opening orbit for a seamless loop. 140 BPM techno (four-on-the-floor kick, offbeat hats, acid bassline through a resonant filter, and a SID-style pulse lead with dotted-8th trance delay that enters on the dive), sine-wobbler rainbow greetings, and kick-synced screen flashes. Loops every 16 bars (~27 s). ESC quits.

Watch it

https://www.youtube.com/watch?v=XKFyLgI__xg

How it fits in 4k

  • Single fullscreen fragment shader (raymarched, both scenes in one map()), minified at build time by Shader Minifier and compiled via glCreateShaderProgramv
  • Music is synthesized into a buffer at startup and looped via waveOut: integer phase accumulators for oscillators, parabolic sine for the kick, LCG noise for hats, Chamberlin SVF for the acid squelch — no sin, no pow
  • The intro clock is waveOutGetPosition, so visuals, greets, and flashes are sample-locked to the music
  • Greetings text comes from a GDI font baked into GL display lists with wglUseFontBitmaps — the strings are the only bytes paid for
  • Compiled x86 with MSVC, linked and compressed with Crinkler

Building

Requirements: Visual Studio 2022 (x86 toolchain), plus two tools in tools/ (not committed):

From an x86 Native Tools Command Prompt (or after call "...\VC\Auxiliary\Build\vcvarsall.bat" x86 — Crinkler outputs 32-bit PEs, so the 64-bit toolchain won't do):

tools\shader_minifier.exe -o shader.h --format c-variables shader.frag

cl /c /O1 /Os /Oi /GS- /Gy /fp:fast /QIfist /arch:IA32 main.c

tools\crinkler\crinkler23\Win64\Crinkler.exe /ENTRY:entrypoint /SUBSYSTEM:WINDOWS ^
    /COMPMODE:SLOW /ORDERTRIES:4000 /UNSAFEIMPORT /REPORT:report.html ^
    /OUT:intro.exe main.obj kernel32.lib user32.lib gdi32.lib opengl32.lib winmm.lib

This minifies shader.frag into shader.h, compiles main.c without the CRT, and Crinkler-links the compressed intro.exe, printing the byte count. (/QIfist matters: without it, float-to-int casts call a CRT helper that isn't there.)

About

A simple 4KB intro

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors