WAAAAAAVVVVVSSSSSS

This commit is contained in:
Daniel Mills 2020-01-02 01:09:10 -05:00
parent fd16fd2890
commit 92ce6e5a8d
8 changed files with 94 additions and 154 deletions

View File

@ -15,7 +15,6 @@ import ninja.bytecode.iris.gen.GenLayerBase;
import ninja.bytecode.iris.gen.GenLayerBiome;
import ninja.bytecode.iris.gen.GenLayerLayeredNoise;
import ninja.bytecode.iris.gen.GenLayerRidge;
import ninja.bytecode.iris.pop.PopulatorLakes;
import ninja.bytecode.iris.pop.PopulatorTrees;
import ninja.bytecode.shuriken.collections.GList;
import ninja.bytecode.shuriken.collections.GMap;
@ -106,7 +105,7 @@ public class IrisGenerator extends ParallelChunkGenerator
private double getBilinearNoise(int x, int z)
{
int h = 3;
int h = 5;
int fx = x >> h;
int fz = z >> h;
int xa = (fx << h) - 2;
@ -125,7 +124,7 @@ public class IrisGenerator extends ParallelChunkGenerator
private double getBicubicNoise(int x, int z)
{
int h = 3;
int h = 5;
int fx = x >> h;
int fz = z >> h;
int xa = (fx << h);
@ -193,6 +192,15 @@ public class IrisGenerator extends ParallelChunkGenerator
mb = BEDROCK;
}
if(i == height - 1 && i < 66 + (glBase.scatter(wx, i, wz) * 2) && i > 59)
{
mb = MB.of(Material.SAND);
setBlock(x, i+1, z, Material.AIR);
setBlock(x, i-1, z, mb.material, mb.data);
setBlock(x, i-2, z, mb.material, mb.data);
setBlock(x, i-3, z, mb.material, mb.data);
}
setBlock(x, i, z, mb.material, mb.data);
}
@ -204,7 +212,6 @@ public class IrisGenerator extends ParallelChunkGenerator
{
GList<BlockPopulator> p = new GList<BlockPopulator>();
p.add(new PopulatorTrees());
p.add(new PopulatorLakes());
return p;
}

View File

@ -9,7 +9,6 @@ import org.bukkit.block.Biome;
import org.bukkit.generator.ChunkGenerator;
import ninja.bytecode.iris.atomics.AtomicChunkData;
import ninja.bytecode.iris.pop.PopulatorLakes;
import ninja.bytecode.iris.pop.PopulatorTrees;
import ninja.bytecode.shuriken.Shuriken;
import ninja.bytecode.shuriken.collections.GList;
@ -55,15 +54,15 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
cg = 0;
}
double total = rs.getAverage() + PopulatorTrees.timings.getAverage() + PopulatorLakes.timings.getAverage();
double total = rs.getAverage() + PopulatorTrees.timings.getAverage();
double rcs = (1000D / total);
double work = cps.getAverage() / (rcs + 1);
L.i("Terrain Gen for " + world.getName());
L.i("- Terrain (MLTC): " + F.duration(rs.getAverage(), 2));
L.i("- Trees (SGLC): " + F.duration(PopulatorTrees.timings.getAverage(), 2));
L.i("- Lakes (SGLC): " + F.duration(PopulatorLakes.timings.getAverage(), 2));
L.i("Total: " + F.duration(total, 3) + " Work: " + F.f(cps.getAverage(), 0) + "/s of " + F.f(rcs, 0) + "/s (" + F.pc(work, 0) + " utilization)");
L.flush();
System.out.println("");
});

View File

@ -14,16 +14,16 @@ public class Settings
public static class GeneratorSettings
{
public double horizontalZoom = 2.225; // 1.856 2.556
public double horizontalZoom = 0.525; // 2.225 - 1.625 (big)
public double heightFracture = 155;
public double heightMultiplier = 1.154;
public double heightMultiplier = 0.806;
public double heightExponentBase = 1;
public double heightExponentMultiplier = 1.41;
public double heightScale = 1;
public double superHeightScale = 0.65;
public double baseHeight = 0.165;
public int seaLevel = 63;
public double biomeScale = 2.41;
public double biomeScale = 2.46;
public boolean flatBedrock = false;
}
}

View File

@ -20,6 +20,8 @@ public class CBI
//@builder
public static final CBI RIVER = new CBI("River", Biome.RIVER)
.surface(MB.of(Material.SAND));
public static final CBI BEACH = new CBI("Beach", Biome.BEACHES)
.surface(MB.of(Material.SAND));
public static final CBI ROAD_GRAVEL = new CBI("Gravel Road", Biome.PLAINS)
.surface(MB.of(Material.GRAVEL), MB.of(Material.COBBLESTONE))
.scatter(MB.of(Material.TORCH), 0.05);
@ -27,22 +29,24 @@ public class CBI
.surface(MB.of(Material.GRASS_PATH))
.scatter(MB.of(Material.TORCH), 0.05);
public static final CBI OCEAN = new CBI("Ocean", Biome.OCEAN)
.surface(MB.of(Material.SAND))
.height(-0.07);
.surface(MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.CLAY), MB.of(Material.GRAVEL))
.simplexSurface()
.height(-0.03);
public static final CBI DEEP_OCEAN = new CBI("Deep Ocean", Biome.DEEP_OCEAN)
.surface(MB.of(Material.SAND))
.surface(MB.of(Material.SAND), MB.of(Material.CLAY), MB.of(Material.GRAVEL))
.simplexSurface()
.height(-0.07);
public static final CBI DESERT = new CBI("Desert", Biome.DESERT)
.surface(MB.of(Material.SAND))
.scatter(MB.of(Material.DEAD_BUSH, 0), 0.08)
.scatter(MB.of(Material.DEAD_BUSH, 0), 0.008)
.dirt(MB.of(Material.SANDSTONE));
public static final CBI DESERT_RED = new CBI("Red Desert", Biome.DESERT)
.surface(MB.of(Material.SAND, 1))
.scatter(MB.of(Material.DEAD_BUSH, 0), 0.08)
.scatter(MB.of(Material.DEAD_BUSH, 0), 0.008)
.dirt(MB.of(Material.RED_SANDSTONE));
public static final CBI DESERT_COMBINED = new CBI("Combined Desert", Biome.DESERT)
.surface(MB.of(Material.SAND), MB.of(Material.SAND, 1))
.scatter(MB.of(Material.DEAD_BUSH, 0), 0.08)
.scatter(MB.of(Material.DEAD_BUSH, 0), 0.008)
.dirt(MB.of(Material.SANDSTONE), MB.of(Material.RED_SANDSTONE))
.simplexSurface();
public static final CBI DESERT_HILLS = new CBI("Desert Hills", Biome.DESERT_HILLS)
@ -63,16 +67,17 @@ public class CBI
.amp(0.75);
public static final CBI JUNGLE = new CBI("Jungle", Biome.JUNGLE)
.scatter(MB.of(Material.LONG_GRASS, 1), 0.058)
.tree(TreeType.JUNGLE, 0.8)
.tree(TreeType.JUNGLE, 0.9)
.tree(TreeType.JUNGLE_BUSH, 0.3)
.tree(TreeType.SMALL_JUNGLE, 0.1)
.scatter(MB.of(Material.LONG_GRASS, 2), 0.013);
public static final CBI JUNGLE_HILLS = new CBI("Jungle Hills", Biome.JUNGLE_HILLS)
.scatter(MB.of(Material.LONG_GRASS, 1), 0.081)
.tree(TreeType.JUNGLE, 0.8)
.tree(TreeType.JUNGLE, 0.9)
.tree(TreeType.JUNGLE_BUSH, 0.3)
.tree(TreeType.SMALL_JUNGLE, 0.1)
.amp(0.75)
.amp(1.75)
.height(0.166)
.scatter(MB.of(Material.LONG_GRASS, 2), 0.02);
public static final CBI SWAMP = new CBI("Swamp", Biome.SWAMPLAND)
.scatter(MB.of(Material.LONG_GRASS, 1), 0.04)
@ -95,6 +100,24 @@ public class CBI
.amp(0.75)
.tree(TreeType.TREE, 0.7)
.scatter(MB.of(Material.LONG_GRASS, 2), 0.13);
public static final CBI FOREST_MOUNTAINS = new CBI("Forest Mountains", Biome.MUTATED_EXTREME_HILLS_WITH_TREES)
.scatter(MB.of(Material.LONG_GRASS, 1), 0.13)
.amp(2.25)
.height(0.265)
.tree(TreeType.MEGA_REDWOOD, 0.5)
.tree(TreeType.TALL_REDWOOD, 0.7)
.scatter(MB.of(Material.LONG_GRASS, 2), 0.13);
public static final CBI HAUNTED_FOREST = new CBI("Haunted Forest", Biome.MUTATED_SWAMPLAND)
.scatter(MB.of(Material.LONG_GRASS, 1), 0.13)
.tree(TreeType.JUNGLE_BUSH, 0.5)
.tree(TreeType.BIG_TREE, 0.4)
.tree(TreeType.SWAMP, 0.4)
.tree(TreeType.JUNGLE, 0.4)
.tree(TreeType.SMALL_JUNGLE, 0.4)
.tree(TreeType.JUNGLE_BUSH, 0.5)
.scatter(MB.of(Material.LONG_GRASS, 2), 0.13)
.surface(MB.of(Material.GRASS), MB.of(Material.GRASS), MB.of(Material.GRASS), MB.of(Material.GRASS), MB.of(Material.DIRT), MB.of(Material.DIRT, 1), MB.of(Material.DIRT, 2))
.scatterSurface();
public static final CBI BIRCH_FOREST = new CBI("Birch Forest", Biome.BIRCH_FOREST)
.scatter(MB.of(Material.LONG_GRASS, 1), 0.23)
.tree(TreeType.BIRCH, 0.7)
@ -109,21 +132,21 @@ public class CBI
.tree(TreeType.DARK_OAK, 0.9)
.scatter(MB.of(Material.LONG_GRASS, 2), 0.13);
public static final CBI TAIGA = new CBI("Taiga", Biome.TAIGA)
.tree(TreeType.REDWOOD, 0.4)
.scatter(MB.of(Material.LONG_GRASS, 2), 0.07);
public static final CBI EXTREME_HILLS = new CBI("Extreme Hills", Biome.EXTREME_HILLS)
.scatter(MB.of(Material.LONG_GRASS, 2), 0.04);
.scatter(MB.of(Material.LONG_GRASS, 2), 0.04)
.amp(1.565)
.height(0.22);
public static final CBI EXTREME_HILLS_TREES = new CBI("Extreme Hills +", Biome.EXTREME_HILLS_WITH_TREES)
.scatter(MB.of(Material.LONG_GRASS, 2), 0.09)
.tree(TreeType.REDWOOD, 0.1)
.amp(1.25);
.amp(1.525)
.height(0.22);
public static final CBI TAIGA_COLD = new CBI("Taiga Cold", Biome.TAIGA_COLD)
.tree(TreeType.REDWOOD, 0.3)
.scatter(MB.of(Material.LONG_GRASS, 2), 0.04);
public static final CBI TAIGA_COLD_HILLS = new CBI("Taiga Cold Hills", Biome.TAIGA_COLD_HILLS)
.tree(TreeType.REDWOOD, 0.15).amp(0.75);
public static final CBI ICE_FLATS = new CBI("Ice Flats", Biome.ICE_FLATS);
public static final CBI ICE_MOUNTAINS = new CBI("Ice Mountains", Biome.ICE_MOUNTAINS)
@ -149,6 +172,7 @@ public class CBI
private GList<MB> surface;
private GList<MB> dirt;
private GMap<MB, Double> scatterChance;
private boolean scatterSurface;
private boolean simplexScatter;
private GMap<String, Double> schematicGroups;
private PolygonGenerator.EnumPolygonGenerator<MB> poly;
@ -214,6 +238,12 @@ public class CBI
return this;
}
public CBI scatterSurface()
{
scatterSurface = true;
return this;
}
public CBI surface(MB... mbs)
{
surface = new GList<>(mbs);
@ -268,19 +298,34 @@ public class CBI
return dirt;
}
public MB getSurface(int wx, int wz, RNG rng)
public MB getSurface(int x, int z, RNG rng)
{
double wx = x + 1000D;
double wz = z + 1000D;
if(simplexScatter)
{
if(poly == null)
{
poly = new PolygonGenerator.EnumPolygonGenerator<MB>(rng, 0.05, 12, getSurface().toArray(new MB[getSurface().size()]), (g) ->
poly = new PolygonGenerator.EnumPolygonGenerator<MB>(rng, 0.25, 2, getSurface().toArray(new MB[getSurface().size()]), (g) ->
{
return g.fractureWith(new CNG(rng.nextRNG(), 1D, 2).scale(0.155), 24);
return g.fractureWith(new CNG(rng.nextRNG(), 1D, 2).scale(0.0155), 242);
});
}
return poly.getChoice(wx, wz);
return poly.getChoice(wx * 0.2D, wz * 0.2D);
}
if(scatterSurface)
{
if(poly == null)
{
poly = new PolygonGenerator.EnumPolygonGenerator<MB>(rng, 15.05, 2, getSurface().toArray(new MB[getSurface().size()]), (g) ->
{
return g.fractureWith(new CNG(rng.nextRNG(), 1D, 2).scale(0.0155), 224);
});
}
return poly.getChoice(wx * 0.2D, wz * 0.2D);
}
return getSurface().getRandom();

View File

@ -27,13 +27,15 @@ public class GenLayerBiome extends GenLayer
{
//@builder
super(iris, world, random, rng);
fracture = new CNG(rng.nextRNG(), 1D, 7).scale(0.004).fractureWith(new CNG(rng.nextRNG(), 1D, 3).scale(0.19), 277D);
fracture = new CNG(rng.nextRNG(), 1D, 24).scale(0.0021).fractureWith(new CNG(rng.nextRNG(), 1D, 12).scale(0.01), 12250);
factory = (g) -> g.fractureWith(new CNG(rng.nextRNG(), 1D, 4).scale(0.02), 56);
riverCheck = new CNG(rng.nextRNG(), 1D, 2).scale(0.00096);
pathCheck = new CNG(rng.nextRNG(), 1D, 1).scale(0.00096);
roads = new MaxingGenerator(rng.nextRNG(), 5, 0.00055, 8, factory);
biomeGenerator = new EnumMaxingGenerator<CBI>(rng.nextRNG(), 0.00755 * Iris.settings.gen.biomeScale, 1,
new CBI[] {
CBI.HAUNTED_FOREST,
CBI.FOREST_MOUNTAINS,
CBI.DESERT,
CBI.DESERT_HILLS,
CBI.MESA,
@ -67,8 +69,8 @@ public class GenLayerBiome extends GenLayer
public CBI getBiome(double xx, double zz)
{
double x = xx + (fracture.noise(zz, xx) * 866);
double z = zz - (fracture.noise(xx, zz) * 866);
double x = xx + (fracture.noise(zz, xx) * 1550D);
double z = zz - (fracture.noise(xx, zz) * 1550D);
if(riverCheck.noise(x, z) > 0.75)
{
@ -80,7 +82,7 @@ public class GenLayerBiome extends GenLayer
CBI cbi = biomeGenerator.getChoice(x, z);
if(pathCheck.noise(x, z) > 0.5)
if(pathCheck.noise(x, z) > 0.33)
{
CBI road = CBI.ROAD_GRAVEL;
@ -89,11 +91,10 @@ public class GenLayerBiome extends GenLayer
road = CBI.ROAD_GRASSY;
}
if(Math.abs(road.getHeight() - cbi.getHeight()) < 0.0001 && roads.hasBorder(4, 8, xx, zz))
if(Math.abs(road.getHeight() - cbi.getHeight()) < 0.0001 && roads.hasBorder(4, 3, xx, zz))
{
return road;
}
}
return cbi;

View File

@ -19,14 +19,14 @@ public class GenLayerFracture extends GenLayer
{
//@builder
super(iris, world, random, rng);
gen = new CNG(rng.nextRNG(), 1D, 4)
.scale(0.013)
gen = new CNG(rng.nextRNG(), 1D, 12)
.scale(0.023)
.fractureWith(new CNG(rng.nextRNG(), 1D, 1)
.scale(0.05), 25);
cond = new CNG(rng.nextRNG(), 1D, 4)
.scale(0.018)
.scale(0.05), 333);
cond = new CNG(rng.nextRNG(), 1D, 12)
.scale(0.038)
.fractureWith(new CNG(rng.nextRNG(), 1D, 1)
.scale(0.025), 9);
.scale(0.025), 299);
//@done
}

View File

@ -1,112 +0,0 @@
package ninja.bytecode.iris.pop;
import java.util.Random;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.generator.BlockPopulator;
import ninja.bytecode.shuriken.bench.PrecisionStopwatch;
import ninja.bytecode.shuriken.math.RollingSequence;
public class PopulatorLakes extends BlockPopulator
{
public static RollingSequence timings = new RollingSequence(512);
@Override
public void populate(World world, Random random, Chunk chunk)
{
PrecisionStopwatch f = PrecisionStopwatch.start();
if(random.nextInt(100) < 10)
{
Block block;
int chunkX = chunk.getX();
int chunkZ = chunk.getZ();
int X = chunkX * 16 + random.nextInt(15) - 8;
int Z = chunkZ * 16 + random.nextInt(15) - 8;
int Y;
for(Y = world.getMaxHeight() - 1; chunk.getBlock(X, Y, Z).getType() == Material.AIR; Y--)
;
Y -= 7;
block = world.getBlockAt(Z + 8, Y, Z + 8);
if(random.nextInt(100) < 90)
block.setType(Material.WATER);
else
block.setType(Material.LAVA);
boolean[] aboolean = new boolean[2048];
int i = random.nextInt(4) + 4;
int j, j1, k1;
for(j = 0; j < i; ++j)
{
double d0 = random.nextDouble() * 6.0D + 3.0D;
double d1 = random.nextDouble() * 4.0D + 2.0D;
double d2 = random.nextDouble() * 6.0D + 3.0D;
double d3 = random.nextDouble() * (16.0D - d0 - 2.0D) + 1.0D + d0 / 2.0D;
double d4 = random.nextDouble() * (8.0D - d1 - 4.0D) + 2.0D + d1 / 2.0D;
double d5 = random.nextDouble() * (16.0D - d2 - 2.0D) + 1.0D + d2 / 2.0D;
for(int k = 1; k < 15; ++k)
{
for(int l = 1; l < 15; ++l)
{
for(int i1 = 1; i1 < 7; ++i1)
{
double d6 = ((double) k - d3) / (d0 / 2.0D);
double d7 = ((double) i1 - d4) / (d1 / 2.0D);
double d8 = ((double) l - d5) / (d2 / 2.0D);
double d9 = d6 * d6 + d7 * d7 + d8 * d8;
if(d9 < 1.0D)
{
aboolean[(k * 16 + l) * 8 + i1] = true;
}
}
}
}
}
for(j = 0; j < 16; ++j)
{
for(k1 = 0; k1 < 16; ++k1)
{
for(j1 = 0; j1 < 8; ++j1)
{
if(aboolean[(j * 16 + k1) * 8 + j1])
{
world.getBlockAt(X + j, Y + j1, Z + k1).setType(j1 > 4 ? Material.AIR : block.getType());
}
}
}
}
for(j = 0; j < 16; ++j)
{
for(k1 = 0; k1 < 16; ++k1)
{
for(j1 = 4; j1 < 8; ++j1)
{
if(aboolean[(j * 16 + k1) * 8 + j1])
{
int X1 = X + j;
int Y1 = Y + j1 - 1;
int Z1 = Z + k1;
if(world.getBlockAt(X1, Y1, Z1).getType() == Material.DIRT)
{
world.getBlockAt(X1, Y1, Z1).setType(Material.GRASS, false);
}
}
}
}
}
}
f.end();
timings.put(f.getMilliseconds());
}
}