1. Seed Generation
The map starts with a uniform 8x8 grid of 64 points. Each point is randomly "jiggled" by up to 6.5% of its grid spacing. Then, 10 random, adjacent pairs of points are merged into one, leaving 54 unique "seed" points for the plots.
2. Road Network
- Main Roads: A North-South road is generated by finding a path from a central point at the top to the bottom. An East-West road does the same from left to right, creating a crossroads.
- Driveways: The script checks if any Suburban (yellow) plots are "stranded" (not touching a road). If one is, it finds the shortest path along the plot boundaries to the nearest main road and turns it into a thinner "driveway".
3. Village Zoning
Every plot is assigned a zone based on its relationship to the roads:
- Urban: A plot that touches at least 2 road segments and is not on the map's outer edge.
- Suburban: A plot that is not Urban, but is adjacent to an Urban plot.
- Rural: Any plot that is neither Urban nor Suburban.
4. Drawing Features
- Urban Buildings: Narrow, "ramshackle" buildings are drawn along the road frontages, set back by a tiny, random amount to create a sidewalk. Their depth is random (20-40%) to create an irregular skyline.
- Suburban Houses: L, T, or U-shaped houses are placed at the center of each suburban plot. They are rotated to align with the nearest main road or fence line.
- Rural Trees: Simple, sepia-toned trees with branches and shadows are scattered across all rural land. The script ensures they don't grow on top of roads.
- Fences: A thin line with dark posts is drawn on any boundary between plots, as long as it's not a road and not between two rural plots.