I’m using a noise function to procedurally generate a tile map, I was wondering if there is any way to extend what I’m already using to add the ability to create rivers to the map generation.

Currently I’m getting this:

And I’d like to find a method of doing this:

Where large bodies of water are connected to one another as if they were a single continuous flow.

I have a Noise class that makes the values for the map.

```
public class Noise {
int seed;
float frequency;
float amplitude;
float lacunarity;
float persistance;
int octaves;
public Noise (int seed, float frequency, float amplitude, float lacunarity, float persistance, int octaves)
{
this.seed = seed;
this.frequency = frequency;
this.amplitude = amplitude;
this.lacunarity = lacunarity;
this.persistance = persistance;
this.octaves = octaves;
}
public float[,] GetNoiseValues(int width, int height)
{
float[,] noiseValues = new float[width, height];
float max = 0f;
float min = float.MaxValue;
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
noiseValues [i, j] = 0f;
float tempA = amplitude;
float tempF = frequency;
for (int k = 0; k < octaves; k++) {
noiseValues [i, j] += Mathf.PerlinNoise ((i + seed) / (float)width * frequency, (j + seed) / (float)height * frequency) * amplitude;
frequency *= lacunarity;
amplitude *= persistance;
}
amplitude = tempA;
frequency = tempF;
if (noiseValues [i, j] > max)
max = noiseValues [i, j];
if (noiseValues [i, j] < min)
min = noiseValues [i, j];
}
}
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
noiseValues [i, j] = Mathf.InverseLerp (max, min, noiseValues [i, j]);
}
}
return noiseValues;
}
}
```

And in my main class the map is created with the following function:

```
float[,] noiseValues = noise.GetNoiseValues (width, height);
for (int x = 0; x < Width; x++) {
for (int y = 0; y < Height; y++) {
tiles[x,y] = new Tile(x, y);
if (noiseValues[x,y] < 0.2f) {
tiles [x, y].Type = TileType.Shallow;
} else if (noiseValues[x,y] < 0.4f) {
tiles [x, y].Type = TileType.Grass;
} else if (noiseValues[x,y] < 0.55f) {
tiles [x, y].Type = TileType.Scrub;
} else if (noiseValues[x,y] < 0.6f) {
tiles [x, y].Type = TileType.Marsh;
} else if (noiseValues[x,y] < 1f) {
tiles [x, y].Type = TileType.Bare;
}
}
}
```

I’m very new to Unity and C#, I’ve done some reading around generating biomes but the math is somewhat above my head.

Is it possible to extend what I have to accomplish river generating?

Or could I use something like PathA* to join two points on a map to get the result I want?

Thanks!