Skip to main content
Game Development

Return to Question

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

1.httphttps://gamedev.stackexchange.com/questions/80548/fast-simple-procedural-2d-island-generation

2.httphttps://gamedev.stackexchange.com/questions/22184/generating-random-pools-or-lakes

1.http://gamedev.stackexchange.com/questions/80548/fast-simple-procedural-2d-island-generation

2.http://gamedev.stackexchange.com/questions/22184/generating-random-pools-or-lakes

1.https://gamedev.stackexchange.com/questions/80548/fast-simple-procedural-2d-island-generation

2.https://gamedev.stackexchange.com/questions/22184/generating-random-pools-or-lakes

Fixed some errors i found and changed a couple of things
Source Link
Stuart
  • 23
  • 1
  • 6

***EDIT:

Fixed/Changed a couple of things and now i am getting this(still not what i want):

changes/fixes

with this changed code:

for(int y = 0; y < HEIGHT; y++) {
 for(int x = 0; x < WIDTH; x++) {
 // amitp's solution
 Vector2 vec = new Vector2(((2 * x) / WIDTH) - 1, ((2 * y) / HEIGHT) - 1);
 float d = Mathf.Sqrt((vec.x * vec.x) + (vec.y * vec.y));
 //
 float noise = Noise.Generate((float)x / WIDTH, (float)y / HEIGHT);
 // amitp's solution again
 mapData[x, y] = noise > 0.3 + 0.4*d*d ? noise * 10 : 0.0f;
 //
 colors[x + y * WIDTH] = new Color(mapData[x, y], mapData[x, y], mapData[x, y]);
 }
 }

***EDIT:

Fixed/Changed a couple of things and now i am getting this(still not what i want):

changes/fixes

with this changed code:

for(int y = 0; y < HEIGHT; y++) {
 for(int x = 0; x < WIDTH; x++) {
 // amitp's solution
 Vector2 vec = new Vector2(((2 * x) / WIDTH) - 1, ((2 * y) / HEIGHT) - 1);
 float d = Mathf.Sqrt((vec.x * vec.x) + (vec.y * vec.y));
 //
 float noise = Noise.Generate((float)x / WIDTH, (float)y / HEIGHT);
 // amitp's solution again
 mapData[x, y] = noise > 0.3 + 0.4*d*d ? noise * 10 : 0.0f;
 //
 colors[x + y * WIDTH] = new Color(mapData[x, y], mapData[x, y], mapData[x, y]);
 }
 }
added 45 characters in body
Source Link
Stuart
  • 23
  • 1
  • 6

I am trying to generate an island using Simplex Noise. To actually make a island shape i used Amitp's answers to the following questions:

1.http://gamedev.stackexchange.com/questions/80548/fast-simple-procedural-2d-island-generation

2.http://gamedev.stackexchange.com/questions/22184/generating-random-pools-or-lakes

Using them i have snippet of code for generation:(width/height is 128)

for(int y = 0; y < HEIGHT; y++) {
 for(int x = 0; x < WIDTH; x++) {
 // amitp's solution
 Vector2 vec = new Vector2(2 * x / WIDTH - 1, 2 * y / HEIGHT - 2);
 float d = Mathf.Sqrt(vec.x * vec.x + vec.y * vec.y);
 //
 float noise = Noise.Generate((float)x / WIDTH * 10, (float)Time.time * y / HEIGHT * 10);
 // amitp's solution again
 mapData[x, y] = noise > 0.3 + 0.4*d*d ? noise * 10 : 0.0f;
 //
 colors[x + y * WIDTH] = new Color(mapData[x, y], mapData[x, y], mapData[x, y]);
 }
 }

This gives me the following unwanted result:

Wrong

How do i get fix it to generate properly?

Lastly i'm using Unity.

I am trying to generate an island using Simplex Noise. To actually make a island shape i used Amitp's answers to the following questions:

1.http://gamedev.stackexchange.com/questions/80548/fast-simple-procedural-2d-island-generation

2.http://gamedev.stackexchange.com/questions/22184/generating-random-pools-or-lakes

Using them i have snippet of code for generation:(width/height is 128)

for(int y = 0; y < HEIGHT; y++) {
 for(int x = 0; x < WIDTH; x++) {
 Vector2 vec = new Vector2(2 * x / WIDTH - 1, 2 * y / HEIGHT - 2);
 float d = Mathf.Sqrt(vec.x * vec.x + vec.y * vec.y);
 float noise = Noise.Generate((float)x / WIDTH * 10, (float)Time.time * y / HEIGHT * 10);
 mapData[x, y] = noise > 0.3 + 0.4*d*d ? noise * 10 : 0.0f;
 colors[x + y * WIDTH] = new Color(mapData[x, y], mapData[x, y], mapData[x, y]);
 }
 }

This gives me the following unwanted result:

Wrong

How do i get fix it to generate properly?

Lastly i'm using Unity.

I am trying to generate an island using Simplex Noise. To actually make a island shape i used Amitp's answers to the following questions:

1.http://gamedev.stackexchange.com/questions/80548/fast-simple-procedural-2d-island-generation

2.http://gamedev.stackexchange.com/questions/22184/generating-random-pools-or-lakes

Using them i have snippet of code for generation:(width/height is 128)

for(int y = 0; y < HEIGHT; y++) {
 for(int x = 0; x < WIDTH; x++) {
 // amitp's solution
 Vector2 vec = new Vector2(2 * x / WIDTH - 1, 2 * y / HEIGHT - 2);
 float d = Mathf.Sqrt(vec.x * vec.x + vec.y * vec.y);
 //
 float noise = Noise.Generate((float)x / WIDTH * 10, (float)y / HEIGHT * 10);
 // amitp's solution again
 mapData[x, y] = noise > 0.3 + 0.4*d*d ? noise * 10 : 0.0f;
 //
 colors[x + y * WIDTH] = new Color(mapData[x, y], mapData[x, y], mapData[x, y]);
 }
 }

This gives me the following unwanted result:

Wrong

How do i get fix it to generate properly?

Lastly i'm using Unity.

Source Link
Stuart
  • 23
  • 1
  • 6
Loading
lang-cs

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