Package squidpony.squidgrid.mapping
Interface WorldMapGenerator.BiomeMapper
- All Known Implementing Classes:
WorldMapGenerator.DetailedBiomeMapper
,WorldMapGenerator.SimpleBiomeMapper
- Enclosing class:
- WorldMapGenerator
public static interface WorldMapGenerator.BiomeMapper
-
Method Summary
Modifier and Type Method Description int
getBiomeCode(int x, int y)
Gets the most relevant biome code for a given x,y point on the map.String[]
getBiomeNameTable()
Gets a String array where biome codes can be used as indices to look up a name for the biome they refer to.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.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.void
makeBiomes(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).
-
Method Details
-
getBiomeCode
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 viagetBiomeNameTable()
. 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
getBiomeNameTable()
-
getHeatCode
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
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
-
getBiomeNameTable
Gets a String array where biome codes can be used as indices to look up a name for the biome they refer to. A sample table is inWorldMapGenerator.SimpleBiomeMapper.biomeTable
; the 61-element array format documented for that field 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 String array that often contains 61 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 intogetBiomeNameTable()
or a custom biome table.- Parameters:
world
- a WorldMapGenerator that should have generated at least one map; it may be at any zoom
-