/metro

The source of my 8k demo, released at the Black Valley 2022 demoparty

Primary LanguageC

This is the source of an 8k demo, released at the Black Valley 2022
demoparty. See https://blackvalley.party

8k is the category of demos (or intros) sized 8192 bytes or less.

also read metro.nfo

https://robin.basdon.net/blog-003-metro-an-8KB-executable-demo.html
https://demozoo.org/productions/310456/
https://youtu.be/AtcNkrkNmZQ (capture)
https://youtu.be/d0Voud49TSo (live recording at Black Valley 2022)

note: this was made with a deadline and little time to that deadline, no
effort was spent on cleanliness. expect chaos.

Tool credits
------------

| 4klang - http://4klang.untergrund.net
|
| "4klang is a modular software synthesizer package intended to easily
| produce music for 4k intros."


| Crinkler - https://github.com/runestubbe/Crinkler
|
| "Crinkler is a compressing linker for Windows, specifically targeted
| towards executables with a size of just a few kilobytes. Its main purpose
| is as a tool for producing small demoscene productions."

File breakdown
--------------
4klang/4klang.inc
	song data as generated by 4klang
Crinkler/
	contains crinkler
4klang.h
	song metadata as generated by 4klang
4klang.obj
	compiled 4klang song data stuff
b.c
	source of the program, hacked together from 4klang example usage code,
	source from auld's "chocolux" demo, iq's 4k framework, and sleep
	deprivation
frag.glsl
	source of the shader
frag.glsl.c
	frag.glsl but exported to be a c string, removing debug things,
	generated by https://github.com/yugecin/ShaderThing2
frag.glsl.pos
	camera position data savefile,
	used/generated by https://github.com/yugecin/ShaderThing2
	(at b2351546a4f2ce6d5b13462100767bea3250e835)
frag.glsl.pos.c
	exported camera position data,
	generated by https://github.com/yugecin/ShaderThing2
	(at b2351546a4f2ce6d5b13462100767bea3250e835)
makedebug
	shell "script" to make a quick (aka debug) build
makerelease
	shell "script" to make a release build
	(it tells Crinkler to try harder to squeeze more bytes)
metro.nfo
	nfo file, basically a readme file that goes with the release
muzik-projekt.MuProject
	MuLab music studio project
patch.4kp
	instrument data for 4klang


How 2 build the demo
--------------------

Asumming a non-cmd terminal (git-bash or similar),
run ". makedebug" or ". makerelease", though you may need to edit those files
to change the LIBPATH.

requires gcc

How 4klang.inc/4klang.h is generated
------------------------------------

Read the readme of 4klang.

I used MuLab, it has a free trial that can be used to do this: use it to open
the muzik-project.MuProject, ensure 4klang VSTi is loaded and used for the
tracks, click the button in 4klang to load patch data, select the patch.4kp
file, press record, play the sond in MuLab, press stop in 4klang when the song
is finished. Choose a path and you'll get the 4klang.inc/4klang.h files.

How 4klang.obj is built
-----------------------

The 4klang distributions should contain a source folder that has 4klang.asm
and nasmw.exe and make.bat. Get those three files and the 4klang.inc from this
repo and call make.bat. That batch file also calls crinkler for the 4klang
example, it may error depending on how you're running this, just ignore that.

How frag.glsl.c is built
------------------------

Run https://github.com/yugecin/ShaderThing2 and open frag.glsl and press the
"export" button (in the main window - the one with the shader).

If it doesn't work, checkout commit b2351546a4f2ce6d5b13462100767bea3250e835
of ShaderThing2

How frag.glsl.pos.c is built
----------------------------

Run https://github.com/yugecin/ShaderThing2 and open frag.glsl and press the
"save" button (in the window without a title with all the beziers).

If it doesn't work, checkout commit b2351546a4f2ce6d5b13462100767bea3250e835
of ShaderThing2

GraffitiGen.java
----------------

Small tool that was used to make the graffiti beziers (they're in frag.glsl).
Press n to get a new bezier, press e to export.
Export means it will be printed to console as comma separated values, where
the values are:
- length of the line in some random unit
- xy position of start point
- xy position of first control point
- xy position of second control point
- xy position of end control point

xy positions are encoded as %d%02d, their values are 0-99.
Example: 203 means x=2 y=3, 9323 means x=93 y=23