I have made a map generation in my tile based game. It almost exactly does what I want, except for 1 thing. The rivers look like this:
The problem with this is, the water is not realistic. It are just some spots random over the world. I want to make a realistic river generation. Which would include different sizes (between 5 and 20 block wide), branches, lakes and different depths (by changing the colour of the water). What is the best way to do that?
Here is an Simcity 4 example of what I mean with realistic rivers:
My code:
waterOffsetX = Random.Range (10f, 300000f);
waterOffsetX = Mathf.Round (waterOffsetX) + 0.5f;
waterOffsetY = Random.Range (10f, 300000f);
waterOffsetY = Mathf.Round (waterOffsetY) + 0.5f;
for (float x = -gridX; x < gridX; x += 1)
{
for (float y = -gridY; y < gridY; y += 1)
{
Vector3 spawnPos = new Vector3 (x, y, 0);
float perlinWater = Mathf.PerlinNoise (x * seedWaterX + waterOffsetX , y * seedWaterY + waterOffsetY);
if (perlinWater > perlinThresholdWater) {
GameObject waterTile = Instantiate (water, spawnPos, Quaternion.identity) as GameObject;
}
}
}
Values:
seedWater (X & Y) = 0.1
Grid (X & Y) = 50
perlinThresholdWater = 0.6