Reading the code of State of the Art: a demo, thirty years later

· Medium ·

9 min read Original article ↗

Cyril Pereira

How a few evenings of porting old demos turned into taking apart one of the most famous Amiga demos ever made, and why I think the demoscene has something to give to the AI era.

Press enter or click to view image in full size

Stills from two videos. Left, the original Amiga demo. Right, the HD version, with the optional CRT look.

It started as a joke between friends

A few friends and I started talking about how funny it would be to port games from one platform to another. I had seen YouTube videos of someone who ported Amstrad CPC games to the Commodore 64, simply because he had always wanted to play them on that machine and never could back then. One friend began porting Neo Geo and arcade games to mobile phones.

Then a thread went by on Pouët about porting Amiga demos to the browser. Most people were against it: a port disrespects the original hardware, loses what made the demo art, and is done without asking its authors. A few voices answered that a port is no different from an emulator or a video capture. But the general feeling was clear: you don’t touch a demo.

Another friend of mine was working on preserving old demos written in Java. He wanted to port them to C, so that we would keep a trace of them and still be able to run them in the future.

That made me think. So I tried it on my own work first: Amiga Intro 1, an intro I had made in AMOS on the Amiga in March 1994 with my group, Human Killing Machine: code, graphics and music. I ported it to the Game Boy Advance and to the Neo Geo. It wasn’t much effort. In one evening the intro was running on both. I pushed the idea further with an Amstrad CPC version, and that worked too.

You can try them yourself: the original Amiga version (video) and its Game Boy Advance, Neo Geo and Amstrad CPC ports.

And then I asked myself whether any of this was actually interesting. In the end, you get the same thing on another machine. It’s fun, but it doesn’t bring anything new.

The demos whose technique intrigued me

I’ve been making demos since around 1994, and two demos have always fascinated me: Arte by Sanity and State of the Art by Spaceballs. They are my favourite demos. I had a rough idea of how they worked, but their concept always intrigued me.

Today we can decompile programs. So I wondered: could we extract the assets, and understand the techniques these demos really used?

I started with Arte (third at The Party 1993). I found incredible things in it: an operating system of its own, SOS, the Sanity Operating System written by Chaos, which takes over the whole machine once the disk boots; the code by Mr. Pet, whose credits say the demo “was coded by Mr. Pet using the Sanity Operating System”; the beautiful pictures by Ra; the music by Moby; and the way the whole demo chains its parts together.

I would like to take a moment to offer my condolences to the family and friends of Mr. Pet, who passed away this week.

Then I took the same approach, the one I had used on my intro and on Arte, to State of the Art.

State of the Art

For a very long time, State of the Art was one of the most incredible demos anyone had ever seen. It won the Amiga demo competition at The Party 1992. It was coded by Lone Starr, who was still a teenager at the time. Its unique style, the music by Travolta and Vinnie and the design by TMB made such an impression that it was even shown on MTV.

The demo shows dancers, silhouettes and abstract shapes moving to the music, with a look nobody had seen before. There are no 3D objects and no scrollers, only flat shapes and colours timed to the music.

Taking it apart

I didn’t want to recreate the effects by eye, watching a video and imitating it. I wanted to know what the demo actually did.

First, the disk itself. Its data was unpacked and decoded, and the best surprise came early: the famous dancers are real polygons, stored as lists of points, 32 animations in all. Some of their in-between frames aren’t even stored: the demo computes them itself. In 1992, State of the Art was already tweening its dancers. Each animation could then be exported as an animated SVG that plays in a web browser.

A first test in a web browser: the dancers’ polygons, read straight from the disk. Left, the shapes exactly as stored, at 25 frames per second. Right, the same points with smoothed outlines and new in-between frames, at 60 frames per second.

But the disk doesn’t tell you everything. The colours, the timing, the way the layers are mixed are only decided while the demo runs. So the original code was run in an emulator, and every frame it displayed was recorded: about four minutes, 12,700 frames, straight from the code.

The tricks turned out to be simple, and I mean that as a compliment. The Amiga mixes several layers of pixels and picks each pixel’s colour from how they overlap, and State of the Art plays with that all the time. The glowing trails are the same dancer drawn several times with a delay; the colours of the overlaps do the rest. The checkerboards aren’t drawn at all: the machine changes colours while it draws each line. The rings are one big picture of circles, scrolled under the dancers. Very little of it is graphics in today’s sense: most of the work lies in rules for how layers and colours combine, timed to the music.

Press enter or click to view image in full size

One frame of the original, taken apart. The same dancer is drawn in five layers, each one a step behind the previous one. The more layers overlap, the lighter the blue: that is the glowing trail. Rendered from the original code in the emulator.

A new player

The plan was to keep the original vectors, exactly as the demo draws them, and put modern techniques on top. Nothing is redrawn by hand; the dancers on screen are Lone Starr’s polygons.

All of this stands on mndrn, the JavaScript demo engine I started in 2015 with mndrn, Mandarine’s demo released at TokyoDemoFest 2015 (4th in the combined demo compo; code and music by me, graphics by fra). I have kept improving it with every production since, like Shadow-Party 2021, Mandarine’s invitation demo, second in the PC demo compo at Assembly Winter 2021 (I wrote a making-of). From the recordings, the player rebuilds every frame the way the Amiga composes it, but at the resolution of today’s screens. Two things raise the quality without changing what the demo shows.

The first is interpolation. The dancers move 25 times per second in the original, and the player fills the gaps using only the original frames, so the motion stays smooth on today’s screens. Scrolling and colour fades get the same treatment, but sudden changes like strobes stay sudden.

The second is shaders. The graphics card redraws each layer at full resolution and mixes them the way the Amiga did, so edges stay clean in 4K and the circles stay round at any size. An optional CRT shader adds the scanlines and the glow of a 1992 monitor.

Everything can be switched off on the start screen: with all options off, you see the original frames. It runs in 4K at more than 60 frames per second, in a web browser.

The music isn’t a recording either: it is replayed from the original modules, by funkymed-flod-module-player, Christian Corti’s flod module player, which I ported to ES6 five years ago so that it could be used as an npm package.

Press enter or click to view image in full size

The remake’s timeline, inspired by the one in mndrn: scenes, backgrounds, vector animations, text and music, each placed at the moment the original code shows it. The labels are in French.

Respecting the original

For everything else, I set myself one rule: stay as close to the disk as possible.

I used the original assets: the bitmaps, the palettes, the modules, as they are on the disk. I kept the original picture size and framing. The title picture, the credits and the end screen are shown with their original pixels. And I added an optional CRT rendering, scanlines and all, because that’s how people saw this demo in 1992.

Whenever I didn’t know what the original did, the answer came from its code, never from a guess.

The whole thing runs in a web browser: three files, about 0.7 MB in total. There is also a small Windows executable and a Mac app, each around 1 MB.

Asking the author

Before publishing anything, I got in touch with Paul Endresen, Lone Starr. He kindly gave me permission to publish this work, and asked what it runs on and how I did it. This article is my answer.

He also suggested I replace the crackers’ message on the last screen with my own. So the end screen now says “HD REMAKE BY MED”, in the same pixel fonts the original screen used. The video keeps the screen exactly as it was on the disk.

About tools, and about AI

Our time is very different from 1992. I think the demoscene, which carries some of the noblest values I know (sharing, craft, pushing a machine further than anyone thought possible), has to decide what it thinks about AI.

So let me be clear about who did what. Claude, Anthropic’s AI, wrote the emulator and the extraction tools. It also wrote the new player, but on top of mndrn, my own engine.

It is a different way of working, and I’m comfortable with it. It made it possible to take apart a demo I had wondered about for thirty years in days rather than months, and to understand it from its own code instead of guessing.

None of this takes anything away from the original team. Lone Starr’s ideas, the music by Travolta and Vinnie and TMB’s design are why this demo is extraordinary, and the AI created none of it. It helped me read it.

I’m convinced the demoscene has something to bring here, instead of keeping the technology outside. Reading old code and preserving demos is work these tools do well, as long as the people using them care about the original.

Thank you to Spaceballs, and to Lone Starr in particular, for this demo and for the permission.

med

State of the Art, Spaceballs, 1992. This HD version is a non-commercial tribute.