How is the chunk generation implemented in Factorio?
I followed some online tutorials using Perlin noise and tried different parameters but the results looked way different than what I expected.
public Texture2D GenerateSpread(int seed, int width, int height) {
var spreadTexture = new Texture2D(width, height);
for (int x = 0; x < spreadTexture.width; x++) {
for (int y = 0; y < spreadTexture.height; y++) {
var xCoord = (x + seed) * granularity / 100f;
var yCoord = (y + seed) * granularity / 100f;
var noise = Mathf.PerlinNoise(xCoord, yCoord);
var color = Color.black;
if (noise > threshold) color = Color.white;
spreadTexture.SetPixel(x, y, color);
}
}
spreadTexture.Apply();
return spreadTexture;
}