Browse Source

Added random seed to randomize terrain generation

James Peret 2 years ago
parent
commit
0f9df3cfb9
3 changed files with 4 additions and 1 deletions
  1. 1 0
      ChangeLog.md
  2. 2 0
      Runtime/ChunkTerrainGenerator.cs
  3. 1 1
      package.json

+ 1 - 0
ChangeLog.md

@@ -2,6 +2,7 @@
 
 ### v0.0.2
 
+- Added random seed to randomize terrain generation
 - Added NavMeshComponents dependecy
 - Added OnChunkGenerated and OnTerrainGenerated Generic Events
 - Added support for building Navigation Meshes after the terrain is generated

+ 2 - 0
Runtime/ChunkTerrainGenerator.cs

@@ -32,6 +32,7 @@ namespace KairoEngine.TerrainEngine
         [BoxGroup("Configurations")] public bool showDebug = false;
         
         [InlineProperty, HideLabel, BoxGroup("Marching Cubes")] public MarchingCubes4 marchingCubes = new();
+        [BoxGroup("Map Data Generator")] public bool useRandomSeed = false;
         [BoxGroup("Map Data Generator"), InlineProperty, HideLabel, SerializeReference] public IMapDataGenerator mapDataGenerator;
         
         [ShowIf("@showChunkData"), BoxGroup("Chunk System"), InlineProperty, HideLabel] public ChunkSystem<BlockBase> chunkSystem;
@@ -83,6 +84,7 @@ namespace KairoEngine.TerrainEngine
         {
             chunkSystem = new ChunkSystem<BlockBase>(chunkSize,voxelSize, true);
             initialized = true;
+            if(useRandomSeed) mapDataGenerator.SetSeed(Random.Range(0, 100000));
         }
 
         public bool IsInitialized() => initialized;

+ 1 - 1
package.json

@@ -13,7 +13,7 @@
       "at.kairoscope.thirdparty.sirenix":"1.1.0",
       "at.kairoscope.kairoengine.core":"0.2.6",
       "at.kairoscope.kairoengine.chunks":"0.0.1",
-      "at.kairoscope.kairoengine.noise-utilities":"0.0.1",
+      "at.kairoscope.kairoengine.noise-utilities":"0.0.2",
       "com.unity.collections":"1.2.4",
       "at.kairoscope.thirdparty.unirx":"1.0.0",
       "at.kairoscope.kairoengine.game-tools":"0.1.3",