I've been experimenting with random generation of a "map" with the intention of building a basic sort of procedural map generator. Generating a reasonable heightmap using libnoise hasn't been that much of an issue.
I am considering using A* or similar to plot two main "roads" across the terrain from top to bottom and left to right, intersecting in the middle of a town in some relatively flat section of the terrain.
I am unsure of the best way to go about locating the optimal point to place the town though. I created a "steepness" map as another map which looks at the points surrounding each point on the heightmap to determine the steepness and then sets 1 if steep and 0 if not to create a "mask" of steep and flat areas.
How then could I determine the largest rectangle area that will fit within those flat areas?
Or perhaps I need to re-look at this a different way and place the "town" first then build the terrain around it rather than trying to place it into an existing terrain.