Skip to content

Commit

Permalink
Reduce threshold for unbuildable slope to prevent unbuildable hydro
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheikah45 committed Feb 14, 2021
1 parent eedb095 commit f7286bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/java/neroxis/generator/HydroGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vector2f> 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))));
});
}
Expand Down
7 changes: 4 additions & 3 deletions src/java/neroxis/generator/MapGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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))
Expand All @@ -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));
Expand Down

0 comments on commit f7286bc

Please sign in to comment.