How Void Daggers replays your whole run

Under the hood · a flipbook, not a film

Beat your record in Void Daggers and the game keeps the run. You can watch it back later, from your own eyes, at three times speed if you are impatient. The file it keeps is not a video, and it is not a recording of which keys you pressed. It is something in between, and the reason it ended up that way is the interesting part.

Three ways to save a run

There are broadly three options, and every game that does replays picks one.

You can record video. Straightforward, and enormous. Every frame is a full screen of pixels, and a five minute run is hundreds of megabytes before compression. You also lose the ability to move the camera or change speed, because a video is just pictures.

You can record the inputs. This is the elegant one. Store which keys were held on which frame, then feed those same inputs back into the same game and let it play itself. The file is tiny, a few kilobytes for an entire run. This is how speedrun verification works in a lot of games.

Or you can record positions: where everything was, several times a second, and rebuild the scene from that. Bigger than inputs, far smaller than video.

Why the elegant option did not work

Input recording only works if the game is deterministic. Deterministic means that identical inputs always produce identical results. Press the same keys on the same frames, and the tenth enemy spawns in exactly the same spot, with exactly the same wobble on its approach, both times.

Void Daggers is not deterministic, and it is not close. There are hundreds of separate places in the code where the game asks for a random number: where an enemy appears, which direction a swarm splits, how much spread a shot has, how the debris flies. Each one of those returns a genuinely different value on every run. Feed the same inputs back through and you are watching a completely different fight within seconds.

Making it deterministic afterwards would mean replacing every one of those random calls with a seeded generator, the same way Moon Miner derives its Moon from a single number. That is doable. It is also invasive, and it stays fragile forever, because from then on any change anywhere in the game can silently break every replay ever recorded. A single frame of drift compounds into nonsense.

So Void Daggers records positions instead.

What a snapshot actually holds

Twenty times a second the game writes down one line about you: the time on the run clock, your position as three numbers, which way you were looking as two more, your current weapon tier, and a small flags value carrying two bits, one for whether the trigger was down and one for whether your feet were off the ground. Eight fields, fifty milliseconds apart.

Ten times a second it writes down the rest of the arena: every living enemy with an identity number, a type, a position and a facing; every boss with its health, its weak points and where its head is pointing; every spawner structure and its phase; every floating token. The arena's shrinking radius goes in too.

Separately from both of those, the game keeps an event log. Events are things that happen at an exact instant rather than continuously, and they are stored with their exact time rather than being sampled: an enemy died here, you picked up an upgrade, a boss spawned, you dashed, you jumped. Eighteen kinds of event in total.

Filling in the gaps

Ten snapshots a second would look terrible played straight, like a slideshow. So playback interpolates, which simply means it makes up the frames in between by sliding smoothly from one recorded position toward the next.

The rule that keeps this honest is a simple one: the snapshots are the truth and the interpolation is decoration. If the smooth slide drifts slightly away from reality, the next snapshot arrives a tenth of a second later and puts everything back exactly where it belongs. Errors never accumulate, because they are overwritten before they can grow. Compare that with input replay, where a tiny error at second two is still there at second two hundred, and considerably larger.

Angles get special handling, because turning from 359 degrees to 1 degree should be a two degree flick and not a 358 degree spin. Everything else is a straight blend.

Where it ends up

All of that is written out as plain structured text, then compressed with gzip, which is the same compression the web uses for everything else and is very good at repetitive numbers. The result goes into a small database that browsers provide for exactly this kind of thing, so it survives closing the tab.

Recording runs during every attempt, but only a personal best gets kept. On Steam the same compressed blob is attached to your leaderboard entry, which is why you can watch other people's runs instead of only your own.

▶ Play Void Daggers