Your project looks very exciting.. must be fun programming it! Would love to see it in action :)
As soon as I get something solid, I'll update this post to a working example.
Just wondering if the loops are causing any delay? or they're instantaneous?
So far, it's not too horrible. A second or two. But, I'm far from being done. Nepeo pretty much figured out what I'm doing. I'm using a technique similar to what he linked to:
So far, these are the steps I'm taking but, I need at least one more routine and your Quadtree may just fit the bill. I'll study that today.
* On function 'Startup'
-> Functions: Call BuildArrayRandom
-> Functions: Call AverageTheArray
-> System: Set ArrayTotal to round((ArrayTotal÷ArrayCount))×MapFilter
-> Functions: Call SetTerrainIslandorWater
-> System: Set ArrayCount to 0
-> Functions: Call FillInPonds
-> Functions: Call EliminateOrphans
-> Functions: Call PlaceBeaches
-> Functions: Call CopyToTilemap
First, it builds an array of random numbers.
Then, it iterates through the array, looking at each cell. It looks at the 8 surrounding cells and replaces the one it's looking at with an average of the other 8.
The ArrayTotal is the average of all cells in the entire array. By adding the MapFilter (say 0.9 to 1.1) I can easily generate more or less land mass.
Then, it loops again through the array. If the cell is above that ArrayTotal average, it sets it to the value for the land tile, otherwise, it sets the value to the WaterTile.
Next, it attempts to look at water tiles that have a lot of land around them and fills them with land tiles.
The EliminateOrphans is the smoothing I posted above.
And this next part I'm still working on. It loops again through the array, looks at surrounding tiles and attempts to create a beaches on the island borders from one of 12 possible tiles (N,S,E,W outside curved tiles NW,NE,SW,SE and inside curved tiles NW,NE,SW,SE).
Finally, it copies the array over to the tilemap and shows it.
But if your algorithm if fast enough, then you don't need anything else.
So far, it's pretty quick. That may change as there are still trees, bushes, etc to place. I'm liberally stealing the idea from a game jam project and his would take a full minute or two to generate a map. I'm hoping to be a lot faster than that.
This is a 200x200 array which it does in about 5 seconds.
And to show how the map filter works, the above example was at 1.075. The one below was created just by changing that filter to 0.95.