Basic terrain shaping added.

World height shader "shades" the primitive island height giving variation to land and sea.

World layer shader "shades" the primitive islands with varying layers dependent on biomes.

Mapper values was changed to perform the more targetted task of generating island locations and masks.

Biome selector now takes a random at call to help with seed consistency (due to threading, this may still be problematic).

Chunk generator implements the new changes.

Tests implement new changes.
This commit is contained in:
2020-05-02 00:06:58 -05:00
parent a6cebe703b
commit 486a0f837f
8 changed files with 82 additions and 66 deletions

View File

@@ -3,6 +3,7 @@ package ca.recrown.islandsurvivalcraft.world.generation;
import static org.junit.jupiter.api.Assertions.assertFalse;
import java.util.LinkedList;
import java.util.Random;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -11,6 +12,7 @@ import java.util.concurrent.TimeUnit;
import org.bukkit.block.Biome;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
@@ -30,6 +32,9 @@ public class UniBiomeIslandGeneratorTest {
private volatile Cache<Point2, Double> blockValueCache;
private volatile Cache<Point2, Biome[]> biomeCache;
private volatile Cache<Point2, Boolean> chunkExistenceCache;
private final BiomeSelector biomeSelector = new BiomeSelector();
private final Random random = new Random(SEED);
private class BiomeGenTask implements Runnable {
private final int amount;
@@ -51,8 +56,6 @@ public class UniBiomeIslandGeneratorTest {
public void generateBiome(int chunkX, int chunkZ) {
IslandWorldMapper mapper = new IslandWorldMapper(SEED, blockValueCache);
TemperatureMapGenerator temperatureMapGenerator = new TemperatureMapGenerator(SEED);
BiomeSelector biomeSelector = new BiomeSelector();
biomeSelector.initialize();
BiomeGenerator biomeGenerator = new UniBiomeIslandGenerator();
Biome[][] biomes = new Biome[Utilities.CHUNK_SIZE][Utilities.CHUNK_SIZE];
@@ -60,7 +63,7 @@ public class UniBiomeIslandGeneratorTest {
for (int localZ = 0; localZ < Utilities.CHUNK_SIZE; localZ++) {
if (biomes[localX][localZ] == null) {
biomeGenerator.generateBiomeColumn(biomes, dummyWorld, chunkX, chunkZ, localX, localZ, mapper,
biomeSelector, temperatureMapGenerator, biomeCache, chunkExistenceCache);
biomeSelector, temperatureMapGenerator, biomeCache, chunkExistenceCache, random);
}
if (biomes[localX][localZ] == null)
throw new IllegalStateException("Biome was null.");
@@ -68,6 +71,11 @@ public class UniBiomeIslandGeneratorTest {
}
}
}
@BeforeAll
public void setup() {
biomeSelector.initialize();
}
@BeforeEach
public void individualSetup() {