Class MimicLocalMap
java.lang.Object
com.github.yellowstonegames.world.WorldMapGenerator
com.github.yellowstonegames.world.LocalMap
com.github.yellowstonegames.world.MimicLocalMap
An unusual map generator that imitates an existing local map (such as a map of Australia, which it can do by
default), without applying any projection or changing heat levels in the polar regions or equator.
Example map, showing a variant on Australia
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringStores a 256x256 Region that shows an unprojected map of Australia, in a format that can be read back withRegion.decompress(String).protected final com.github.yellowstonegames.grid.Regioncom.github.yellowstonegames.grid.Regioncom.github.yellowstonegames.grid.Regioncom.github.yellowstonegames.grid.Regioncom.github.yellowstonegames.grid.RegionFields inherited from class LocalMap
heat, heatFreq, maxHeat0, maxHeat1, maxWet0, minHeat0, minHeat1, minWet0, moisture, moistureFreq, otherFreq, otherRidged, terrainBasic, terrainFreq, terrainLayeredFreq, terrainRidged, xPositions, yPositions, zPositionsFields inherited from class WorldMapGenerator
cacheA, cacheB, centerLongitude, coastalWaterLower, coastalWaterUpper, deepWaterLower, deepWaterUpper, DEFAULT_NOISE, forestLower, forestUpper, grassLower, grassUpper, heatData, heatModifier, height, heightCodeData, heightData, landData, landModifier, maxHeat, maxHeight, maxWet, mediumWaterLower, mediumWaterUpper, minHeat, minHeight, minWet, moistureData, rng, rockLower, rockUpper, sandLower, sandUpper, seedA, seedB, shallowWaterLower, shallowWaterUpper, snowLower, snowUpper, startCacheX, startCacheY, startX, startY, usedHeight, usedWidth, width, zoom, zoomStartX, zoomStartY -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a concrete WorldMapGenerator for a map that should look like Australia, without projecting the land positions or changing heat by latitude.MimicLocalMap(int width, int height, String serialized) Creates a new generator from the given serialized String, produced bystringSerialize(), but this also requires width and height that match the first two lines of the given String (inBase.BASE86).MimicLocalMap(long initialSeed) Constructs a 256x256 unprojected local map that will use land forms with a similar shape to Australia.MimicLocalMap(long initialSeed, com.github.yellowstonegames.grid.INoise noiseGenerator, float octaveMultiplier) Constructs a 256x256 unprojected local map that will use land forms with a similar shape to Australia.MimicLocalMap(long initialSeed, com.github.yellowstonegames.grid.Region toMimic) Constructs a concrete WorldMapGenerator for a map that should have land in roughly the same places as the given Region's "on" cells, without projecting the land positions or changing heat by latitude.MimicLocalMap(long initialSeed, com.github.yellowstonegames.grid.Region toMimic, float octaveMultiplier) Constructs a concrete WorldMapGenerator for a map that should have land in roughly the same places as the given Region's "on" cells, without projecting the land positions or changing heat by latitude.MimicLocalMap(long initialSeed, com.github.yellowstonegames.grid.Region toMimic, com.github.yellowstonegames.grid.INoise noiseGenerator) Constructs a concrete WorldMapGenerator for a map that should have land in roughly the same places as the given Region's "on" cells, without projecting the land positions or changing heat by latitude.MimicLocalMap(long initialSeed, com.github.yellowstonegames.grid.Region toMimic, com.github.yellowstonegames.grid.INoise noiseGenerator, float octaveMultiplier) Constructs a concrete WorldMapGenerator for a map that should have land in roughly the same places as the given Region's "on" cells, using an elliptical projection (specifically, a Mollweide projection).MimicLocalMap(com.github.yellowstonegames.grid.Region toMimic) Constructs a concrete WorldMapGenerator for a map that should have land in roughly the same places as the given Region's "on" cells, without projecting the land positions or changing heat by latitude.MimicLocalMap(MimicLocalMap other) Copies the MimicLocalMapotherto construct a new one that is exactly the same. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()static MimicLocalMaprecreateFromString(String data) Creates a new instance of this class from a serialized String produced bystringSerialize().protected voidregenerate(int startX, int startY, int usedWidth, int usedHeight, float landMod, float heatMod, long stateA, long stateB) Serializes this generator's entire state to a String; it can be read back when creating a new instance of this type withMimicLocalMap(int, int, String)or (preferably)recreateFromString(String).toString()Methods inherited from class WorldMapGenerator
codeHeight, generate, generate, generate, getCenterLongitude, project, removeExcess, setCenterLongitude, zoomIn, zoomIn, zoomOut, zoomOut
-
Field Details
-
earth
public com.github.yellowstonegames.grid.Region earth -
shallow
public com.github.yellowstonegames.grid.Region shallow -
coast
public com.github.yellowstonegames.grid.Region coast -
earthOriginal
public com.github.yellowstonegames.grid.Region earthOriginal -
buffer
protected final transient com.github.yellowstonegames.grid.Region buffer -
AUSTRALIA_ENCODED
Stores a 256x256 Region that shows an unprojected map of Australia, in a format that can be read back withRegion.decompress(String). By using Region's compression, this takes up a lot less room than it would with most text-based formats, and even beats uncompressed binary storage of the map by a factor of 9.4f. The map data won't change here, so this should stay compatible.
This was flipped twice, once early in 2023, and once to undo that in late 2025.- See Also:
-
-
Constructor Details
-
MimicLocalMap
public MimicLocalMap()Constructs a concrete WorldMapGenerator for a map that should look like Australia, without projecting the land positions or changing heat by latitude. Always makes a 256x256 map. Uses Noise as its noise generator, with 1f as the octave multiplier affecting detail. If you were usingMimicLocalMap(long, INoise, float), then this would be the same as passing the parameters0x1337BABE1337D00DL, new Noise(DEFAULT_NOISE), 1f. -
MimicLocalMap
public MimicLocalMap(com.github.yellowstonegames.grid.Region toMimic) Constructs a concrete WorldMapGenerator for a map that should have land in roughly the same places as the given Region's "on" cells, without projecting the land positions or changing heat by latitude. The initial seed is set to the same large long every time, and it's likely that you would set the seed when you callWorldMapGenerator.generate(long, long). The width and height of the map cannot be changed after the fact. Uses Noise as its noise generator, with 1f as the octave multiplier affecting detail.- Parameters:
toMimic- the world map to imitate, as a Region with land as "on"; the height and width will be copied
-
MimicLocalMap
public MimicLocalMap(long initialSeed, com.github.yellowstonegames.grid.Region toMimic) Constructs a concrete WorldMapGenerator for a map that should have land in roughly the same places as the given Region's "on" cells, without projecting the land positions or changing heat by latitude. Takes an initial seed and the Region containing land positions. TheinitialSeedparameter may or may not be used, since you can specify the seed to use when you callWorldMapGenerator.generate(long, long). The width and height of the map cannot be changed after the fact. Uses Noise as its noise generator, with 1f as the octave multiplier affecting detail.- Parameters:
initialSeed- the seed for the FlowRandom this uses; this may also be set per-call to generatetoMimic- the world map to imitate, as a Region with land as "on"; the height and width will be copied
-
MimicLocalMap
public MimicLocalMap(long initialSeed, com.github.yellowstonegames.grid.Region toMimic, float octaveMultiplier) Constructs a concrete WorldMapGenerator for a map that should have land in roughly the same places as the given Region's "on" cells, without projecting the land positions or changing heat by latitude. Takes an initial seed, the Region containing land positions, and a multiplier that affects the level of detail by increasing or decreasing the number of octaves of noise used. TheinitialSeedparameter may or may not be used, since you can specify the seed to use when you callWorldMapGenerator.generate(long, long). The width and height of the map cannot be changed after the fact. Uses Noise as its noise generator, with the given octave multiplier affecting detail.- Parameters:
initialSeed- the seed for the FlowRandom this uses; this may also be set per-call to generatetoMimic- the world map to imitate, as a Region with land as "on"; the height and width will be copiedoctaveMultiplier- used to adjust the level of detail, with 0.5f at the bare-minimum detail and 1f normal
-
MimicLocalMap
public MimicLocalMap(long initialSeed, com.github.yellowstonegames.grid.Region toMimic, com.github.yellowstonegames.grid.INoise noiseGenerator) Constructs a concrete WorldMapGenerator for a map that should have land in roughly the same places as the given Region's "on" cells, without projecting the land positions or changing heat by latitude. Takes an initial seed, the Region containing land positions, and parameters for noise generation (aNoiseimplementation, which is usuallyNoise.instance. TheinitialSeedparameter may or may not be used, since you can specify the seed to use when you callWorldMapGenerator.generate(long, long). The width and height of the map cannot be changed after the fact. Both Noise and Noise make sense to use fornoiseGenerator, and the seed it's constructed with doesn't matter because this will change the seed several times at different scales of noise (it's fine to use the staticNoise.instanceorNoise.instancebecause they have no changing state between runs of the program). Uses the given noise generator, with 1f as the octave multiplier affecting detail.- Parameters:
initialSeed- the seed for the FlowRandom this uses; this may also be set per-call to generatetoMimic- the world map to imitate, as a Region with land as "on"; the height and width will be copiednoiseGenerator- an instance of a noise generator capable of 3D noise, usuallyNoiseorNoise
-
MimicLocalMap
public MimicLocalMap(long initialSeed, com.github.yellowstonegames.grid.Region toMimic, com.github.yellowstonegames.grid.INoise noiseGenerator, float octaveMultiplier) Constructs a concrete WorldMapGenerator for a map that should have land in roughly the same places as the given Region's "on" cells, using an elliptical projection (specifically, a Mollweide projection). Takes an initial seed, the Region containing land positions, parameters for noise generation (aNoiseimplementation, which is usuallyNoise.instance, and a multiplier on how many octaves of noise to use, with 1f being normal (high) detail and higher multipliers producing even more detailed noise when zoomed-in). TheinitialSeedparameter may or may not be used, since you can specify the seed to use when you callWorldMapGenerator.generate(long, long). The width and height of the map cannot be changed after the fact. Noise will be the fastest 3D generator to use fornoiseGenerator, and the seed it's constructed with doesn't matter because this will change the seed several times at different scales of noise (it's fine to use the staticNoise.instancebecause it has no changing state between runs of the program). TheoctaveMultiplierparameter should probably be no lower than 0.5f, but can be arbitrarily high if you're willing to spend much more time on generating detail only noticeable at very high zoom; normally 1f is fine and may even be too high for maps that don't require zooming.- Parameters:
initialSeed- the seed for the FlowRandom this uses; this may also be set per-call to generatetoMimic- the world map to imitate, as a Region with land as "on"; the height and width will be copiednoiseGenerator- an instance of a noise generator capable of 3D noise, usuallyNoiseorNoiseoctaveMultiplier- used to adjust the level of detail, with 0.5f at the bare-minimum detail and 1f normal
-
MimicLocalMap
Creates a new generator from the given serialized String, produced bystringSerialize(), but this also requires width and height that match the first two lines of the given String (inBase.BASE86). It is almost always easier to userecreateFromString(String)instead.- Parameters:
width- width of the map or maps to generate; must match the first line of the given String inBase.BASE86height- height of the map or maps to generate; must match the second line of the given String inBase.BASE86serialized- should have been produced bystringSerialize()
-
MimicLocalMap
public MimicLocalMap(long initialSeed) Constructs a 256x256 unprojected local map that will use land forms with a similar shape to Australia.- Parameters:
initialSeed-
-
MimicLocalMap
public MimicLocalMap(long initialSeed, com.github.yellowstonegames.grid.INoise noiseGenerator, float octaveMultiplier) Constructs a 256x256 unprojected local map that will use land forms with a similar shape to Australia.- Parameters:
initialSeed-noiseGenerator-octaveMultiplier-
-
MimicLocalMap
Copies the MimicLocalMapotherto construct a new one that is exactly the same. References will only be shared to Noise classes.- Parameters:
other- a MimicLocalMap to copy
-
-
Method Details
-
stringSerialize
Serializes this generator's entire state to a String; it can be read back when creating a new instance of this type withMimicLocalMap(int, int, String)or (preferably)recreateFromString(String). UsesBase.BASE86to represent values very concisely, but not at all readably. The String this produces tends to be very long because it includes several 2D arrays and a Region as Strings.- Overrides:
stringSerializein classLocalMap- Returns:
- a String that stores the entire state of this generator
-
recreateFromString
Creates a new instance of this class from a serialized String produced bystringSerialize(). This can get the width and height from the String, which makes this probably preferable to using the constructorMimicLocalMap(int, int, String). This stores the last-generated map in this WorldMapGenerator, where it can be used by other code like aWorldMapView.- Parameters:
data- the output ofstringSerialize()- Returns:
- the map that was serialized, as a new generator
-
regenerate
protected void regenerate(int startX, int startY, int usedWidth, int usedHeight, float landMod, float heatMod, long stateA, long stateB) - Overrides:
regeneratein classLocalMap
-
equals
-
hashCode
-
toString
-