Nilo

Journal3

One real layer

Small examples prove very little. Two hundred dots will look good in any language. So before going further I wanted to know whether Nilo could carry real work.

I took a finished piece of mine. It is built from 33 layers, and the whole thing ships at about 360,000 characters. I picked one layer, the painted body, and had it rewritten in Nilo. Not something like it. The same layer, to be checked against the original.

What the layer is

About 80,000 brush strokes, laid along a flow, then dragged two ways by slow noise so the paint looks wet. Here it is on its own, on white, for three different tokens. No wall, no floor, no border. Those are other layers.

A blue painted body, a dark crown breaking into loose strokes above a pale lit bowl

A low fallen form in teal and pale pink over a broad swept base

An upright form in grey and cream, a lit bowl over a dark column

These images came out of Nilo.

How it was checked

Looking the same is not good enough. The check was this: every element the original draws, in the same order, with the same numbers. Between 78,000 and 90,000 elements per token, across three tokens.

The count of values that differed was zero. Then the pixels were compared as well, and they matched.

What it cost

OriginalNilo
Shipped code for this layer22,060 bytes10,212 bytes
Lines of source for the same work987500

It also builds the layer a little faster, by 10 to 15 percent.

Less than half the size, and about half the lines. That is good. It is not the whole truth, though. About 140 of those 500 lines are there only because this is a copy. To match the original exactly, the layer had to carry the old random generator and the old colour arithmetic, digit for digit. A piece written fresh would not need them.

The wet edge, in six lines

The part I like best is how the wet look is written. An effect is a recipe for turning one image into another:

effect wet(push: num, seedA: int, seedB: int) {
  let a = displace(source, fractal(vec(0.02, 0.008), 2, seedA), push)
  let b = displace(source, fractal(vec(0.008, 0.02), 2, seedB), push)
  let both = a * 0.5 + b * 0.5
  return source * 0.45 + both * 0.55
}

Take what the layer drew. Push it around with one noise field, and again with another. Blend the two, and lay some of the original back on top. I can read that and see the paint.

What it found

The copy caught a real fault in the language. Nilo had been rolling random numbers on both sides of a choice, even the side that was not taken. A small example never showed it. Eighty thousand strokes that had to match did. It is now something the compiler refuses.

That is the best argument for testing on real work. The dots would never have told me.

What it does not prove

One layer is not a piece. The other 32 are not done, and this one was handed its starting values from the original instead of working them out. My guess is that the whole piece would ship at about a third of its present size. It is a guess.