Vivian Voss

Laevitas by Bitbendaz

demoscene creative coding computer art music

There is a small and slightly unfair truth about demos, which is that the picture almost always goes first. Somebody builds the effects, somebody else is handed a rough cut and asked to put something underneath it, and the result is scored the way a film is scored: music arriving late, fitting itself around what already exists.

Laevitas went the other way round, and it shows. It won the Meteoriks 2021 award for Best Soundtrack, and the interesting part is not that it won. The interesting part is what the coder had to build in order to keep up.

The Work, and Who Made It

Laevitas is a Windows demo by Bitbendaz, a Swedish group, released on 15 August 2020. Five people are on it.

Mikael Stalvik wrote the code. java did the graphics. The music comes from Comatron and Mygg, and over the top of it Daytripper raps, in a genuine full-throated vocal performance rather than the odd sampled shout that demos usually make do with.

Demozoo tags it, with admirable economy: breakbeat, graffiti, punk, rap. Pouët's commenters reached for The Prodigy within about four posts, which tells you the register. One of them wrote the line that sums the whole thing up rather better than a review would: "Stylewise not my cup of tea at all, but wow what a ride."

It sits at 103 thumbs up against 11 down, which for a scene that treats voting as a competitive sport is a solid result.

The Constraint Nobody Imposed

Here is where this piece departs from the usual shape of these Friday notes.

Ordinarily the constraint is the point, and it is measured in bytes. A 64K intro must fit in 65,536 of them, a 4K intro in 4,096, and everything that appears on screen must be conjured from that. The limit is the frame the art hangs in.

Laevitas is a demo. There is no limit. The rules of the demo competition permit whatever fits on a hard disk, and nobody would have raised an eyebrow at a hundred megabytes of streamed audio.

So the constraint had to be chosen, and the one Bitbendaz chose was synchronisation.

Who waits for whom THE USUAL ORDER picture rough cut music fits in sound follows LAEVITAS music, still being written ~592,000 sync values move picture follows A bar goes in halfway through, and every camera move after it is in the wrong place.

Every demo faces this in some form. The picture has to know where the music is: when the beat drops, when the section changes, when a camera should cut. The tool most of the scene uses for it is GNU Rocket, a sync tracker that lets you scrub through a timeline and set values against it, which the running demo then reads. It is a spreadsheet for time.

Stalvik wrote up the numbers for Laevitas on the group's blog while it was still in production, and they are worth quoting properly. The Rocket file holds nearly 4,000 rows and over 148 variables, which he works out to around 592,000 values to control.

Not to write, mind you. To control. Every one of them is a decision about where something should be at a given instant.

Where the Trouble Started

Now the part that makes this a soundtrack story rather than a graphics story.

The music was written in parallel with the code. Not before it, not after it, alongside it. And music that is still being written does what music does: sections grow, sections shrink, a bar goes in, eight bars come out.

Stalvik's description of the consequence is beautifully flat: "because the music was developed in parallell to all code, certain parts either growed or shrinked in length. For each change we had to move data for the next scenes either up or down."

Read that again with 592,000 values in mind. Somebody adds four bars in the middle. Everything after it, every camera move and colour ramp and trigger for the rest of the demo, is now in the wrong place and has to shift.

And it got worse in the ordinary way that these things get worse: "it took quite some time to test a specific effect since we needed to locate its exact row and scroll down to it and after that the testing and tweaking could start."

That is the actual work. Not a shader in sight. Scrolling.

The fix was not to argue with the musicians, which I find quietly admirable, and it was not to modify Emoon's Rocket editor either. They built a separate tool, Rocket Hacker, which lets them keep one small Rocket file per scene, test each scene on its own, and merge the lot into the single enormous file at the end. The music stayed free to move. The code learned to follow.

The Bit Where Everything Goes Wrong Anyway

Stalvik also published a post called Traps & Treasures in Demo Making, which is the more entertaining of the two and has the ring of a man writing it down so he never has to find it out twice.

Three traps, and what each one cost WHAT HAPPENED THE BILL Maximum optimisation broke lighting in some scenes silently, with no error of any kind 1.5 days Framebuffers were never released garbage on screen, again with no error no message at all A build was renamed the driver assigns GPUs per executable filename 125 fps → 21 fps

Maximum compiler optimisation broke the lighting. Not everywhere, just in certain scenes, silently, with no error of any kind. That cost a day and a half to track down, and the remedy was to stop asking for /O2 and ask for /Ot instead, which is the same request phrased less greedily.

Unreleased framebuffers produced, in his words, garbage on screen with no error message at all. A framebuffer that is never handed back simply accumulates, quietly, until the picture stops making sense. OpenGL he describes as extremely hard to debug, and recommends RenderDoc for looking inside a frame, which is roughly the graphics equivalent of taking the back off the telly.

And then the one that deserves a small monument. The NVIDIA control panel assigns which GPU an application uses per executable filename. Rename your build, and the assignment no longer applies to it. The measured effect was 21 frames per second instead of 125, a sixfold collapse in performance caused entirely by calling a file something else.

Somewhere in that debugging session is a man staring at a profiler, wondering what he has broken, having broken nothing whatsoever. A proper kerfuffle, and one that will be familiar to anyone who has ever been defeated by a configuration dialogue.

The Party

Laevitas premiered at Novoque 2020, on 15 and 16 August, and Novoque is itself a small artefact of that year.

It existed because Evoke did not. The German party, normally held in Cologne, could not take place in the summer of 2020 for reasons everybody remembers, so an online event was assembled in its stead, with nine competitions covering demos, 4K and 64K intros, alternative platforms, animation, graphics, interactive, a dance music mix, and ANSI or ASCII art for both Amiga and PC. The name is a joke about the circumstances and I shall let you work it out yourself.

Six demos entered. Laevitas took first with 732 points, ahead of Stay Strong by Adapt on 512 and Komfur by Kunstnerkollektivet 1DEK on 487. That is not a narrow win. That is the audience of a scrappy improvised online party, watching six productions, and a fair number of them putting the top mark next to the one with the rapping.

Nine months later the Meteoriks jury reached the same conclusion about the music specifically, and nominated it for Best High-End Demo and Best Visuals besides. It won only the soundtrack, which given the circumstances of its production seems about right.

The Point

The pleasing thing about Laevitas is not the trophy. It is the direction of travel.

In most productions the music is the last thing added and the first thing compromised, because the picture is already built and the audio has to fit around it. Here the picture was the thing that had to move, over and over, thousands of rows at a time, because the music kept changing shape while it was being made. The person holding the timeline decided that the correct response to that was a new tool rather than a firm word with the composer.

The scene has no size limit for demos, and it turns out that removing the limit does not remove the discipline. It only relocates it.

Bitbendaz spent their freedom on 592,000 hand-controlled values and a rapper, and then a jury of their peers listened to the result and said, of everything in it, that the best thing was the sound.

Somewhere in that is a small argument about who ought to lead, and it is not the one the industry usually makes.