User blog comment:SmokedSausageFTW/The Forest Development Blog 5/@comment-13254338-20140708033143

For those who know what perlin noise is; this is perlin noise in action. That's what generates the hills. It plots a bunch of random points then basically draws curves through those points.

As for the trees, they look to be generated up to the same level, meaning they go from the ground to whatever Y value. They appear to show up on a random basis (i.e. plant a tree at plus the current tree x)

The lakes seem to use search for basins in the hills (parts where the hill dips down then goes back up, forming a parabola/U shape), then fills those basins with water.

As for the caves, I would assume it plots "miners" around the map then makes those miners go in a random direction for x steps.

The bugs in the terrain generator seem to stem from the fact that the terrain is generated in the incorrect order (hills, then caves, then lakes, then trees). It seems that the trees generating on caves is because of this.

Anyway, I've done a lot of 2d terrain generator stuff before.

PS: MUAHAHA, I HAVE DECODED YOUR GENERATOR :P