8 #include "../LinearUpscale.h"
9 #include "../IniFile.h"
30 std::make_shared<cProtIntGenWeightAvg<16, 1, 0>>(
31 std::make_shared<cProtIntGenSmooth> (a_Seed + 1,
32 std::make_shared<cProtIntGenZoom> (a_Seed + 2,
33 std::make_shared<cProtIntGenSmooth> (a_Seed + 3,
34 std::make_shared<cProtIntGenZoom> (a_Seed + 4,
35 std::make_shared<cProtIntGenAddRnd> (a_Seed + 5, 1,
36 std::make_shared<cProtIntGenSmooth> (a_Seed + 6,
37 std::make_shared<cProtIntGenZoom> (a_Seed + 7,
38 std::make_shared<cProtIntGenRndBetween> (a_Seed + 8, 60,
39 std::make_shared<cProtIntGenAddRnd> (a_Seed + 9, 1,
40 std::make_shared<cProtIntGenSmooth> (a_Seed + 1,
41 std::make_shared<cProtIntGenZoom> (a_Seed + 2,
42 std::make_shared<cProtIntGenRndBetween> (a_Seed + 3, 60,
43 std::make_shared<cProtIntGenSmooth> (a_Seed + 4,
44 std::make_shared<cProtIntGenZoom> (a_Seed + 5,
45 std::make_shared<cProtIntGenRndBetween> (a_Seed + 6, 60,
46 std::make_shared<cProtIntGenRndChoice> (a_Seed + 7, 10, 50, 50,
47 std::make_shared<cProtIntGenSmooth> (a_Seed + 8,
48 std::make_shared<cProtIntGenZoom> (a_Seed + 9,
49 std::make_shared<cProtIntGenRndChoice> (a_Seed + 1, 10, 50, 50,
50 std::make_shared<cProtIntGenAddRnd> (a_Seed + 2, 2,
51 std::make_shared<cProtIntGenZoom> (a_Seed + 3,
52 std::make_shared<cProtIntGenZoom> (a_Seed + 4,
53 std::make_shared<cProtIntGenChoice> (a_Seed + 5, 10)
54 )))))))))))))))))))))));
65 for (
size_t i = 0; i <
ARRAYCOUNT(heights); i++)
74 std::shared_ptr<cProtIntGen>
m_Gen;
87 for (
size_t i = 0; i <
ARRAYCOUNT(a_HeightMap); i++)
110 m_HeiGenToCache(a_HeiGenToCache),
111 m_CacheSize(a_CacheSize),
148 for (
size_t j = i; j > 0; j--)
155 memcpy(a_HeightMap,
m_CacheData[Idx].m_HeightMap,
sizeof(a_HeightMap));
173 memcpy(
m_CacheData[Idx].m_HeightMap, a_HeightMap,
sizeof(a_HeightMap));
223 m_NumSubCaches(a_NumSubCaches),
224 m_Underlying(
std::move(a_HeiGenToCache))
228 for (
size_t i = 0; i < a_NumSubCaches; i++)
244 m_SubCaches[cacheIdx]->GenHeightMap(a_ChunkCoords, a_HeightMap);
275 const size_t cacheIdx = (
static_cast<size_t>(a_ChunkX) +
m_CoeffZ *
static_cast<size_t>(a_ChunkZ)) %
m_NumSubCaches;
278 return m_SubCaches[cacheIdx]->GetHeightAt(a_ChunkX, a_ChunkZ, a_RelX, a_RelZ, a_Height);
313 flatness *= flatness * flatness;
315 return (oct1 + oct2 + oct3) * flatness + height;
360 m_MountainNoise(a_Seed + 100),
361 m_DitchNoise(a_Seed + 200),
362 m_Perlin(a_Seed + 300)
389 HEIGHTTYPE hei =
static_cast<HEIGHTTYPE>(
Clamp(100 -
static_cast<int>((MountainNoise[idx] - DitchNoise[idx] + PerlinNoise[idx]) * 15), 10, 250));
423 { 0.1f, 2.0f, 0.05f, 10.0f, 0.01f, 8.0f, 50},
424 { 0.1f, 1.0f, 0.05f, 1.5f, 0.01f, 4.0f, 68},
425 { 0.1f, 1.0f, 0.05f, 1.5f, 0.01f, 4.0f, 68},
426 { 0.2f, 4.0f, 0.05f, 20.0f, 0.01f, 16.0f, 100},
427 { 0.1f, 1.0f, 0.05f, 2.0f, 0.01f, 4.0f, 70},
428 { 0.1f, 1.0f, 0.05f, 2.0f, 0.01f, 4.0f, 70},
429 { 0.1f, 1.1f, 0.05f, 1.5f, 0.02f, 2.5f, 61.5},
430 { 0.2f, 0.1f, 0.05f, 0.1f, 0.01f, 0.1f, 56},
431 { 0.1f, 0.0f, 0.01f, 0.0f, 0.01f, 0.0f, 0},
432 { 0.1f, 0.0f, 0.01f, 0.0f, 0.01f, 0.0f, 0},
433 { 0.1f, 2.0f, 0.05f, 12.0f, 0.01f, 10.0f, 40},
434 { 0.2f, 0.1f, 0.05f, 0.1f, 0.01f, 0.1f, 56},
435 { 0.1f, 1.0f, 0.05f, 1.5f, 0.01f, 4.0f, 68},
436 { 0.2f, 2.0f, 0.05f, 10.0f, 0.01f, 8.0f, 80},
437 { 0.1f, 2.0f, 0.05f, 8.0f, 0.01f, 6.0f, 80},
438 { 0.1f, 1.0f, 0.05f, 2.0f, 0.01f, 4.0f, 64},
439 { 0.1f, 0.5f, 0.05f, 1.0f, 0.01f, 1.0f, 64},
440 { 0.2f, 2.0f, 0.05f, 5.0f, 0.01f, 4.0f, 75},
441 { 0.2f, 2.0f, 0.05f, 12.0f, 0.01f, 10.0f, 80},
442 { 0.2f, 2.0f, 0.05f, 12.0f, 0.01f, 10.0f, 80},
443 { 0.2f, 3.0f, 0.05f, 16.0f, 0.01f, 12.0f, 80},
444 { 0.1f, 3.0f, 0.05f, 6.0f, 0.01f, 6.0f, 70},
445 { 0.2f, 3.0f, 0.05f, 12.0f, 0.01f, 10.0f, 80},
446 { 0.1f, 3.0f, 0.05f, 6.0f, 0.01f, 6.0f, 70},
447 { 0.1f, 2.0f, 0.05f, 12.0f, 0.01f, 10.0f, 40},
448 { 0.1f, 2.0f, 0.05f, 12.0f, 0.01f, 10.0f, 40},
449 { 0.1f, 0.5f, 0.05f, 1.0f, 0.01f, 1.0f, 64},
450 { 0.1f, 1.0f, 0.05f, 2.0f, 0.01f, 4.0f, 70},
451 { 0.2f, 2.0f, 0.05f, 10.0f, 0.01f, 8.0f, 80},
452 { 0.1f, 1.0f, 0.05f, 2.0f, 0.01f, 4.0f, 70},
453 { 0.1f, 1.0f, 0.05f, 2.0f, 0.01f, 4.0f, 70},
454 { 0.2f, 2.0f, 0.05f, 10.0f, 0.01f, 8.0f, 80},
455 { 0.1f, 1.0f, 0.05f, 2.0f, 0.01f, 4.0f, 70},
456 { 0.2f, 2.0f, 0.05f, 10.0f, 0.01f, 8.0f, 80},
457 { 0.2f, 4.0f, 0.05f, 20.0f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 2.0f, 0.01f, 4.0f, 70},
500 { 0.2f, 2.0f, 0.05f, 10.0f, 0.01f, 8.0f, 80},
501 { 0.2f, 4.0f, 0.05f, 20.0f, 0.01f, 16.0f, 120},
502 { 0.1f, 1.0f, 0.05f, 1.5f, 0.01f, 4.0f, 68},
503 { 0.1f, 1.0f, 0.05f, 1.5f, 0.01f, 4.0f, 80},
504 { 0.2f, 2.0f, 0.1f, 30.0f, 0.01f, 8.0f, 80},
505 { 0.1f, 1.0f, 0.05f, 1.5f, 0.01f, 4.0f, 80},
506 { 0.1f, 1.0f, 0.05f, 1.5f, 0.01f, 4.0f, 80},
517 for (
int z = -1; z <= 1; z++)
519 for (
int x = -1; x <= 1; x++)
530 for (
int z = 0; z < 17; z += STEPZ)
532 for (
int x = 0; x < 17; x += STEPX)
537 LinearUpscale2DArrayInPlace<17, 17, STEPX, STEPZ>(Height);
565 int BiomeCounts[256];
566 memset(BiomeCounts, 0,
sizeof(BiomeCounts));
568 for (
int z = -8; z <= 8; z++)
573 int WeightZ = 9 - abs(z);
574 for (
int x = -8; x <= 8; x++)
580 int WeightX = 9 - abs(x);
581 BiomeCounts[Biome] += WeightX + WeightZ;
582 Sum += WeightX + WeightZ;
592 for (
size_t i = 0; i <
ARRAYCOUNT(BiomeCounts); i++)
594 if (BiomeCounts[i] == 0)
619 ASSERT(!
"cHeiGenBiomal: Biome sum failed, no known biome around");
666 for (
int z = 0; z < 3; z++)
for (
int x = 0; x < 3; x++)
679 double min = 0, max = 0;
753 case biBeach: a_Min = 61; a_Max = 64;
break;
763 case biDesert: a_Min = 63; a_Max = 70;
break;
765 case biDesertM: a_Min = 63; a_Max = 70;
break;
766 case biEnd: a_Min = 10; a_Max = 100;
break;
773 case biForest: a_Min = 63; a_Max = 75;
break;
780 case biJungle: a_Min = 60; a_Max = 80;
break;
784 case biJungleM: a_Min = 60; a_Max = 75;
break;
789 case biMesa: a_Min = 63; a_Max = 90;
break;
797 case biNether: a_Min = 10; a_Max = 100;
break;
798 case biOcean: a_Min = 45; a_Max = 64;
break;
799 case biPlains: a_Min = 63; a_Max = 70;
break;
800 case biRiver: a_Min = 60; a_Max = 62;
break;
803 case biSavanna: a_Min = 63; a_Max = 75;
break;
804 case biSavannaM: a_Min = 63; a_Max = 80;
break;
811 case biTaiga: a_Min = 63; a_Max = 75;
break;
813 case biTaigaM: a_Min = 63; a_Max = 80;
break;
838 if (HeightGenName.empty())
840 LOGWARN(
"[Generator] HeightGen value not set in world.ini, using \"Biomal\".");
841 HeightGenName =
"Biomal";
844 a_CacheOffByDefault =
false;
845 std::unique_ptr<cTerrainHeightGen> res;
848 res = std::make_unique<cHeiGenFlat>();
849 a_CacheOffByDefault =
true;
853 res = std::make_unique<cHeiGenClassic>(a_Seed);
855 else if (
NoCaseCompare(HeightGenName,
"DistortedHeightmap") == 0)
869 res = std::make_unique<cHeiGenMinMax>(a_Seed, a_BiomeGen);
873 res = std::make_unique<cHeiGenMountains>(a_Seed);
883 res = std::make_unique<cHeiGenSteppy>(a_Seed);
893 res = std::make_unique<cHeiGenBiomal>(a_Seed, a_BiomeGen);
911 LOGWARN(
"Unknown HeightGen \"%s\", using \"Biomal\" instead.", HeightGenName.c_str());
912 a_IniFile.
SetValue(
"Generator",
"HeightGen",
"Biomal");
913 return CreateHeightGen(a_IniFile, a_BiomeGen, a_Seed, a_CacheOffByDefault);
917 res->InitializeHeightGen(a_IniFile);
EMCSBiome
Biome IDs The first batch corresponds to the clientside biomes, used by MineCraft.
unsigned char HEIGHTTYPE
The type used by the heightmap.
#define ARRAYCOUNT(X)
Evaluates to the number of elements in an array (compile-time!)
T Clamp(T a_Value, T a_Min, T a_Max)
Clamp X to the specified range.
float NOISE_DATATYPE
The datatype used by all the noise generators.
int NoCaseCompare(const AString &s1, const AString &s2)
Case-insensitive string comparison.
Wraps the chunk coords into a single structure.
static void BlockToChunk(int a_X, int a_Z, int &a_ChunkX, int &a_ChunkZ)
Converts absolute block coords to chunk coords:
static void SetHeight(HeightMap &a_HeightMap, int a_X, int a_Z, HEIGHTTYPE a_Height)
HEIGHTTYPE HeightMap[Width *Width]
The type used for any heightmap operations and storage; idx = x + Width * z; Height points to the hig...
static HEIGHTTYPE GetHeight(const HeightMap &a_HeightMap, int a_X, int a_Z)
static EMCSBiome GetBiome(const BiomeMap &a_BiomeMap, int a_X, int a_Z)
EMCSBiome BiomeMap[Width *Width]
The type used for any biomemap operations and storage inside Cuberite, using Cuberite biomes (need no...
The interface that a biome generator must implement A biome generator takes chunk coords on input and...
virtual void GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap &a_BiomeMap)=0
Generates biomes for the given chunk.
The interface that is used to query terrain height from the shape generator.
virtual void GenHeightMap(cChunkCoords a_ChunkCoords, cChunkDef::HeightMap &a_HeightMap)=0
Retrieves the heightmap for the specified chunk.
static std::unique_ptr< cTerrainHeightGen > CreateHeightGen(cIniFile &a_IniFile, cBiomeGen &a_BiomeGen, int a_Seed, bool &a_CacheOffByDefault)
Creates a cTerrainHeightGen descendant based on the INI file settings.
virtual void GenHeightMap(cChunkCoords a_ChunkCoords, cChunkDef::HeightMap &a_HeightMap) override
Retrieves the heightmap for the specified chunk.
cHeiGenSteppy(int a_Seed)
std::shared_ptr< cProtIntGen > m_Gen
double m_Weights[AVERAGING_SIZE *2+1][AVERAGING_SIZE *2+1]
Weights applied to each of the min / max values in the neighborhood of the currently evaluated column...
double m_TotalWeight
Sum of all the m_Weights items.
static const int AVERAGING_SIZE
Size of the averaging process, in columns (for each direction).
virtual void InitializeHeightGen(cIniFile &a_IniFile) override
Initializes the generator, reading its parameters from the INI file.
cBiomeGen & m_BiomeGen
The biome generator to query for the underlying biomes.
void getBiomeMinMax(EMCSBiome a_Biome, double &a_Min, double &a_Max)
Returns the minimum and maximum heights for the given biome.
virtual void GenHeightMap(cChunkCoords a_ChunkCoords, cChunkDef::HeightMap &a_HeightMap) override
Retrieves the heightmap for the specified chunk.
cHeiGenMinMax(int a_Seed, cBiomeGen &a_BiomeGen)
virtual void GenHeightMap(cChunkCoords a_ChunkCoords, cChunkDef::HeightMap &a_HeightMap) override
Retrieves the heightmap for the specified chunk.
std::vector< size_t > m_CacheOrder
virtual HEIGHTTYPE GetHeightAt(int a_BlockX, int a_BlockZ) override
Returns the height at the specified column.
cTerrainHeightGen & m_HeiGenToCache
The terrain height generator that is being cached.
std::vector< sCacheData > m_CacheData
cHeiGenCache(cTerrainHeightGen &a_HeiGenToCache, size_t a_CacheSize)
virtual HEIGHTTYPE GetHeightAt(int a_BlockX, int a_BlockZ) override
Returns the height at the specified column.
size_t m_NumSubCaches
Number of sub-caches, pulled out of m_SubCaches.size() for performance reasons.
static const size_t m_CoeffZ
The coefficient used to turn Z coords into index (x + Coeff * z).
cHeiGenMultiCache(std::unique_ptr< cTerrainHeightGen > a_HeightGenToCache, size_t a_SubCacheSize, size_t a_NumSubCaches)
virtual void GenHeightMap(cChunkCoords a_ChunkCoords, cChunkDef::HeightMap &a_HeightMap) override
Retrieves the heightmap for the specified chunk.
std::vector< std::unique_ptr< cHeiGenCache > > m_SubCaches
The individual sub-caches.
std::unique_ptr< cTerrainHeightGen > m_Underlying
The underlying height generator.
virtual void GenHeightMap(cChunkCoords a_ChunkCoords, cChunkDef::HeightMap &a_HeightMap) override
Retrieves the heightmap for the specified chunk.
virtual void InitializeHeightGen(cIniFile &a_IniFile) override
Initializes the generator, reading its parameters from the INI file.
virtual void GenHeightMap(cChunkCoords a_ChunkCoords, cChunkDef::HeightMap &a_HeightMap) override
Retrieves the heightmap for the specified chunk.
cHeiGenClassic(int a_Seed)
virtual void InitializeHeightGen(cIniFile &a_IniFile) override
Initializes the generator, reading its parameters from the INI file.
float GetNoise(float x, float y)
cHeiGenMountains(int a_Seed)
virtual void InitializeHeightGen(cIniFile &a_IniFile) override
Initializes the generator, reading its parameters from the INI file.
virtual void GenHeightMap(cChunkCoords a_ChunkCoords, cChunkDef::HeightMap &a_HeightMap) override
Retrieves the heightmap for the specified chunk.
cRidgedMultiNoise m_DitchNoise
cRidgedMultiNoise m_MountainNoise
virtual HEIGHTTYPE GetHeightAt(int a_BlockX, int a_BlockZ) override
Returns the height at the specified column.
virtual void InitializeHeightGen(cIniFile &a_IniFile) override
Initializes the generator, reading its parameters from the INI file.
virtual void GenHeightMap(cChunkCoords a_ChunkCoords, cChunkDef::HeightMap &a_HeightMap) override
Retrieves the heightmap for the specified chunk.
static const sGenParam m_GenParam[256]
cChunkDef::BiomeMap BiomeNeighbors[3][3]
int GetValueSetI(const AString &keyname, const AString &valuename, const int defValue=0) override
bool SetValue(const int keyID, const int valueID, const AString &value)
AString GetValueSet(const AString &keyname, const AString &valuename, const AString &defValue="") override
Gets the value; if not found, write the default to the repository.
double GetValueSetF(const AString &keyname, const AString &valuename, const double defValue=0.0)
NOISE_DATATYPE CubicNoise2D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y) const
void AddOctave(NOISE_DATATYPE a_Frequency, NOISE_DATATYPE a_Amplitude)
Adds a new octave to the list of octaves that compose this noise.
void Generate2D(NOISE_DATATYPE *a_Array, int a_SizeX, int a_SizeY, NOISE_DATATYPE a_StartX, NOISE_DATATYPE a_EndX, NOISE_DATATYPE a_StartY, NOISE_DATATYPE a_EndY, NOISE_DATATYPE *a_Workspace=nullptr) const
Fills a 2D array with the values of the noise.