11-06-2014, 04:47 AM
About the MinMax generator.
As far as I understand the biomal generator generates a height by creating an average in a 9x9 area around the asked position. How about we give different biomes some kind of priority. I have a feeling this might sound a little vague, so maybe a little code:
As far as I understand the biomal generator generates a height by creating an average in a 9x9 area around the asked position. How about we give different biomes some kind of priority. I have a feeling this might sound a little vague, so maybe a little code:
const cHeiGenBiomal::sBiomePriorities cHeiGenBiomal::m_BiomePriorities[256] =
{
/* biOcean */ { 1 },
/* biPlains */ { 1 },
/* biDesert */ { 1 },
/* biExtremeHills */ { 1 },
/* biForest */ { 1 },
/* biTaiga */ { 1 },
/* biSwampland */ { 1 },
/* biRiver */ { 3 },
/* biNether */ { 1 },
/* biEnd */ { 1 },
/* biFrozenOcean */ { 1 },
/* biFrozenRiver */ { 3 },
...
}
int HeightAverage = 0;
int DivideTo = 0;
for (int x = PosX - 4; x < PosX + 4; x++)
{
for (int z = PosZ - 4; z < PosZ + 4; z++)
{
DivideTo += m_BiomePriorities[GetBiomeAt(x, z)];
HeightAverage += GenerateHeightAt(x, z) * m_BiomePriorities[GetBiomeAt(x, z)];
}
}
int FinalHeight = HeightAverage / DivideTo;

