DevLog #7 – Our campfire was a different fire at midnight. Now it casts shadows
United States
Breaking News:
Washington DC
Tuesday, Nov 10, 2026
Fire got rebuilt twice in the last two months. The first time on its own terms: how a flame is drawn, and what rain does to it. The second time because of DevLog #6. We replaced the sun with a physical model, the nights became properly dark, and the campfire in our first mission turned into a different fire after sunset. Along the way, fire also learned to cast shadows, which it had never done.
The flame was orange and flat, with 1–2 pixel teeth chewing the whole silhouette. The teeth came from a phase offset that we read from a noise texture, per texel, so that the tongues of flame wouldn’t all rise in lockstep. The intention was right. But the offset varied along X, so neighbouring pixel columns ended up several full texture wraps apart. That’s textbook aliasing, and on screen it reads as a serrated edge.
The fix is to offset per particle instead of per texel. The detail worth keeping is that the shader can’t invent that number: there is no per-particle identity in the fragment stage, so the renderer has to send it, through a vertex stream. Two smaller fixes went into the same shader. The flame is now born inside its quad rather than on its bottom edge, which used to show as a ruler-straight line. And the edge softness is measured in screen pixels instead of texture units, so a fire 20 m away doesn’t go hard-edged.
None of that showed at first, because bloom was at zero and there was no tonemapper. The flame shader runs a blackbody model where the base is about ten times brighter than the tip, and all of it was being clipped to flat orange before it reached the screen. Turning the tonemapper on was not a fire change. It changed the colour of every surface in the game, so we treated it as a global change, not as a particle tweak.
The last piece is for daytime. At noon a fire can’t compete with the sun, and it becomes a decal on the grass. What still reads is the air above it moving, so there’s now a heat-shimmer pass that distorts the background. Its strength goes with intensity squared, so a dying fire stops boiling the air. Rain kills it, and so does night, for reasons that come up below.
The simulation is a handful of rules. Rain takes intensity away at a rate quadratic in how hard it’s falling: a drizzle barely bothers a well-built fire, a downpour kills it fast. A roof scales that down. When it isn’t raining, the fire comes back, deliberately slower than it went out, because lighting a fire is work and putting one out is easy. Every rule was reasonable. Two outcomes were not.
The bucket of water lasted thirty seconds. Putting a fire out set its intensity to zero, and the next frame the rekindle rule started bringing it back. On dry ground it was burning at full again half a minute later. Two pieces of code, each doing exactly what it said, and the one that ran sixty times a second won. A fire put out by hand is now latched: it stays out until something explicitly relights it.
The value that neither rose nor fell. Recovery is gated by ground wetness, so soaked wood doesn’t relight itself. Correct. But after a shower there’s a state where it isn’t raining and the ground is still wet, and in that state both rules return zero. The fire held whatever value it had at that instant, to three decimal places, for the three to eight minutes the ground took to dry. And since wetness is global, every fire on the map froze at once, each at its own arbitrary level.
The fix wasn’t a constant. It gave the fire somewhere to go: an explicit equilibrium, the intensity the wood can actually sustain at that wetness. There are three regimes now and only one runs at a time: rain falling, recovering toward that level, or decaying toward it. The fire is always heading somewhere. A fire caught by a shower and then left alone now dies about fifty seconds later, unless someone feeds it.
The part that stayed with us: the recovery rate had been carefully tuned to a 26–33 second window, with a comment explaining why. The wetness decay had been tuned just as carefully, in another file. Nobody had multiplied the two, and the product said that window described a case the other system never allowed to happen. The tests were there and they passed. A unit test can’t see a constant living in another file.
After DevLog #6 the campfire in mission 1 looked fine at noon and broken at midnight: thin, whitish, with orange blotches floating around it. We measured it in play and found five separate causes, and most of them were not in the fire itself.
The same fire, same camera. Left: midnight before. Centre: noon. Right: midnight after. The flame matches noon; only the light around it changes.
DevLog #6 ended with an admission: lights other than the sun cast no shadows. That’s fixed. But a point light with shadows renders the scene six times, once per cube face, so with a hundred units carrying torches, shadows for everything would sink the frame rate. So there’s a budget. Every 0.3 seconds the game picks the nearest lit fires, torches and lanterns within 70 m of the camera, and only those cast shadows: none on the low preset, two on medium and high, six on ultra.
Two lights sitting inside geometry needed fixing first:
Torches still don’t give vision, and that’s deliberate. If they did, every unit would be its own island of light and night would stop mattering. A torch lights your feet, not the horizon. To see at night you build a watchtower, light a fire, or accept that you can’t.
At the end of the first rework we’d written down three things the fire still got wrong. All three are done.
The smoke got a pass too. It’s lighter when the fire is burning cleanly, dark when it’s choking, and turns to white steam in the rain. It starts 55 cm above the base and draws behind the flame, so it doesn’t cover the flame.