Devlog | M11d1b1

Cobbles

Cobbled streets and paved fronts in Zierikzee

The houses went up last time, but they stood on flat grey strips and bright grass. This milestone the town got its streets, and it changed more than I expected. A cobbled street running off between brick houses is the first thing in this project that makes me want to just walk around.

The plan said to build roads from Synty's road pieces. That was wrong for this town. Those pieces are straight tiles on a grid, and Zierikzee's streets are about 45 kilometres of curves and odd junctions. Tiles would have left gaps everywhere.

So streets aren't objects at all any more. They're painted into the ground. A small tool draws every real street into a mask, one small image per chunk: cobbles for town streets, asphalt for the main roads, paving for pavements and paths. Then it fills the space between each house and its street with paving, so that grass stops at the walls. A shader reads the mask and paints the surfaces.

Painting them has a nice side effect. Junctions are just two lines crossing in an image, so the slivers and overlaps of the old road strips are gone without any special handling. Collision came for free as well, because the ground already had it. All 144 masks together are under 4 MB.

The first version looked like a photo of cobbles laid on the floor, and very flat. The stones now have a height map, made by separating them from the mortar by colour, and the shader steps down along your line of sight until it meets a stone. They aren't real geometry, but from the game's camera they stand up, with dark gaps and lit edges.

Getting there took a detour. A ring of tiny dots appeared around every stone, and I blamed three wrong things before finding it: my first height search bounced between stone and gap at steep edges. Searching from the top down fixed it for good.

It took three tries to stop the ground being bright pink. The way I draw the town is picky about how a shader is written, and it says so by painting everything magenta.

There's one thing I'm not happy with. The first time you run a fresh build, the game freezes for up to 2.5 seconds early in your walk. It happened on all four new builds and on none of the repeat runs, so it looks like a one-time cost, but a new player would hit it. That needs fixing before anyone else plays.