From f7286bc3d32fb90f1c60efc3cba1b354751d2bef Mon Sep 17 00:00:00 2001 From: Sheikah45 Date: Sat, 13 Feb 2021 22:15:38 -0500 Subject: [PATCH] Reduce threshold for unbuildable slope to prevent unbuildable hydro --- src/java/neroxis/generator/HydroGenerator.java | 2 +- src/java/neroxis/generator/MapGenerator.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/java/neroxis/generator/HydroGenerator.java b/src/java/neroxis/generator/HydroGenerator.java index 769df091..851b6845 100644 --- a/src/java/neroxis/generator/HydroGenerator.java +++ b/src/java/neroxis/generator/HydroGenerator.java @@ -59,7 +59,7 @@ public void generateIndividualHydros(BinaryMask spawnMask, int numHydros, int hy Marker hydro = new Marker(String.format("Hydro %d", hydroId), new Vector3f(location.add(.5f, .5f))); map.addHydro(hydro); ArrayList symmetryPoints = spawnMask.getSymmetryPoints(hydro.getPosition(), SymmetryType.SPAWN); - symmetryPoints.forEach(symmetryPoint -> symmetryPoint.roundToNearestHalfPoint()); + symmetryPoints.forEach(Vector2f::roundToNearestHalfPoint); symmetryPoints.forEach(symmetryPoint -> map.addHydro(new Marker(String.format("Hydro %d sym %d", hydroId, symmetryPoints.indexOf(symmetryPoint)), new Vector3f(symmetryPoint)))); }); } diff --git a/src/java/neroxis/generator/MapGenerator.java b/src/java/neroxis/generator/MapGenerator.java index 66b930d6..3c2733a9 100644 --- a/src/java/neroxis/generator/MapGenerator.java +++ b/src/java/neroxis/generator/MapGenerator.java @@ -714,7 +714,7 @@ public SCMap generate() throws IOException { Pipeline.await(resourceMask, plateaus, land, ramps, impassable, unbuildable, allWreckMask, waterResourceMask); long sTime = System.currentTimeMillis(); mexGenerator.generateMexes(resourceMask.getFinalMask(), waterResourceMask.getFinalMask()); - hydroGenerator.generateHydros(resourceMask.getFinalMask().deflate(4)); + hydroGenerator.generateHydros(resourceMask.getFinalMask().deflate(8)); generateExclusionMasks(); if (DEBUG) { System.out.printf("Done: %4d ms, %s, generateResources\n", @@ -1221,7 +1221,8 @@ private void setupHeightmapPipeline() { heightmapBase.add(heightmapLand); noise.addWhiteNoise(PLATEAU_HEIGHT * 2).resample(mapSize / 64).addWhiteNoise(PLATEAU_HEIGHT).resample(mapSize + 1) - .subtractAvg().clampMin(0f).setToValue(0f, land.copy().invert().inflate(8)).smooth(mapSize / 16); + .subtractAvg().clampMin(0f).setToValue(0f, land.copy().invert().inflate(8)).smooth(mapSize / 16, spawnLandMask.copy().inflate(8)) + .smooth(mapSize / 16, spawnPlateauMask.copy().inflate(8)).smooth(mapSize / 16); heightmapBase.add(waterHeight).add(noise).smooth(18, ramps.copy().acid(.001f, 4).erode(.25f, SymmetryType.SPAWN, 4)) .smooth(12, ramps.copy().inflate(8).acid(.01f, 4).erode(.25f, SymmetryType.SPAWN, 4)) @@ -1234,7 +1235,7 @@ private void setupHeightmapPipeline() { slope = heightmapBase.copy().supcomGradient(); impassable = new ConcurrentBinaryMask(slope, .75f, random.nextLong(), "impassable"); - unbuildable = new ConcurrentBinaryMask(slope, .2f, random.nextLong(), "unbuildable"); + unbuildable = new ConcurrentBinaryMask(slope, .15f, random.nextLong(), "unbuildable"); notFlat = new ConcurrentBinaryMask(slope, .05f, random.nextLong(), "notFlat"); unbuildable.combine(ramps.copy().intersect(notFlat));