@Beta public class WildMap extends java.lang.Object implements java.io.Serializable
WorldMapGenerator
and WorldMapGenerator.DetailedBiomeMapper
to produce, for
example, very sparse maps with an occasional cactus in a desert, or very dense maps with many trees and shrubs for a
forest.
generate()
, which assigns indices into content
and
floors
, where an index can look up a value from contentTypes
or floorTypes
. The biome is
usually an index into WorldMapGenerator.DetailedBiomeMapper.biomeTable
, but can
be some other index if you don't use DetailedBiomeMapper (you would probably use a subclass then). The
contentTypes
field is an ArrayList; you can have and are encouraged to have duplicates when an object should
appear more often. An index of -1 in content indicates nothing of note is present there. There is also a String array
of floorTypes
that is not typically user-set unless you subclass WildMap yourself; it is used to look up the
indices in floors
. The floors are set to reasonable values for the particular biome, so a forest has "dirt"
and "leaves" among others, while a desert might only have "sand". Again, only the indices matter, so you could change
the values in floorTypes
to match names of textures in a graphical game and make lookup easier, or to a char
followed by the name of a color (as in SColor in the display module) for a text-based game.
Modifier and Type | Class and Description |
---|---|
static class |
WildMap.MixedWildMap
A subclass of
WildMap that serves as a ragged edge between 2, 3, or 4 WildMaps in a square intersection. |
Modifier and Type | Field and Description |
---|---|
int |
biome |
int[][] |
content |
java.util.ArrayList<java.lang.String> |
contentTypes |
int[][] |
floors |
java.util.ArrayList<java.lang.String> |
floorTypes |
int |
height |
IStatefulRNG |
rng |
int |
width |
Constructor and Description |
---|
WildMap() |
WildMap(int width,
int height,
int biome) |
WildMap(int width,
int height,
int biome,
int seedA,
int seedB) |
WildMap(int width,
int height,
int biome,
IStatefulRNG rng) |
WildMap(int width,
int height,
int biome,
IStatefulRNG rng,
java.util.ArrayList<java.lang.String> contentTypes) |
WildMap(int width,
int height,
int biome,
IStatefulRNG rng,
java.util.ArrayList<java.lang.String> floorTypes,
java.util.ArrayList<java.lang.String> contentTypes) |
Modifier and Type | Method and Description |
---|---|
static java.util.ArrayList<java.lang.String> |
contentByBiome(int biome,
IRNG rng)
Gets a list of Strings that are really just the names of types of terrain feature for wilderness areas.
|
static java.util.ArrayList<java.lang.String> |
floorsByBiome(int biome,
IRNG rng)
Gets a list of Strings that are really just the names of types of floor tile for wilderness areas.
|
void |
generate()
Produces a map by filling the
floors 2D array with indices into floorTypes , and similarly
filling the content 2D array with indices into contentTypes . |
static java.util.ArrayList<java.lang.String> |
makeRepeats(java.lang.Object... rest)
Meant for generating large ArrayLists of Strings where an individual String may occur quite a few times.
|
static java.util.ArrayList<java.lang.String> |
makeShuffledRepeats(IRNG rng,
java.lang.Object... rest) |
static java.util.ArrayList<java.lang.String> |
makeVegetation(IRNG rng,
int size,
double monoculture,
FakeLanguageGen naming) |
static java.util.ArrayList<java.lang.String> |
pathsByBiome(int biome)
Gets a list of Strings that are really just the names of types of path tile for wilderness areas.
|
public final int width
public final int height
public int biome
public IStatefulRNG rng
public java.util.ArrayList<java.lang.String> contentTypes
public java.util.ArrayList<java.lang.String> floorTypes
public final int[][] content
public final int[][] floors
public WildMap()
public WildMap(int width, int height, int biome)
public WildMap(int width, int height, int biome, int seedA, int seedB)
public WildMap(int width, int height, int biome, IStatefulRNG rng)
public WildMap(int width, int height, int biome, IStatefulRNG rng, java.util.ArrayList<java.lang.String> contentTypes)
public WildMap(int width, int height, int biome, IStatefulRNG rng, java.util.ArrayList<java.lang.String> floorTypes, java.util.ArrayList<java.lang.String> contentTypes)
public static java.util.ArrayList<java.lang.String> makeRepeats(java.lang.Object... rest)
rest
- a vararg (or Object array) of alternating String and Integer valuespublic static java.util.ArrayList<java.lang.String> makeShuffledRepeats(IRNG rng, java.lang.Object... rest)
public static java.util.ArrayList<java.lang.String> makeVegetation(IRNG rng, int size, double monoculture, FakeLanguageGen naming)
public static java.util.ArrayList<java.lang.String> floorsByBiome(int biome, IRNG rng)
biome
- an index into WorldMapGenerator.DetailedBiomeMapper.biomeTable
, or some other index if you don't use DetailedBiomeMapperrng
- an IRNG, like RNG
or GWTRNG
public static java.util.ArrayList<java.lang.String> pathsByBiome(int biome)
biome
- an index into WorldMapGenerator.DetailedBiomeMapper.biomeTable
, or some other index if you don't use DetailedBiomeMapperpublic static java.util.ArrayList<java.lang.String> contentByBiome(int biome, IRNG rng)
biome
- an index into WorldMapGenerator.DetailedBiomeMapper.biomeTable
, or some other index if you don't use DetailedBiomeMapperrng
- an IRNG, like RNG
or GWTRNG
public void generate()
floors
2D array with indices into floorTypes
, and similarly
filling the content
2D array with indices into contentTypes
. You only need to call this method
when you first generate a map with the specific parameters you want, such as biome, and later if you want another
map with the same parameters.
BlueNoise
, adjusted to fit
wilderness maps slightly.Copyright © Eben Howard 2012–2022. All rights reserved.