Generating random Pools or lakes

I have implemented functions that can draw any polygonal shape, however I have been unable to generate a smooth shape that mimics the rounded edges of a lake. I tried generating two circles and joining the edges but there is not enough variation or smoothness to it. Does anyone have any pointers or ideas that could generate a shape like this?

• I've been looking into bezier curves, it appears that I might be able to generate a lake from that. Anyone have any experience with them on a 2d array? Jan 11 '12 at 6:18

alwynd mentioned Perlin noise. Here's how I generated the island shapes for the polygon map generator:

1. Generate perlin noise.
2. For each location (x, y) in the noise bitmap, compute the distance from the center, normalized so that the bitmap is 2x2: (dx, dy) = (2 * x / width - 1, 2 * y / height - 1); d = sqrt(dx*dx + dy*dy).
3. Location (x, y) is part of the island if noise[x, y] > 0.3 + 0.4*d*d. This step attempts to make the shape round by cutting off areas that are far from the center.

Islands are a little more ragged than lakes though, so I'm not sure if these shapes will be to your liking. I've put up a demo of the above algorithm, with buttons at the bottom to control the two magic numbers. There might be different values of the magic numbers 0.3 and 0.4 that produce shapes you like.

• Your work is a major inspiration, Amit. +10k if I could, for the 5 years or so of wonder and enjoyment I've gotten out of reading your blog. Jan 10 '12 at 19:09

You could use a Perlin Noise algorithm to generate the lakes for you, if you are using a top down view (polygon shape, sounds like you are), this guy from Stanford did just that.

http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/

• "That guy from Stanford" is also a user on this site, FYI. Jan 10 '12 at 11:58
• who isn't? =) I might start off from some noise (perlin, fractal), but blur the results for less "jaggy" results. Great article, btw - love how he does the rivers. Jan 10 '12 at 12:47