Math is hard.

InSmallRegionStuff from today:

I fixed up the generation of the Voronoi cells, so that there are no longer “empty spaces” in the corners and edges of the map, as I mentioned yesterday.  It’s true that having them there wouldn’t have caused a problem for regions, but I’m planning to use this code for a few other features as well, which absolutely do require packing areas tightly, with no gaps, so I decided to go ahead and fix it before I forgot how the maths worked. This fix took most of the day, due to a silly bug that I ought to have caught much earlier.  (Debugging tip when dealing with large quantities of data:  using lots of asserts can be tremendously helpful for finding the one case out of hundreds or thousands where things go wrong!)

Despite wasting a lot of time on that bug, I did get a few other things done today.  For one, regions are now fully wired into this new method of generating region boundaries, including having the region boundaries visible in the terrain.  In the screenshot here, I’m standing near one side of the smallest region on the map (you can actually see it in yesterday’s screenshot;  it’s that tiny triangular region toward the top left corner of yesterday’s screenshot).   The mountains you can see in the distance are this region’s boundaries.  The region is only about a kilometer and a half across, which means that you could stand in the middle of the region and turn on the spot to see the whole extent of the region, all from the one spot.