Light against the dark: how Deepwick's light works

Under the hood · one number is health, fuel and eyesight

Deepwick drops a living flame down a shaft in the dark. Everything you can see, you can see because of it. Everything you cannot see is out there anyway.

The unusual thing about the game is that this is not a metaphor stretched over three separate systems. There is one number, called flame, running from 0 to 100. It is your health, in that the run ends when it reaches zero. It is your fuel, in that it drains constantly. And it is your eyesight, because the radius of the light is worked out directly from it.

Burn bright, die sooner

At full flame your light reaches 300 pixels out from you. At almost nothing it reaches 78. The value slides smoothly between those, so the world visibly closes in on you as you weaken. You do not need a health bar to know you are in trouble. The walls tell you.

The clever cruelty is in the burn rate, which is not constant. The flame loses about 1.35 percent per second no matter what, plus up to another 2.3 percent scaled by how big it currently is. A flame at full strength burns down at 3.65 percent a second. A dying one burns at 1.35.

So being bright costs more than being dim, and the cost arrives exactly when you are enjoying the light. A big flame also melts a wider path through the wax, which means burning hard is simultaneously your vision, your dig speed and your countdown. Every choice in the game is really a choice about that one number.

How the darkness is actually drawn

And this is the part that surprises people. There is no lighting engine here. Deepwick is drawn on a plain 2D canvas, and the light is a trick with layers that would work equally well with paper and a rubber.

Each frame the game paints the rock near you, skipping anything further out than the flame could possibly reach. Then it takes a second, hidden canvas the size of the screen, fills it completely black, and erases a soft circle out of that black sheet at the flame's position. Then it stamps the sheet over the finished picture.

The erasing is done with something browsers call a composite operation, which is a rule for how new paint interacts with paint already there. The normal rule is "cover it up". The one used here is "destination-out", which means "wherever I paint, remove what was underneath". Painting a soft circular gradient with that rule set does not add a light. It subtracts a hole.

The hole has a hard centre and a soft edge. The inner forty five percent of the radius is fully clear, and from there out to a little past the edge it fades back to solid black, which is what gives the pool of light its rolled-off rim instead of a cut-out circle.

What the light does not do

To be straight about it: walls do not block the light. The hole is one circle, painted without asking what is in the way, so a rock between you and a cave does not put that cave in shadow. Proper shadow casting means working out a visibility shape every frame, and at this scale the cost buys you almost nothing.

What the game does instead is cheaper and reads almost the same. Every rock face that touches open air gets a bright edge drawn along it, and the brightness of that edge depends on whether the face is turned toward the flame and how far away it is. Faces pointing at you glow. Faces pointing away stay dull. Your eye reads that as light falling on rock, and the effect holds up because you never see far enough to catch it out.

The candles in the wall alcoves are the one other thing that punches through the darkness, and they get a slightly weaker hole, so they always stay a little veiled. Embers, wax and the flame body itself glow additively, but they are painted before the black sheet goes down, which means they can only shine where the flame already reaches. A pickup in the dark stays dark until you get close.

Keeping it lit

The flame is spent by five things and refilled by two, and the exchange rates are the whole economy of the game:

Put two of those side by side and the design snaps into focus. A single drip costs the same as melting fifty eight cells of wax. Getting rained on is the single most expensive thing that can happen to you that is not a wall, and the deeper bands are built to be wetter.

Where the darkness lives

The shaft is generated as you fall, and its character is set by five bands, one every 140 metres, with names like the waxfields, the dripstone and galewound. The values are not switched at the boundaries. They are blended between the centre of each band, so the world hardens and narrows gradually and there is never a visible seam where one biome becomes another.

One of those values is simply called narrow, and it climbs from 0 at the top to 0.60 at the bottom. It is subtracted from the half-width of the guaranteed safe channel, so the path down genuinely tightens the further you go, though a floor in the same calculation keeps it from ever closing below two and a half cells across. Drips peak in the dripstone band, gusts peak in galewound, and the rock keeps getting harder for hundreds of metres after the last named band runs out.

All of which loops back to the light. Because you only ever see a flame-sized pool of the world, the game can generate that world out of a few simple rules and repeat itself freely, and you will never notice, because you never see enough at once to spot the pattern. The darkness is not an effect layered on top of Deepwick. It is the reason the whole game fits in about twenty kilobytes with no art files in it at all.

When a run ends you keep one ember for every 15 metres you made it down. Those go to the chandlery, which sells a bigger starting flame, a slower burn, better resistance to drips, and a faster melt. Four tracks, five tiers each, all of them arguments with the same number.

▶ Play Deepwick