From 467297a922f7ce2e5623f189e25a879338263006 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 24 Jan 2013 12:15:36 +0000 Subject: A brand new biome generator: cBioGenMultiStepMap. Has proper mushroom biome inside ocean, nice transitions between neighboring biomes. Still needs a bit of tweaking, but generally ok. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1164 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Generating/BioGen.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'source/Generating/BioGen.h') diff --git a/source/Generating/BioGen.h b/source/Generating/BioGen.h index 6faca09c1..307009a2b 100644 --- a/source/Generating/BioGen.h +++ b/source/Generating/BioGen.h @@ -170,3 +170,56 @@ protected: +class cBioGenMultiStepMap : + public cBiomeGen +{ +public: + cBioGenMultiStepMap(int a_Seed); + + void Init(cIniFile & a_IniFile); + +protected: + cNoise m_Noise; + int m_Seed; + int m_OceanCellSize; + int m_MushroomIslandSize; + int m_RiverCellSize; + float m_RiverWidthThreshold; + float m_LandBiomesSize; + + typedef int IntMap[256]; // x + 16 * z, expected trimmed into [0..255] range + + // cBiomeGen override: + virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override; + + /** Step 1: Decides between ocean, land and mushroom, using a DistVoronoi with special conditions and post-processing for mushroom islands + Sets biomes to biOcean, -1 (i.e. land), biMushroomIsland or biMushroomShore + */ + void DecideOceanLandMushroom(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap); + + /** Step 2: Add rivers to the land + Flips some "-1" biomes into biRiver + */ + void AddRivers(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap); + + /** Step 3: Decide land biomes, using Distorted Voronoi and a temperature / humidity map and freezes ocean / river in low temperatures. + Flips all remaining "-1" biomes into land biomes. Also flips some biOcean and biRiver into biFrozenOcean, biFrozenRiver, based on temp map. + */ + void ApplyTemperatureHumidity(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap); + + /// Distorts the coords using a Perlin-like noise, with a specified cell-size + void Distort(int a_BlockX, int a_BlockZ, int & a_DistortedX, int & a_DistortedZ, int a_CellSize); + + /// Builds two Perlin-noise maps, one for temperature, the other for humidity. Trims both into [0..255] range + void BuildTemperatureHumidityMaps(int a_ChunkX, int a_ChunkZ, IntMap & a_TemperatureMap, IntMap & a_HumidityMap); + + /// Flips all remaining "-1" biomes into land biomes using the two maps + void DecideLandBiomes(cChunkDef::BiomeMap & a_BiomeMap, const IntMap & a_TemperatureMap, const IntMap & a_HumidityMap); + + /// Flips biOcean and biRiver into biFrozenOcean and biFrozenRiver if the temperature is too low + void FreezeWaterBiomes(cChunkDef::BiomeMap & a_BiomeMap, const IntMap & a_TemperatureMap); +} ; + + + + -- cgit v1.2.3