The previous lesson got as far as "it lays terrain in diamonds and blends the edges". Knowing exactly what that diamond is explains both "why will it not make this shape" and "why did painting next to it change what I already had".
isomWidth = 타일 너비 / 2 + 1 isomX = 타일 x / 2 isomHeight = 타일 높이 + 1 isomY = 타일 y 마름모는 (isomX + isomY)가 짝수인 자리에만 존재합니다 마름모 하나가 덮는 타일: x = 2*isomX-2 .. 2*isomX+1, y = isomY-1 .. isomY
Painting a rectangle paints only the diamonds whose whole footprint fits inside it. If none fits, nothing happens at all - so a small rectangle works or does not work depending on where it is, not only on how big it is.
| 4 x 2 | At 16 of 64 offsets. |
|---|---|
| 5 x 2 | At 32 of 64. |
| 4 x 3 | At 32 of 64. |
| 5 x 3 | All 64. Always. |
5x3 is not a rule of thumb, it is the smallest rectangle that works wherever it lands. Size every area from there up and the parity never has to be thought about. For scale: 16x16 holds 53 diamonds, 32x24 holds 173, 64x64 holds 977.
And the edge blending reaches OUTSIDE what you painted - two diamonds, 8 by 4 tiles. Paint next to an area and you re-cut its border. Paint the edge that should win last, or leave 8 tiles between areas that must not touch.
The tile id comes out of the same structure: divide by 16 for the tile group, the remainder is the variant. A group holds the common variants first, then a single 0, then the rare ones - and painting picks a rare one with a 1 in 20 chance.
That choice is not random but seeded from the operation's own parameters, so the same brush at the same place in the same size always produces the same tiles - and re-running a step changes nothing.
Finally, not every terrain can meet every other. Each tileset carries a table of which types connect to which, and two that are not adjacent get an intermediate laid between them automatically. You cannot design a border straight from water to high dirt - think of it as water, then dirt, then high dirt.
Terrain modes