Class MimicWorldMap
java.lang.Object
com.github.yellowstonegames.world.WorldMapGenerator
com.github.yellowstonegames.world.EllipticalWorldMap
com.github.yellowstonegames.world.MimicWorldMap
An unusual map generator that imitates an existing map (such as a map of Earth, which it can do by default). It
uses the Mollweide projection (an elliptical map projection, the same as what EllipticalWorldMap uses) for both its
input and output; an example can be seen here,
imitating Earth using a 512x256 world map as a Region for input.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.github.yellowstonegames.grid.Regioncom.github.yellowstonegames.grid.Regioncom.github.yellowstonegames.grid.Regionstatic final StringStores a 512x256 Region that shows an Earth map with elliptical (Mollweide) projection, in a format that can be read back withRegion.decompress(String).com.github.yellowstonegames.grid.Regioncom.github.yellowstonegames.grid.RegionFields inherited from class EllipticalWorldMap
edges, 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 Earth using an elliptical projection (specifically, a Mollweide projection).MimicWorldMap(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).MimicWorldMap(long initialSeed) Constructs a 512x256 elliptical world map that will use land forms with a similar shape to Earth.MimicWorldMap(long initialSeed, com.github.yellowstonegames.grid.INoise noiseGenerator, float octaveMultiplier) Constructs a 512x256 elliptical world map that will use land forms with a similar shape to Earth.MimicWorldMap(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, using an elliptical projection (specifically, a Mollweide projection).MimicWorldMap(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, using an elliptical projection (specifically, a Mollweide projection).MimicWorldMap(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, using an elliptical projection (specifically, a Mollweide projection).MimicWorldMap(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).MimicWorldMap(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, using an elliptical projection (specifically, a Mollweide projection).MimicWorldMap(MimicWorldMap other) Copies the MimicWorldMapotherto construct a new one that is exactly the same. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()static MimicWorldMaprecreateFromString(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) static com.github.yellowstonegames.grid.RegionreprojectToElliptical(com.github.yellowstonegames.grid.Region rectangular) Meant for making maps conform to the Mollweide (elliptical) projection that MimicWorldMap uses.Serializes this generator's entire state to a String; it can be read back when creating a new instance of this type withMimicWorldMap(int, int, String)or (preferably)recreateFromString(String).toString()intwrapX(int x, int y) intwrapY(int x, int y) 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 -
EARTH_ENCODED
Stores a 512x256 Region that shows an Earth map with elliptical (Mollweide) projection, 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 5.8f. 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
-
MimicWorldMap
public MimicWorldMap()Constructs a concrete WorldMapGenerator for a map that should look like Earth using an elliptical projection (specifically, a Mollweide projection). Always makes a 512x256 map. Uses Noise as its noise generator, with 1f as the octave multiplier affecting detail. If you were usingMimicWorldMap(long, INoise, float), then this would be the same as passing the parameters0x1337BABE1337D00DL, new Noise(DEFAULT_NOISE), 1f. -
MimicWorldMap
public MimicWorldMap(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, using an elliptical projection (specifically, a Mollweide projection). 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
-
MimicWorldMap
public MimicWorldMap(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, using an elliptical projection (specifically, a Mollweide projection). 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
-
MimicWorldMap
public MimicWorldMap(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, using an elliptical projection (specifically, a Mollweide projection). 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
-
MimicWorldMap
public MimicWorldMap(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, using an elliptical projection (specifically, a Mollweide projection). 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, usuallyNoisebut can be any INoise
-
MimicWorldMap
public MimicWorldMap(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
-
MimicWorldMap
public MimicWorldMap(long initialSeed) Constructs a 512x256 elliptical world map that will use land forms with a similar shape to Earth.- Parameters:
initialSeed-
-
MimicWorldMap
public MimicWorldMap(long initialSeed, com.github.yellowstonegames.grid.INoise noiseGenerator, float octaveMultiplier) Constructs a 512x256 elliptical world map that will use land forms with a similar shape to Earth.- Parameters:
initialSeed-noiseGenerator-octaveMultiplier-
-
MimicWorldMap
Copies the MimicWorldMapotherto construct a new one that is exactly the same. References will only be shared to Noise classes.- Parameters:
other- a MimicWorldMap to copy
-
MimicWorldMap
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()
-
-
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 withMimicWorldMap(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 classEllipticalWorldMap- 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 constructorMimicWorldMap(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
-
reprojectToElliptical
public static com.github.yellowstonegames.grid.Region reprojectToElliptical(com.github.yellowstonegames.grid.Region rectangular) Meant for making maps conform to the Mollweide (elliptical) projection that MimicWorldMap uses.- Parameters:
rectangular- A Region where "on" represents land and "off" water, using any rectangular projection- Returns:
- a reprojected version of
rectangularthat uses an elliptical projection
-
wrapX
public int wrapX(int x, int y) - Overrides:
wrapXin classEllipticalWorldMap
-
wrapY
public int wrapY(int x, int y) - Overrides:
wrapYin classEllipticalWorldMap
-
regenerate
protected void regenerate(int startX, int startY, int usedWidth, int usedHeight, float landMod, float heatMod, long stateA, long stateB) - Overrides:
regeneratein classEllipticalWorldMap
-
equals
- Overrides:
equalsin classEllipticalWorldMap
-
hashCode
public int hashCode()- Overrides:
hashCodein classEllipticalWorldMap
-
toString
- Overrides:
toStringin classEllipticalWorldMap
-