Skip to main content
Game Development

Return to Answer

replaced http://gamedev.stackexchange.com/ with https://gamedev.stackexchange.com/
Source Link

alwynd 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.

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.

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.

Explained why 0.4*d*d is there
Source Link
amitp
  • 6.1k
  • 3
  • 28
  • 43

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.

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.

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.

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.

Source Link
amitp
  • 6.1k
  • 3
  • 28
  • 43

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.

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.

default

AltStyle によって変換されたページ (->オリジナル) /