Day 11

Let there be light


Something about Buildom always looked a bit flat to me. The world had depth underground, trees, zombies, a working camera, but everything was lit the same. A cave three layers down looked exactly as bright as a sunny meadow on the surface. That bugged me, so this round was all about light and atmosphere.

Fog, not just a gray overlay

The first piece is a fog system. Instead of tinting the whole screen with a uniform haze, the fog sits between the world layers and reacts to where the camera is and what the world is doing. Underground it thickens with depth, near the surface it fades out, and it moves slowly instead of sitting still like a painted rectangle.

The trick was to keep it cheap. The fog runs on its own layer and only redraws when something actually changes, so the frame budget for the game loop barely notices it is there.

Fog drifting over the world, torches cutting warm holes into the darkness

Torches

Fog alone made the world moodier, but dark caves need a light source you can carry. Enter torches. A placed torch emits a warm, flickering light that pushes back the fog around it, and the flicker is not random noise: it breathes on a small sine wave with a tiny offset per torch, so a row of them never pulses in sync.

What surprised me most was how much torches change the way I build. Suddenly placing a light source is a decision. Do I line the tunnel entrance, or do I keep the middle dark so the zombie hands have somewhere to hide? That is exactly the kind of emergent gameplay I hoped a light system would create.

One light model for everything

Instead of bolting torch light on as a special case, every light in the game now goes through the same model: a position, a radius, a color, and a falloff. Daylight is just a very big, very neutral light. Torches are small, warm, and flickering. That means whatever comes next, lanterns, glowing mushrooms, lava, plugs into the same system without new rendering code.

The composition happens per tile: light values are accumulated and then applied as a multiplier on the tile color, which keeps the pixel art crisp instead of smearing gradients over it.

What is next

The obvious follow-ups are light-emitting blocks, maybe a daylight cycle that already exists in the main menu making its way into the world itself. For now I keep walking through my test cave with a torch, just because it looks good. If you want to see the world get moodier one step at a time, follow along.