From d6bbb9d8dc441c8a9ccd753e042befab73b6a87a Mon Sep 17 00:00:00 2001 From: tom lee Date: Mon, 24 Jan 2022 23:02:53 +0800 Subject: [PATCH] Updated core and followed with some tweaks for FAR_FRIST gen --- .../ExperimentalGenerator.java | 55 +++++++++++++++++-- .../worldGeneration/WorldGenerationStep.java | 2 +- core | 2 +- 3 files changed, 53 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/ExperimentalGenerator.java b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/ExperimentalGenerator.java index 1dfed7493..005003168 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/ExperimentalGenerator.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/ExperimentalGenerator.java @@ -46,7 +46,6 @@ public class ExperimentalGenerator extends AbstractExperimentalWorldGeneratorWra public WorldGenerationStep generationGroup; public LodDimension targetLodDim; public static final int generationGroupSize = 4; - public static final int generationGroupSizeFar = 0; public static int previousThreadCount = CONFIG.client().advanced().threading().getNumberOfWorldGenerationThreads(); private int estimatedSampleNeeded = 128; @@ -142,8 +141,11 @@ public class ExperimentalGenerator extends AbstractExperimentalWorldGeneratorWra assert false; return; } - + + if (ENABLE_GENERATOR_STATS_LOGGING) + ClientApi.LOGGER.info("WorldGen. Near:"+posToGenerate.getNumberOfNearPos()+" Far:"+posToGenerate.getNumberOfFarPos()); if (priority == GenerationPriority.FAR_FIRST) { + int nearCount = posToGenerate.getNumberOfNearPos(); int farCount = posToGenerate.getNumberOfFarPos(); if (ENABLE_GENERATOR_STATS_LOGGING) @@ -159,10 +161,13 @@ public class ExperimentalGenerator extends AbstractExperimentalWorldGeneratorWra byte detailLevel = (byte) (posToGenerate.getNthDetail(i, false) - 1); int chunkX = LevelPosUtil.getChunkPos(detailLevel, posToGenerate.getNthPosX(i, false)); int chunkZ = LevelPosUtil.getChunkPos(detailLevel, posToGenerate.getNthPosZ(i, false)); - if (generationGroup.tryAddPoint(chunkX, chunkZ, generationGroupSizeFar, targetStep)) { + int genSize = detailLevel > LodUtil.CHUNK_DETAIL_LEVEL ? 0 : generationGroupSize; + if (generationGroup.tryAddPoint(chunkX, chunkZ, genSize, targetStep)) { toGenerate--; } } + if (toGenerate <= 0) + break; // We have nearPos to go though if (i < nearCount && posToGenerate.getNthDetail(i, true) != 0) { @@ -181,6 +186,47 @@ public class ExperimentalGenerator extends AbstractExperimentalWorldGeneratorWra if (toGenerate <= 0) break; } + /* + int farCount = posToGenerate.getNumberOfFarPos(); + for (int i = 0; i < farCount; i++) { + + // We have nearPos to go though + if (posToGenerate.getNthDetail(i, false) != 0) { + positionGoneThough++; + // TODO: Add comment here on why theres a '-1'. + // Not sure what's happening here. This is copied from previous codes. + byte detailLevel = (byte) (posToGenerate.getNthDetail(i, false) - 1); + int chunkX = LevelPosUtil.getChunkPos(detailLevel, posToGenerate.getNthPosX(i, false)); + int chunkZ = LevelPosUtil.getChunkPos(detailLevel, posToGenerate.getNthPosZ(i, false)); + int genSize = detailLevel != 0 ? 0 : generationGroupSize; + if (generationGroup.tryAddPoint(chunkX, chunkZ, genSize, targetStep)) { + toGenerate--; + } + if (toGenerate <= 0) + break; + } + } + // Only do near gen if toGenerate is non 0 and that we have requested all samples we can get. + if (toGenerate > 0 && estimatedSampleNeeded > posToGenerate.getNumberOfPos()) { + int nearCount = posToGenerate.getNumberOfNearPos(); + for (int i = 0; i < nearCount; i++) { + // We have farPos to go though + if (posToGenerate.getNthDetail(i, true) != 0) { + positionGoneThough++; + // TODO: Add comment here on why theres a '-1'. + // Not sure what's happening here. This is copied from previous codes. + byte detailLevel = (byte) (posToGenerate.getNthDetail(i, true) - 1); + int chunkX = LevelPosUtil.getChunkPos(detailLevel, posToGenerate.getNthPosX(i, true)); + int chunkZ = LevelPosUtil.getChunkPos(detailLevel, posToGenerate.getNthPosZ(i, true)); + int genSize = detailLevel > LodUtil.CHUNK_DETAIL_LEVEL ? 0 : generationGroupSize; + if (generationGroup.tryAddPoint(chunkX, chunkZ, genSize, targetStep)) { + toGenerate--; + } + } + if (toGenerate <= 0) + break; + } + }*/ } else { int nearCount = posToGenerate.getNumberOfNearPos(); for (int i = 0; i < nearCount; i++) { @@ -213,7 +259,8 @@ public class ExperimentalGenerator extends AbstractExperimentalWorldGeneratorWra byte detailLevel = (byte) (posToGenerate.getNthDetail(i, false) - 1); int chunkX = LevelPosUtil.getChunkPos(detailLevel, posToGenerate.getNthPosX(i, false)); int chunkZ = LevelPosUtil.getChunkPos(detailLevel, posToGenerate.getNthPosZ(i, false)); - if (generationGroup.tryAddPoint(chunkX, chunkZ, generationGroupSizeFar, targetStep)) { + int genSize = detailLevel > LodUtil.CHUNK_DETAIL_LEVEL ? 0 : generationGroupSize; + if (generationGroup.tryAddPoint(chunkX, chunkZ, genSize, targetStep)) { toGenerate--; } } diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/WorldGenerationStep.java b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/WorldGenerationStep.java index 1330b2378..3d077f15a 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/WorldGenerationStep.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/WorldGenerationStep.java @@ -118,7 +118,7 @@ Lod Generation: 0.269023348s public final class WorldGenerationStep { public static final boolean ENABLE_PERF_LOGGING = false; - public static final boolean ENABLE_EVENT_LOGGING = false; + public static final boolean ENABLE_EVENT_LOGGING = true; //TODO: Make this LightMode a config //TODO: Make actual proper support for StarLight public static final LightMode DEFAULT_LIGHTMODE = LightMode.Fancy; diff --git a/core b/core index c3abb9c46..880be5ed6 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit c3abb9c46b4d60d84508837c89bcea75b1b6de6e +Subproject commit 880be5ed609b7e9877f7ba16f0f746e9d07f81d7