A style made of light: materials, six steps and one line
The small games on our blueprint pages are bright and flat: 25 fixed colours, a dark outline around every shape and no light at all. That is right for a rule you look at for twenty seconds. For a game you stay in we wanted a night, and a night needs light that does something.
A pixel stores what it is made of
In Heimleuchten no pixel has a colour of its own. It has a material: grass, earth, wood, straw, leaf, stone and more, 11 in all. Each material has six colours, one for each step of light. The first three are the night, blue and close together. The last three are lamp light, amber and wide apart. Which of the six a pixel shows is decided only after the lamps have shone.
Three things come out of that without extra work. Shapes need no outline, because whatever stands is darker than moonlit ground. Texture shows only where it is light, so the dark stays calm. And the change from blue to amber is more than a look: it is a line the game can put a rule on.
A shadow is where no ray came
A lamp sends a ray to every pixel on the edge of a square around it. Each ray walks pixel by pixel, leaves light that gets weaker with the distance, and stops at the first thing that stands in its way. Nothing draws a shadow. It is simply where no ray arrived. Everything is whole numbers, so the same lamps give the same picture in the check on our machine and in your browser.
The line the rule stands on
A tuft of grass makes a pixel one step lighter, and rough ground tears the edge between two steps. Both would be a problem if they could push a pixel from blue to amber, because then the picture would say "lit" where the rule says "dark". So neither may cross that one line. A test tries every light, push and tear a pixel can get and counts the crossings. It counts none. The same test is run on a careless version of the rule and counts some there, which is how we know it can fail.
For your own game
When you ask your AI for lighting, ask it to say where the picture ends and the rule begins, and to test that the two agree. "It looks lit" and "it counts as lit" drift apart quickly, and players notice before you do.
Read up
The pages of ours this note builds on, and what others have written about its point.
Lantern Light in Pixel Art: a Shader with Round, Dithered Rings
The same idea as one small rule for each pixel, with the mistake an AI makes most with it.
Darker and Lighter in Pixel Art: Colour Ramps in a Shader
Why a ramp turns from blue to amber instead of just getting lighter.
Walking a line across a grid until something stands in the way: the ray of the lantern is this, a pixel at a time.
For the morning at the end: one scene in the colours of another hour.
The walk each ray takes, from 1962: a straight line on a grid with whole numbers only.
Next note One fact, five answers: the whole game is the question "is my cell lit?"