This routine calculates the flowmap and the uses the flowmap to erode the terrain, refreshing the flowmap at regular intervals (thus trading accuracy for speed). This is a lot faster than John Beale's code, but needs some more work.