Awesome
The Sheep and the Flower
Ctrl-Alt-Test & Razor 1911 present 'The Sheep and the Flower', a demo in 8kB.
The moral of the story is left as an exercise to the viewer. We're not La Fontaine.
No animals were harmed during the making of this demo. The sheep is a stunt actor. Do not try this at home.
Created by:
- Anatole Duprat (Anat)
- Laurent Le Brun (LLB)
- Pierre Martin (Cyborg Jeff)
Special thanks to:
- Steren Giannini & Xavier Dorémus for the inspiration (CAPODA)
- Zavie & rubix
- gopher & xTr1m for the 4klang support
Tools used:
- Leviathan 2.0 https://github.com/armak/Leviathan-2.0/
- Crinkler https://github.com/runestubbe/Crinkler
- 4klang https://github.com/hzdgopher/64klang
- OpenMPT https://openmpt.org/
- Shader Minifier https://github.com/laurentlb/Shader_Minifier
- KodeLife https://hexler.net/kodelife
In tribute to Maf464.
Codebase
The project uses Visual Studio 2022.
Shaders
All the graphics are generated using shaders. The interesting code is in
mouton.frag
and mouton.vert
under Intro/src/shader
. fxaa.frag
is used
for anti-aliasing the image.
During the build, the three shaders are minified; the output is shaders.inl
.
The content of that file is included in the final binary.
C++
The C++ code under Intro
is adapted from the Leviathan 2.0 project.
There are multiple configurations:
Debug
Release
: used for building the final binary. The compression step takes around 4 minutes.Snapshot
: similar to release, except that it uses fast compression.Editor
: enables a player for live coding.
The C++ code actually used in the demo is main.cc
, minus all the things
disabled by the macros. It doesn't do much: it starts the music in a separate
thread (it calls the function from 4klang.obj
), it compiles the shaders and it
executes the shader on a fullscreen quad. The shaders have one input parameter:
the time in seconds (as a float).
Editor
To run the editor mode, you first need a wav file of the music (see section below). Then run the program.
Whenever mouton.vert
or mouton.frag
is modified, the shader code is
recompiled and the image will be updated. Use alt
+ arrows for the play /
pause / forward / backward commands.
4klang convert
The directory 4klang convert/WavExport
contains a project that can execute the
music and save it as a wav file. This is needed for running the demo in Editor
mode.
The music data is stored in the file 4klang.inc
, which is generated by the
4klang VST plugin.
The script compile_and_copy.bat
compiles the music and generates the file
4klang.obj
. It takes as input the music data, as well as the 4klang synth
(4klang.asm
and 4klang.h
).
mouton.klproj
mouton.klproj
is a KodeLife project. We used it at some point during the
development, for live coding. As KodeLife doesn't support music, we stopped
using it when the sountrack was ready (in favor of the editor inside the demo).