public static float TerrainGrasslandFlats(int x, int y, OverworldGeneratorV2 generator, float river, float mPitch, float baseHeight) { var simplex = generator.SimplexInstance(0); float h = simplex.GetValue(x / 100f, y / 100f) * 7; h += simplex.GetValue(x / 20f, y / 20f) * 2; float m = simplex.GetValue(x / 180f, y / 180f) * 35f * river; m *= m / mPitch; float sm = BlendedHillHeight(simplex.GetValue(x / 30f, y / 30f)) * 8f; sm *= m / 20f > 3.75f ? 3.75f : m / 20f; m += sm; return(Riverized(baseHeight + h + m, river)); }
public TestGame(OverworldGeneratorV2 worldGen, int chunks, int resolution) { _worldGen = worldGen; _chunks = chunks; _resolution = resolution; _graphics = new GraphicsDeviceManager(this); var data = "{ \"name\":\"test\", \"colorMap\":[\r\n[ 0, { \"r\":0, \"g\":0, \"b\":112 } ],\r\n[ 1, { \"r\":141, \"g\":179, \"b\":96 } ],\r\n[ 2, { \"r\":250, \"g\":148, \"b\":24 } ],\r\n[ 3, { \"r\":96, \"g\":96, \"b\":96 } ],\r\n[ 4, { \"r\":5, \"g\":102, \"b\":33 } ],\r\n[ 5, { \"r\":11, \"g\":2, \"b\":89 } ],\r\n[ 6, { \"r\":7, \"g\":249, \"b\":178 } ],\r\n[ 7, { \"r\":0, \"g\":0, \"b\":255 } ],\r\n[ 8, { \"r\":255, \"g\":0, \"b\":0 } ],\r\n[ 9, { \"r\":128, \"g\":128, \"b\":255 } ],\r\n[ 10, { \"r\":112, \"g\":112, \"b\":214 } ],\r\n[ 11, { \"r\":160, \"g\":160, \"b\":255 } ],\r\n[ 12, { \"r\":255, \"g\":255, \"b\":255 } ],\r\n[ 13, { \"r\":160, \"g\":160, \"b\":160 } ],\r\n[ 14, { \"r\":255, \"g\":0, \"b\":255 } ],\r\n[ 15, { \"r\":160, \"g\":0, \"b\":255 } ],\r\n[ 16, { \"r\":250, \"g\":222, \"b\":85 } ],\r\n[ 17, { \"r\":210, \"g\":95, \"b\":18 } ],\r\n[ 18, { \"r\":34, \"g\":85, \"b\":28 } ],\r\n[ 19, { \"r\":22, \"g\":57, \"b\":51 } ],\r\n[ 20, { \"r\":114, \"g\":120, \"b\":154 } ],\r\n[ 21, { \"r\":83, \"g\":123, \"b\":9 } ],\r\n[ 22, { \"r\":44, \"g\":66, \"b\":5 } ],\r\n[ 23, { \"r\":98, \"g\":139, \"b\":23 } ],\r\n[ 24, { \"r\":0, \"g\":0, \"b\":48 } ],\r\n[ 25, { \"r\":162, \"g\":162, \"b\":132 } ],\r\n[ 26, { \"r\":250, \"g\":240, \"b\":192 } ],\r\n[ 27, { \"r\":48, \"g\":116, \"b\":68 } ],\r\n[ 28, { \"r\":31, \"g\":5, \"b\":50 } ],\r\n[ 29, { \"r\":64, \"g\":81, \"b\":26 } ],\r\n[ 30, { \"r\":49, \"g\":85, \"b\":74 } ],\r\n[ 31, { \"r\":36, \"g\":63, \"b\":54 } ],\r\n[ 32, { \"r\":89, \"g\":102, \"b\":81 } ],\r\n[ 33, { \"r\":69, \"g\":7, \"b\":62 } ],\r\n[ 34, { \"r\":80, \"g\":112, \"b\":80 } ],\r\n[ 35, { \"r\":189, \"g\":18, \"b\":95 } ],\r\n[ 36, { \"r\":167, \"g\":157, \"b\":100 } ],\r\n[ 37, { \"r\":217, \"g\":69, \"b\":21 } ],\r\n[ 38, { \"r\":17, \"g\":151, \"b\":101 } ],\r\n[ 39, { \"r\":202, \"g\":140, \"b\":101 } ],\r\n[ 40, { \"r\":128, \"g\":128, \"b\":255 } ],\r\n[ 41, { \"r\":128, \"g\":128, \"b\":255 } ],\r\n[ 42, { \"r\":128, \"g\":128, \"b\":255 } ],\r\n[ 43, { \"r\":128, \"g\":128, \"b\":255 } ],\r\n[ 44, { \"r\":0, \"g\":0, \"b\":172 } ],\r\n[ 45, { \"r\":0, \"g\":0, \"b\":144 } ],\r\n[ 46, { \"r\":32, \"g\":32, \"b\":112 } ],\r\n[ 47, { \"r\":0, \"g\":0, \"b\":80 } ],\r\n[ 48, { \"r\":0, \"g\":0, \"b\":64 } ],\r\n[ 49, { \"r\":32, \"g\":32, \"b\":56 } ],\r\n[ 50, { \"r\":64, \"g\":64, \"b\":144 } ],\r\n[ 127, { \"r\":0, \"g\":0, \"b\":0 } ],\r\n[ 129, { \"r\":181, \"g\":219, \"b\":136 } ],\r\n[ 130, { \"r\":255, \"g\":188, \"b\":64 } ],\r\n[ 131, { \"r\":136, \"g\":136, \"b\":136 } ],\r\n[ 132, { \"r\":45, \"g\":142, \"b\":73 } ],\r\n[ 133, { \"r\":51, \"g\":142, \"b\":19 } ],\r\n[ 134, { \"r\":47, \"g\":255, \"b\":18 } ],\r\n[ 140, { \"r\":180, \"g\":20, \"b\":220 } ],\r\n[ 149, { \"r\":123, \"g\":13, \"b\":49 } ],\r\n[ 151, { \"r\":138, \"g\":179, \"b\":63 } ],\r\n[ 155, { \"r\":88, \"g\":156, \"b\":108 } ],\r\n[ 156, { \"r\":71, \"g\":15, \"b\":90 } ],\r\n[ 157, { \"r\":104, \"g\":121, \"b\":66 } ],\r\n[ 158, { \"r\":89, \"g\":125, \"b\":114 } ],\r\n[ 160, { \"r\":129, \"g\":142, \"b\":121 } ],\r\n[ 161, { \"r\":109, \"g\":119, \"b\":102 } ],\r\n[ 162, { \"r\":120, \"g\":52, \"b\":120 } ],\r\n[ 163, { \"r\":229, \"g\":218, \"b\":135 } ],\r\n[ 164, { \"r\":207, \"g\":197, \"b\":140 } ],\r\n[ 165, { \"r\":255, \"g\":109, \"b\":61 } ],\r\n[ 166, { \"r\":216, \"g\":191, \"b\":141 } ],\r\n[ 167, { \"r\":242, \"g\":180, \"b\":141 } ],\r\n[ 168, { \"r\":118, \"g\":142, \"b\":20 } ],\r\n[ 169, { \"r\":59, \"g\":71, \"b\":10 } ],\r\n[ 170, { \"r\":82, \"g\":41, \"b\":33 } ],\r\n[ 171, { \"r\":221, \"g\":8, \"b\":8 } ],\r\n[ 172, { \"r\":73, \"g\":144, \"b\":123 } ] ] }"; var colors = BiomeColors.FromJson(data); foreach (var element in colors.ColorMap) { var e0 = element[0].Integer.Value; var e1 = element[1].ColorMapClass; _biomeColors.TryAdd(e0, new Color(e1.R, e1.G, e1.B)); } }
public static float TerrainLonelyMountain(int x, int y, OverworldGeneratorV2 generator, float river, float strength, float width, float terrainHeight) { var simplex0 = generator.SimplexInstance(0); float h = BlendedHillHeight(simplex0.GetValue(x / 20f, y / 20f), 0) * 3; h += BlendedHillHeight(simplex0.GetValue(x / 7f, y / 7f), 0) * 1.3f; float m = simplex0.GetValue(x / width, y / width) * strength * river; m *= m / 35f; m = m > 70f ? 70f + (m - 70f) / 2.5f : m; float st = m * 0.7f; st = st > 20f ? 20f : st; float c = generator.SimplexInstance(4).GetValue(x / 30f, y / 30f, 1f) * (5f + st); float sm = simplex0.GetValue(x / 30f, y / 30f) * 8f + simplex0.GetValue(x / 8f, y / 8f); sm *= (m + 10f) / 20f > 2.5f ? 2.5f : (m + 10f) / 20f; m += sm; m += c; // the parameters can "blow through the ceiling" so pull more extreme values down a bit // this should allow a height parameter up to about 120 if (m > 90) { m = 90f + (m - 90f) * .75f; if (m > 110) { m = 110f + (m - 110f) * .75f; } } return(Riverized(generator, terrainHeight + h + m, river)); }
public static float TerrainGrasslandMountains(int x, int y, OverworldGeneratorV2 generator, float river, float hFactor, float mFactor, float baseHeight) { var simplex0 = generator.SimplexInstance(0); float h = simplex0.GetValue(x / 100f, y / 100f) * hFactor; h += simplex0.GetValue(x / 20f, y / 20f) * 2; float m = simplex0.GetValue(x / 230f, y / 230f) * mFactor * river; m *= m / 35f; m = m > 70f ? 70f + (m - 70f) / 2.5f : m; float c = generator.SimplexInstance(4).GetValue(x / 30f, y / 30f, 1f) * (m * 0.30f); float sm = simplex0.GetValue(x / 30f, y / 30f) * 8f + simplex0.GetValue(x / 8f, y / 8f); sm *= m / 20f > 2.5f ? 2.5f : m / 20f; m += sm; m += c; return(Riverized(generator, baseHeight + h + m, river)); }
public static float TerrainVolcano(int x, int y, OverworldGeneratorV2 generator, float border, float baseHeight) { var simplex = generator.SimplexInstance(0); var cellularNoise = generator.CellularInstance(0); float st = 15f - (float)(cellularNoise.Eval2D(x / 500d, y / 500d).ShortestDistance * 42d) + (simplex.GetValue(x / 30f, y / 30f) * 2f); float h = st < 0f ? 0f : st; h = h < 0f ? 0f : h; h += (h * 0.4f) * ((h * 0.4f) * 2f); if (h > 10f) { float d2 = (h - 10f) / 1.5f > 30f ? 30f : (h - 10f) / 1.5f; h += (float)cellularNoise.Eval2D(x / 25D, y / 25D).ShortestDistance *d2; } h += simplex.GetValue(x / 18f, y / 18f) * 3; h += simplex.GetValue(x / 8f, y / 8f) * 2; return(baseHeight + h * border); }
public override float GenerateNoise(OverworldGeneratorV2 generator, int x, int y, float border, float river) { return(TerrainHighland(x, y, generator, river, 10f, 68f, HillStrength, BaseHeight - generator.Preset.SeaLevel)); }
public override float GenerateNoise(OverworldGeneratorV2 generator, int x, int y, float border, float river) { return(Riverized(68f + GroundEffect.Added(generator, x, y), river)); }
public override float GenerateNoise(OverworldGeneratorV2 generator, int x, int y, float border, float river) { return(TerrainHighland(x, y, generator, river, _start, _width, _height, BaseHeight - 62f)); }
public override float GenerateNoise(OverworldGeneratorV2 generator, int x, int y, float border, float river) { return(TerrainFlatLakes(x, y, generator, river, 68f)); }
public override float Added(OverworldGeneratorV2 generator, float x, float y) { return(_one.Added(generator, x, y) + _two.Added(generator, x, y)); }
public override float Added(OverworldGeneratorV2 generator, float x, float y) { return(Height); }
static void Main(string[] args) { int chunks = 64; int width = chunks * 16; int height = chunks * 16; OverworldGeneratorV2 gen = new OverworldGeneratorV2(); gen.ApplyBlocks = true; bool done = false; // ChunkColumn[] generatedChunks = new ChunkColumn[chunks * chunks]; ConcurrentQueue <ChunkCoordinates> chunkGeneratorQueue = new ConcurrentQueue <ChunkCoordinates>(); long average = 0; long min = long.MaxValue; long max = long.MinValue; int chunskGenerated = 0; Thread[] threads = new Thread[Environment.ProcessorCount - 1]; for (int t = 1; t < threads.Length; t++) { threads[t] = new Thread(() => { Stopwatch timing = new Stopwatch(); while (true) { if (chunkGeneratorQueue.TryDequeue(out var coords)) { timing.Restart(); ChunkColumn column = gen.GenerateChunkColumn(coords); // generatedChunks[(coords.X * chunks) + coords.Z] = column; Finished.Enqueue(column); chunskGenerated++; timing.Stop(); average += timing.ElapsedMilliseconds; if (timing.ElapsedMilliseconds < min) { min = timing.ElapsedMilliseconds; } if (timing.ElapsedMilliseconds > max) { max = timing.ElapsedMilliseconds; } } else { break; } } }); } threads[0] = new Thread(() => { GenerateBiomeMap(chunks); }); for (int x = 0; x < chunks; x++) { for (int z = 0; z < chunks; z++) { chunkGeneratorQueue.Enqueue(new ChunkCoordinates(x, z)); } } Stopwatch timer = Stopwatch.StartNew(); foreach (var thread in threads) { thread.Start(); } int threadsAlive = 0; do { threadsAlive = threads.Count(x => x.IsAlive); Console.Clear(); Console.WriteLine($"Threads: {threadsAlive} Queued: {chunkGeneratorQueue.Count} Generated: {chunskGenerated} Avg: {average / Math.Max(1, chunskGenerated)}ms Min: {min}ms Max: {max}ms"); Console.WriteLine($"Processed: {Imaged} Remaining: {Finished.Count}"); Thread.Sleep(100); } while (threadsAlive > 0); timer.Stop(); Console.Clear(); Console.WriteLine($"Generating {chunks * chunks} chunks took: {timer.Elapsed}"); Console.WriteLine($"Min Height: {gen.MinHeight} Max Height: {gen.MaxHeight}"); }
public abstract float Added(OverworldGeneratorV2 generator, float x, float y);
public void Replace(ChunkColumn primer, BlockCoordinates blockPos, int x, int y, int depth, OverworldGeneratorV2 generator, float[] noise, float river, BiomeBase[] biomes) { Replace(primer, blockPos.X, blockPos.Z, x, y, depth, generator, noise, river, biomes); }
public void Replace(ChunkColumn primer, int blockX, int blockZ, int x, int y, int depth, OverworldGeneratorV2 generator, float[] noise, float river, BiomeBase[] biomes) { /* if (RTG.surfacesDisabled() || this.getConfig().DISABLE_RTG_SURFACES.get()) * { * return; * } */ if (this.Surface == null) { return; } float riverRegion = !this.Config.AllowRivers ? 0f : river; this.Surface.PaintTerrain(primer, blockX, blockZ, x, y, depth, generator, noise, riverRegion, biomes); }
//private static ConcurrentQueue<ChunkColumn> Finished = new ConcurrentQueue<ChunkColumn>(); static void Main(string[] args) { WorldGen = new OverworldGeneratorV2(); Game = new TestGame(WorldGen, Radius, Resolution); // gen.ApplyBlocks = true; bool done = false; // ChunkColumn[] generatedChunks = new ChunkColumn[chunks * chunks]; ConcurrentQueue <ChunkCoordinates> chunkGeneratorQueue = new ConcurrentQueue <ChunkCoordinates>(); long average = 0; long min = long.MaxValue; long max = long.MinValue; int chunskGenerated = 0; Thread[] threads = new Thread[Environment.ProcessorCount / 2]; for (int t = 0; t < threads.Length; t++) { threads[t] = new Thread(() => { Stopwatch timing = new Stopwatch(); while (true) { if (chunkGeneratorQueue.TryDequeue(out var coords)) { timing.Restart(); // ChunkColumn column = WorldGen.GenerateChunkColumn(coords); NoiseData nd = new NoiseData(); nd.X = coords.X; nd.Z = coords.Z; nd.Chunk = WorldGen.GenerateChunkColumn(coords); /* for (int x = 0; x < 16; x++) * { * for (int z = 0; z < 16; z++) * { * var index = NoiseMap.GetIndex(x, z); * var temp = WorldGen.TemperatureNoise.GetValue((coords.X * 16) + x, (coords.Z * 16) + z) + 1f; * var rain = MathF.Abs(WorldGen.RainfallNoise.GetValue((coords.X * 16) + x, (coords.Z * 16) + z)); * * nd.Temperature[index] = temp; * nd.Humidity[index] = rain; * } * } */ lock (Game.Lock) { Game.Chunks.Add(nd); } // generatedChunks[(coords.X * chunks) + coords.Z] = column; // Finished.Enqueue(column); chunskGenerated++; timing.Stop(); average += timing.ElapsedMilliseconds; if (timing.ElapsedMilliseconds < min) { min = timing.ElapsedMilliseconds; } if (timing.ElapsedMilliseconds > max) { max = timing.ElapsedMilliseconds; } } else { break; } } }); } // threads[0] = new Thread(() => { GenerateBiomeMap(chunks); }); for (int z = 0; z < Radius; z += Resolution) { for (int x = 0; x < Radius; x += Resolution) { chunkGeneratorQueue.Enqueue(new ChunkCoordinates(x, z)); } } Stopwatch timer = Stopwatch.StartNew(); foreach (var thread in threads) { thread.Start(); } Game.Run(); timer.Stop(); Console.Clear(); Console.WriteLine($"Generating {Radius * Radius} chunks took: {timer.Elapsed}"); //Console.WriteLine($"Min Height: {gen.MinHeight} Max Height: {gen.MaxHeight}"); }
/// <inheritdoc /> public override void PaintTerrain(ChunkColumn column, int blockX, int blockZ, int x, int z, int depth, OverworldGeneratorV2 generator, float[] noise, float river, BiomeBase[] biomes) { var simplex = generator.SimplexInstance(0); float p = simplex.GetValue(blockX / 8f, blockZ / 8f) * 0.5f; float c = TerrainBase.CalcCliff(x, z, noise); int cliff = 0; Block b; for (int y = 255; y > -1; y--) { b = column.GetBlockObject(x, y, z); if (b is Air) { depth = -1; } else if (b is Stone) { depth++; if (depth == 0) { if (c > 0.45f && c > 1.5f - ((y - 60f) / 65f) + p) { cliff = 1; } if (c > 1.5f) { cliff = 2; } if (y > 110 + (p * 4) && c < 0.3f + ((y - 100f) / 50f) + p) { cliff = 3; } if (cliff == 1) { if (Rnd.Next(3) == 0) { column.SetBlock(x, y, z, CliffCobbleBlock); } else { column.SetBlock(x, y, z, CliffStoneBlock); } } else if (cliff == 2) { column.SetBlock(x, y, z, ShadowStoneBlock); } else if (cliff == 3) { column.SetBlock(x, y, z, new Snow()); } else if (simplex.GetValue(blockX / 50f, blockZ / 50f) + p * 0.6f > 0.24f) { column.SetBlock(x, y, z, MixBlock); } else { column.SetBlock(x, y, z, new Grass()); } } else if (depth < 6) { if (cliff == 1) { column.SetBlock(x, y, z, CliffStoneBlock); } else if (cliff == 2) { column.SetBlock(x, y, z, ShadowStoneBlock); } else if (cliff == 3) { column.SetBlock(x, y, z, new Snow()); } else { column.SetBlock(x, y, z, new Dirt()); } } } } }
public virtual void PaintTerrain(ChunkColumn column, int blockX, int blockZ, int x, int z, int depth, OverworldGeneratorV2 generator, float[] noise, float river, BiomeBase[] biomes) { // float c = TerrainBase.CalcCliff(x, z, noise); // bool cliff = c > 1.4f; for (int y = 255; y > -1; y--) { Block b = column.GetBlockObject(x, y, z); if (b is Air) { depth = -1; } else if (b is Stone) { depth++; if (depth == 0 && y > generator.Preset.SeaLevel - 2) { column.SetBlock(x, y, z, TopBlock); } else if (depth < 4) { column.SetBlock(x, y, z, FillerBlock); } } /*else if (b is Water && y >= generator.Preset.SeaLevel) * { * if ((biomes[NoiseMap.GetIndex(x, z)].Type & BiomeType.Snowy) != 0) * { * column.SetBlock(x,y,z, new Ice()); * } * }*/ } /*for (int y = 255; y > -1; y--) { * Block b = column.GetBlockObject(x, y, z); * if (b is Air) { * depth = -1; * } * else if (b is Stone) { * depth++; * * if (cliff) { * if (depth > -1 && depth < 2) { * if (Rnd.Next(3) == 0) { * * column.SetBlock(x, y, z, CliffCobbleBlock); * } * else { * * column.SetBlock(x, y, z, CliffStoneBlock); * } * } * else if (depth < 10) { * column.SetBlock(x, y, z, CliffStoneBlock); * } * } * else { * if (depth == 0 && y > 61) { * column.SetBlock(x, y, z, TopBlock); * } * else if (depth < 4) { * column.SetBlock(x, y, z, FillerBlock); * } * } * } * }*/ }
public static float TerrainBeach(int x, int y, OverworldGeneratorV2 generator, float river, float baseHeight) { return(Riverized(generator, baseHeight + GetGroundNoise(x, y, 4f, generator), river)); }
public static float GetTerrainBase(OverworldGeneratorV2 generator, float river) { return(generator.Preset.GetTerrainBase() * river); }
protected void ReplaceWithRiver(ChunkColumn primer, int i, int j, int x, int y, int depth, OverworldGeneratorV2 generator, float[] noise, float river, BiomeBase[] biomes) { // if (RTG.surfacesDisabled() || this.getConfig().DISABLE_RTG_SURFACES.get()) // { // return; // } float riverRegion = !this.Config.AllowRivers ? 0f : river; this.Surface.PaintTerrain(primer, i, j, x, y, depth, generator, noise, riverRegion, biomes); //this.surfaceRiver.paintTerrain(primer, i, j, x, y, depth, generator, noise, riverRegion, biomes); /* if (RTGConfig.lushRiverbanksInDesert()) * { * this.surfaceRiver.paintTerrain(primer, i, j, x, y, depth, generator, noise, riverRegion, biomes); * }*/ }
public override float GenerateNoise(OverworldGeneratorV2 generator, int x, int y, float border, float river) { //return Riverized(65f + _groundEffect.Added(world, x, y), river); return(TerrainPlains(x, y, generator, river, 160f, 10f, 60f, 200f, generator.Preset.SeaLevel + 4)); }
public static float TerrainOceanCanyon(int x, int y, OverworldGeneratorV2 generator, float river, float[] height, float border, float strength, int heightLength, bool booRiver) { //float b = simplex.GetValue(x / cWidth, y / cWidth) * cHeigth * river; //b *= b / cStrength; var simplex = generator.SimplexInstance(0); river *= 1.3f; river = river > 1f ? 1f : river; float r = simplex.GetValue(x / 100f, y / 100f) * 50f; r = r <-7.4f ? -7.4f : r> 7.4f ? 7.4f : r; float b = (17f + r) * river; float hn = simplex.GetValue(x / 12f, y / 12f) * 0.5f; float sb = 0f; if (b > 0f) { sb = b; sb = sb > 7f ? 7f : sb; sb = hn * sb; } b += sb; float cTotal = 0f; float cTemp; for (int i = 0; i < heightLength; i += 2) { cTemp = 0; if (b > height[i] && border > 0.6f + (height[i] * 0.015f) + hn * 0.2f) { cTemp = b > height[i] + height[i + 1] ? height[i + 1] : b - height[i]; cTemp *= strength; } cTotal += cTemp; } float bn = 0f; if (booRiver) { if (b < 5f) { bn = 5f - b; for (int i = 0; i < 3; i++) { bn *= bn / 4.5f; } } } else if (b < 5f) { bn = (simplex.GetValue(x / 7f, y / 7f) * 1.3f + simplex.GetValue(x / 15f, y / 15f) * 2f) * (5f - b) * 0.2f; } b += cTotal - bn; float floNoise = 30f + b; floNoise = floNoise < _minimumOceanFloor ? _minimumOceanFloor : floNoise; return(floNoise); }
public override float Added(OverworldGeneratorV2 generator, float x, float y) { return(TerrainBase.GetGroundNoise(x, y, amplitude, generator)); }
public abstract float GenerateNoise(OverworldGeneratorV2 generator, int x, int y, float border, float river);
/// <inheritdoc /> public override void PaintTerrain(ChunkColumn column, int blockX, int blockZ, int x, int z, int depth, OverworldGeneratorV2 generator, float[] noise, float river, BiomeBase[] biomes) { float c = TerrainBase.CalcCliff(x, z, noise); bool cliff = c > 1.3f; Block b; for (int k = 255; k > -1; k--) { b = column.GetBlockObject(x, k, z); if (b is Air) { depth = -1; } else if (b is Stone) { depth++; if (cliff) { column.SetBlock(x, k, z, PlateauBlocks[k % PlateauBlocks.Length]); } else { if (k > 74 + grassRaise) { if (depth == 0) { if (Rnd.Next(5) == 0) { column.SetBlock(x, k, z, mix2Block); } else { column.SetBlock(x, k, z, TopBlock); } } else if (depth < 4) { column.SetBlock(x, k, z, FillerBlock); } } else if (depth == 0 && k > 61) { int r = (int)((k - (62 + grassRaise)) / 2f); if (Rnd.Next(r + 2) == 0) { column.SetBlock(x, k, z, mixBlock); } else if (Rnd.Next((int)(r / 2f) + 2) == 0) { column.SetBlock(x, k, z, mix2Block); } else { column.SetBlock(x, k, z, TopBlock); } } else if (depth < 4) { column.SetBlock(x, k, z, FillerBlock); } } } } }
public override float GenerateNoise(OverworldGeneratorV2 generator, int x, int y, float border, float river) { return(TerrainPlateau(x, y, generator, river, height, border, strength, heightLength, 50f, true)); }
/// <inheritdoc /> public override void PaintTerrain(ChunkColumn column, int blockX, int blockZ, int x, int z, int depth, OverworldGeneratorV2 generator, float[] noise, float river, BiomeBase[] biomes) { FastRandom rand = new FastRandom(); var simplex = generator.SimplexInstance(0); float c = TerrainBase.CalcCliff(x, z, noise); bool cliff = c > 1.4f; for (int y = 255; y > -1; y--) { Block b = column.GetBlockObject(x, y, z); if (b is Air) { depth = -1; } else if (b is Stone) { depth++; if (cliff) { if (depth > -1 && depth < 2) { if (rand.Next(3) == 0) { column.SetBlock(x, y, z, CliffCobbleBlock); } else { column.SetBlock(x, y, z, CliffStoneBlock); } } else if (depth < 10) { column.SetBlock(x, y, z, CliffStoneBlock); } } else { if (depth == 0 && y > 61) { if (simplex.GetValue(blockX / width, blockZ / width) > height) // > 0.27f, i / 12f { column.SetBlock(x, y, z, mixBlock); } else { column.SetBlock(x, y, z, TopBlock); } } else if (depth < 4) { column.SetBlock(x, y, z, FillerBlock); } } } } }
/// <inheritdoc /> public override float GenerateNoise(OverworldGeneratorV2 generator, int x, int y, float border, float river) { return(TerrainMarsh(x, y, generator, generator.Preset.SeaLevel - .5f, river)); }
/// <inheritdoc /> public override void PaintTerrain(ChunkColumn column, int blockX, int blockZ, int x, int z, int depth, OverworldGeneratorV2 generator, float[] noise, float river, BiomeBase[] biomes) { var simplex = generator.SimplexInstance(0); float c = TerrainBase.CalcCliff(x, z, noise); int cliff = 0; bool m = false; Block b; for (int k = 255; k > -1; k--) { b = column.GetBlockObject(x, k, z); if (b is Air) { depth = -1; } else if (b is Stone) { depth++; if (depth == 0) { float p = simplex.GetValue(blockX / 8f, blockZ / 8f, k / 8f) * 0.5f; if (c > min && c > sCliff - ((k - sHeight) / sStrength) + p) { cliff = 1; } if (c > cCliff) { cliff = 2; } if (cliff == 1) { if (Rnd.Next(3) == 0) { column.SetBlock(x, k, z, CliffCobbleBlock); } else { column.SetBlock(x, k, z, CliffStoneBlock); } } else if (cliff == 2) { column.SetBlock(x, k, z, ShadowStoneBlock); } else if (k < 63) { if (k < 62) { column.SetBlock(x, k, z, FillerBlock); } else { column.SetBlock(x, k, z, TopBlock); } } else if (simplex.GetValue(blockX / 12f, blockZ / 12f) > mixHeight) { column.SetBlock(x, k, z, mixBlock); m = true; } else { column.SetBlock(x, k, z, TopBlock); } } else if (depth < 6) { if (cliff == 1) { column.SetBlock(x, k, z, CliffStoneBlock); } else if (cliff == 2) { column.SetBlock(x, k, z, ShadowStoneBlock); } else { column.SetBlock(x, k, z, FillerBlock); } } } } }