Devlog | M11d1e

Street names

Molenstraat fading in over a cobbled street in Zierikzee

This one wasn't in the plan. Walking around Zierikzee, I kept wanting to know where I was. Every street already has a real name, sitting unused in the map data, so now the game tells you: step onto a new street and its name fades in near the top of the screen, stays for a few seconds and fades out.

It's a small thing that does a lot. A generated town stops feeling like a generated town when the corner you just turned is called Lange Groendal.

The names come from OpenStreetMap, where one street is often cut into many short pieces. A small tool merges them by name, which leaves 138 streets in a 30 KB file. The game works out where you are by itself, on your own computer, so it costs no network traffic at all.

The hard part isn't finding the nearest street. It's knowing when to keep quiet. At a junction two streets are equally close, and a name that flips back and forth as you walk past would be worse than no name at all. So a new street has to be clearly closer than the one you're on, and stay that way for half a second. Distance is measured from the edge of the road and not its middle, otherwise walking on the pavement of a wide street would make a narrow side street look closer.

Walking down an unnamed path and coming back to the same street says nothing, because as far as the game cares you never left.

I checked those numbers against all 295 pieces of street before trusting them. Down the middle of the road, not one wrong name came up.