Class WildMap

java.lang.Object
squidpony.squidgrid.mapping.WildMap
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
WildMap.MixedWildMap

@Beta
public class WildMap
extends Object
implements Serializable
A finite 2D area map for some kind of wilderness, adapting to different ecosystems by changing its output. Regional maps for wilderness areas have very different requirements from mostly-artificial dungeons. This is intended to work alongside 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.
Using this code mostly involves constructing a WildMap with a width, height, biome, and optionally a random number generator, an ArrayList of floor types (as Strings) that can appear, and an ArrayList of terrain content that can appear (also as Strings). Then you can call 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.
This is marked Beta because there's still some work to be done, and the actual output will change even if the API doesn't have any breaks. While the wilderness maps this produces are usable, they don't have paths or areas that a character would have to find a way around (like a cliff). This is meant to be added at some point, probably in conjunction with some system for connecting WildMaps.
Created by Tommy Ettinger on 10/16/2019.
See Also:
Serialized Form