//Swamp terrain - 10 public void MakeSwampTerrain() { System.Random random = new System.Random(); tileSize = 5; seed = new Seed(100, 100); seedGen = new SeedGenerator(seed); seedGen.SetMapDouble(); //Set Map blur random values if (RandomBool()) { seedGen.SeedProperties(RandomBool(), false, false, false, false); seedGen.BlurMap(); seedGen.SeedProperties(false, false, false, false, false); } //TODO: add for symmetry //seedGen.SeedProperties(false, false, false, false); int numCircles = random.Next(1, 5); for (int x = 0; x < numCircles; x++) { Vector2 radius = new Vector2(random.Next(3, seed.X), random.Next(3, seed.Y)); Vector2 center = new Vector2(random.Next(0, seed.X), random.Next(0, seed.Y)); seedGen.CircleFill(radius, center, random.NextDouble() + random.Next(-1, 3)); seedGen.BlurAreaCircle(radius, center); } //Set Double if (RandomBool()) { seedGen.SeedProperties(RandomBool(), false, false, false, false); seedGen.SetMapDouble(); seedGen.SeedProperties(false, false, false, false, false); } //Set Map blur if (RandomBool()) { seedGen.SeedProperties(RandomBool(), false, false, false, false); seedGen.BlurMap(); seedGen.SeedProperties(false, false, false, false, false); } //Add Water if (RandomBool()) { water[0].gameObject.SetActive(true); } RunTerrainMaker(); }
//Spire terrain - 16 public void MakeSpireTerrain() { tileSize = 4f; seed = new Seed(125, 125); seedGen = new SeedGenerator(seed); seedGen.SetMapDouble(); seedGen.SetMapRandom(2); seedGen.SeedProperties(true, false, false, false, false); Vector2Int direction = new Vector2Int(1, 0); Vector2Int location = new Vector2Int(10, 10); seedGen.Line(5, 10, direction, location); Vector2 radius = new Vector2(49, 49); Vector2 center = new Vector2(50, 50); seedGen.CircleFill(radius, center, 2.5f); seedGen.SeedProperties(false, false, false, false, false); radius = new Vector2(10, 10); center = new Vector2(30, 30); seedGen.CircleFill(radius, center, 5); radius = new Vector2(9, 9); center = new Vector2(30, 30); seedGen.CircleFill(radius, center, 6); radius = new Vector2(8, 8); center = new Vector2(30, 30); seedGen.CircleFill(radius, center, 7); radius = new Vector2(7, 7); center = new Vector2(30, 30); seedGen.CircleFill(radius, center, 8); radius = new Vector2(6, 6); center = new Vector2(30, 30); seedGen.CircleFill(radius, center, 9); center = new Vector2(90, 25); seedGen.SquareFill(radius, center, 15); RunTerrainMaker(); }
//TODO: Can be flat or mountainous //Desert terrain - 6 public void MakeDesertTerrain() { tileSize = 4f; seed = new Seed(125, 125); seedGen = new SeedGenerator(seed); System.Random random = new System.Random(); //Lower the terrain Vector2 radius = new Vector2(seed.X / 2, seed.Y / 2); Vector2 center = new Vector2(seed.X / 2, seed.Y / 2); seedGen.SquareFill(radius, center, random.NextDouble() - random.Next(1, 3)); //Lock seedGen.SeedProperties(false, false, false, false, true); bool addMountain = RandomBool(); if (addMountain) { //North double height = random.Next(15, 30) + random.NextDouble(); int iterations = random.Next(5, 10); for (int i = 0; i < iterations; i++) { int passesAtHeight = random.Next(5, 10); for (int j = 0; j < iterations; j++) { float randomX = random.Next(0, seed.X - 1); radius = new Vector2(random.Next(5, 10), random.Next(5, 10)); center = new Vector2(randomX, seed.Y - i - 1); seedGen.CircleFill(radius, center, height); } if (height > 0) { height -= random.NextDouble() + random.Next(0, 5); } } //East height = random.Next(15, 30) + random.NextDouble(); iterations = random.Next(5, 10); for (int i = 0; i < iterations; i++) { int passesAtHeight = random.Next(5, 10); for (int j = 0; j < iterations; j++) { float randomY = random.Next(0, seed.Y - 1); radius = new Vector2(random.Next(5, 10), random.Next(5, 10)); center = new Vector2(seed.X - i - 1, randomY); seedGen.CircleFill(radius, center, height); } if (height > 0) { height -= random.NextDouble() + random.Next(0, 5); } } //West height = random.Next(15, 30) + random.NextDouble(); iterations = random.Next(5, 10); for (int i = 0; i < iterations; i++) { int passesAtHeight = random.Next(5, 10); for (int j = 0; j < iterations; j++) { float randomY = random.Next(0, seed.Y - 1); radius = new Vector2(random.Next(5, 10), random.Next(5, 10)); center = new Vector2(i, randomY); seedGen.CircleFill(radius, center, height); } if (height > 0) { height -= random.NextDouble() + random.Next(0, 5); } } } seedGen.SeedProperties(false, false, false, false, false); AddWater(useWater); SetWaterHeight((float)0); RunTerrainMaker(); }
//Oasis Terrain - 3 public void MakeOasisTerrain() { System.Random random = new System.Random(); tileSize = 4f; seed = new Seed(125, 125); seedGen = new SeedGenerator(seed); seedGen.SeedProperties(false, false, false, false, false); //Lower the terrain Vector2 radius = new Vector2(seed.X / 2, seed.Y / 2); Vector2 center = new Vector2(seed.X / 2, seed.Y / 2); seedGen.SquareFill(radius, center, random.NextDouble() - random.Next(1, 3)); //Left side - mesa for (int y = 0; y < 4; y++) { for (int i = 0; i < 2; i++) { radius = new Vector2(random.Next(5, 20), random.Next(5, 20)); center = new Vector2(0, random.Next((4 - (y + 1)) * seed.Y / 4, (4 - y) * seed.Y / 4)); seedGen.CircleFill(radius, center, random.Next(15, 50)); } } //Right side - mesa for (int y = 0; y < 4; y++) { for (int i = 0; i < 2; i++) { radius = new Vector2(random.Next(5, 20), random.Next(5, 20)); center = new Vector2(seed.X - 1, random.Next((4 - (y + 1)) * seed.Y / 4, (4 - y) * seed.Y / 4)); seedGen.CircleFill(radius, center, random.Next(15, 50)); } } //Top side - mesa for (int x = 0; x < 4; x++) { for (int i = 0; i < 2; i++) { float randomX = random.Next((4 - (x + 1)) * seed.X / 4, (4 - x) * seed.X / 4); radius = new Vector2(random.Next(5, 20), random.Next(5, 20)); center = new Vector2(randomX, seed.Y - 1); seedGen.CircleFill(radius, center, random.Next(15, 50)); } } //Bottom side - mesa for (int x = 0; x < 4; x++) { for (int i = 0; i < 2; i++) { float randomX = random.Next((4 - (x + 1)) * seed.X / 4, (4 - x) * seed.X / 4); radius = new Vector2(random.Next(5, 20), random.Next(5, 20)); center = new Vector2(randomX, 0); seedGen.CircleFill(radius, center, random.Next(15, 50)); } } //Blur 4 corners radius = new Vector2(seed.X / 2, seed.Y / 2); center = new Vector2(0, 0); seedGen.BlurAreaCircle(radius, center); center = new Vector2(seed.X - 1, 0); seedGen.BlurAreaCircle(radius, center); center = new Vector2(0, seed.Y - 1); seedGen.BlurAreaCircle(radius, center); center = new Vector2(seed.X - 1, seed.Y - 1); seedGen.BlurAreaCircle(radius, center); seedGen.SeedProperties(true, false, false, false, false); //Bottom-Left - islands for (int i = 0; i < 4; i++) { float randomX = random.Next(seed.X / 4, seed.X / 2); float randomY = random.Next(seed.Y / 4, seed.Y / 2); radius = new Vector2(random.Next(10, 15), random.Next(10, 15)); center = new Vector2(randomX, randomY); seedGen.MountainGradual(radius, center, random.Next(10, 15), true); } //Bottom-Right - islands for (int i = 0; i < 4; i++) { float randomX = random.Next(seed.X / 2, 3 * seed.X / 4); float randomY = random.Next(seed.Y / 4, seed.Y / 2); radius = new Vector2(random.Next(10, 15), random.Next(10, 15)); center = new Vector2(randomX, randomY); seedGen.MountainGradual(radius, center, random.Next(10, 15), true); } //Top-Left - islands for (int i = 0; i < 4; i++) { float randomX = random.Next(seed.X / 4, seed.X / 2); float randomY = random.Next(seed.X / 2, 3 * seed.X / 4); radius = new Vector2(random.Next(10, 15), random.Next(10, 15)); center = new Vector2(randomX, randomY); seedGen.MountainGradual(radius, center, random.Next(10, 15), true); } //Top-Right - islands for (int i = 0; i < 4; i++) { float randomX = random.Next(seed.X / 2, 3 * seed.X / 4); float randomY = random.Next(seed.X / 2, 3 * seed.X / 4); radius = new Vector2(random.Next(10, 15), random.Next(10, 15)); center = new Vector2(randomX, randomY); seedGen.MountainGradual(radius, center, random.Next(10, 15), true); } seedGen.BlurMap(); AddWater(true); RunTerrainMaker(); }