Terrain feel: biome regions ~10x larger (Voronoi cell size 96->960); terrain height now eases across biome borders via a Voronoi distance blend (smooth, and ~25x cheaper than the old 169-sample box blur); mountains capped to ~2/3 world height and gentled (ridged amplitude/frequency lowered), snow line lowered to match. Centralization: ~27 world-gen/render tuning constants (biome amplitudes & frequencies, climate-noise frequencies/octaves, biome-selection thresholds, blend width, cell size, filler depth, snow line, camera near plane, spawn offset, overlay scale) hoisted from scattered literals into a region-organized, fully-commented Configuration. Configuration is threaded into NoiseSource, the biomes, BiomeRegistry, BiomeMap (+Classify), TerrainSampler, WorldGenerator (+BlockAt filler depth), and Camera via Player. Defaults equal the prior values, so generation is unchanged; worldgen tests updated for the new constructor signatures.
31 lines
870 B
C#
31 lines
870 B
C#
using VoxelEngine.Core;
|
|
using VoxelEngine.World.WorldGen;
|
|
using Xunit;
|
|
|
|
namespace VoxelEngine.Tests.WorldGen;
|
|
|
|
public class NoiseSourceTests
|
|
{
|
|
[Fact]
|
|
public void SameSeed_SameCoord_IsDeterministic()
|
|
{
|
|
var a = new NoiseSource(42, new Configuration());
|
|
var b = new NoiseSource(42, new Configuration());
|
|
Assert.Equal(a.Continent(10f, 20f), b.Continent(10f, 20f));
|
|
Assert.Equal(a.Temperature(10f, 20f), b.Temperature(10f, 20f));
|
|
}
|
|
|
|
[Fact]
|
|
public void Output_InMinusOneToOneRange()
|
|
{
|
|
var n = new NoiseSource(7, new Configuration());
|
|
for (int i = 0; i < 200; i++)
|
|
{
|
|
float c = n.Continent(i * 3.1f, i * 1.7f);
|
|
float t = n.Temperature(i * 2.3f, i * 0.9f);
|
|
Assert.InRange(c, -1.001f, 1.001f);
|
|
Assert.InRange(t, -1.001f, 1.001f);
|
|
}
|
|
}
|
|
}
|