Interface BiomeMapper
- All Known Implementing Classes:
BiomeMapper.BlendedBiomeMapper, BiomeMapper.DetailedBiomeMapper, BiomeMapper.SimpleBiomeMapper, BiomeMapper.UnrealisticBiomeMapper
public interface BiomeMapper
Provides a way to assign biomes to points on a world or area map, and retrieve those biomes or the heat/moisture
levels those biomes depend on. After constructing a BiomeMapper and generating a world with a
You can serialize a BiomeMapper using
WorldMapGenerator, you can call makeBiomes(WorldMapGenerator) to assign the biomes for that world.
After that, you can call getBiomeCode(int, int) to get the primary biome code for an area; more specialized
methods or fields may be available in implementations.
You can serialize a BiomeMapper using
stringSerialize(), which is much like
WorldMapGenerator.stringSerialize() and creates a String that can be read in by a constructor and/or
recreateFromString(String). The serialized data typically includes the most recently-produced code data for
heat, moisture, and biomes; deserializing usually isn't different from calling makeBiomes(WorldMapGenerator)
with an identical WorldMapGenerator.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA very-smoothly-blending BiomeMapper.static classA way to get biome information for the cells on a map when you want an area's biome to be a combination of two main biome types, such as "Grassland" or "TropicalRainforest", with the biomes varying in weight between areas.static classA way to get biome information for the cells on a map when you only need a single value to describe a biome, such as "Grassland" or "TropicalRainforest".static classPrimarily useful for debugging, this makes every biome a wildly different color. -
Method Summary
Modifier and TypeMethodDescriptionbooleanintgetBiomeCode(int x, int y) Gets the most relevant biome code for a given x,y point on the map.int[][]com.github.yellowstonegames.place.Biome[]Gets aBiomearray where biome codes can be used as indices to look up a name for the biome they refer to.intgetHeatCode(int x, int y) Gets a heat code for a given x,y point on a map, usually as an int between 0 and 5 inclusive.int[][]intgetMoistureCode(int x, int y) Gets a moisture code for a given x,y point on a map, usually as an int between 0 and 5 inclusive.int[][]voidmakeBiomes(WorldMapGenerator world) Analyzes the last world produced by the given WorldMapGenerator and uses all of its generated information to assign biome codes for each cell (along with heat and moisture codes).Serializes this generator's entire state to a String; it can be read back when creating a new instance of this type with a constructor (the most often case) orrecreateFromString(String).
-
Method Details
-
stringSerialize
String stringSerialize()Serializes this generator's entire state to a String; it can be read back when creating a new instance of this type with a constructor (the most often case) orrecreateFromString(String).- Returns:
- a String that stores the entire state of this generator
-
getBiomeCode
int getBiomeCode(int x, int y) Gets the most relevant biome code for a given x,y point on the map. Some mappers can store more than one biome at a location, but only the one with the highest influence will be returned by this method. Biome codes are always ints, and are typically between 0 and 60, both inclusive; they are meant to be used as indices into a table of names or other objects that identify a biome, accessible viagetBiomeTable(). Although different classes may define biome codes differently, they should all be able to be used as indices into the String array returned by getBiomeNameTable().- Parameters:
x- the x-coordinate on the mapy- the y-coordinate on the map- Returns:
- an int that can be used as an index into the array returned by
getBiomeTable()
-
getHeatCode
int getHeatCode(int x, int y) Gets a heat code for a given x,y point on a map, usually as an int between 0 and 5 inclusive. Some implementations may use more or less detail for heat codes, but 0 is always the coldest code used, and the highest value this can return for a given implementation refers to the hottest code used.- Parameters:
x- the x-coordinate on the mapy- the y-coordinate on the map- Returns:
- an int that can be used to categorize how hot an area is, with 0 as coldest
-
getMoistureCode
int getMoistureCode(int x, int y) Gets a moisture code for a given x,y point on a map, usually as an int between 0 and 5 inclusive. Some implementations may use more or less detail for moisture codes, but 0 is always the driest code used, and the highest value this can return for a given implementation refers to the wettest code used. Some implementations may allow seasonal change in moisture, e.g. monsoon seasons, to be modeled differently from average precipitation in an area, but the default assumption is that this describes the average amount of moisture (rain, humidity, and possibly snow/hail or other precipitation) that an area receives annually.- Parameters:
x- the x-coordinate on the mapy- the y-coordinate on the map- Returns:
- an int that can be used to categorize how much moisture an area tends to receive, with 0 as driest
-
getHeatCodeData
int[][] getHeatCodeData() -
getMoistureCodeData
int[][] getMoistureCodeData() -
getBiomeCodeData
int[][] getBiomeCodeData() -
getBiomeTable
com.github.yellowstonegames.place.Biome[] getBiomeTable()Gets aBiomearray where biome codes can be used as indices to look up a name for the biome they refer to. It's common for implementations to use the existing table inBiome.TABLE; the 66-element array format that uses is encouraged for implementing classes if they use 6 levels of heat and 6 levels of moisture, and track rivers, coastlines, lakes, and oceans as potentially different types of terrain. Biome codes can be obtained withgetBiomeCode(int, int), or for some implementing classes other methods may provide more detailed information.- Returns:
- a Biome array that often contains 66 elements, to be used with biome codes as indices.
-
makeBiomes
Analyzes the last world produced by the given WorldMapGenerator and uses all of its generated information to assign biome codes for each cell (along with heat and moisture codes). After calling this, biome codes can be retrieved withgetBiomeCode(int, int)and used as indices intogetBiomeTable()or a custom biome table.- Parameters:
world- a WorldMapGenerator that should have generated at least one map; it may be at any zoom
-
equals
-