The world file output by Cosmpoeia is stored in a Geopackage (GPKG) file. This is a SQLite database that includes some pre-built tables for storing geographic information. It is best edited with GIS software that supports the format. Below is a description of the layers, or tables, contained inside the database, and field information. The field types given are internal to the software, and their database storage field type is defined in the Field Types scetion.
On the FID field and Table Order: Every layer in the file has an identifier field called fid
, which contains a unique identifier for the field. This is handled by the gdal library, which Cosmopoeia uses for access to the file. Here are a few details:
- According to the Geopackage standard, the identifier field (which is called fid by default in gdal), is created with the following constraint in SQLite:
INTEGER PRIMARY KEY AUTOINCREMENT
. - According to SQLite documentation, a key defined in this way is guaranteed not to be reused, and appears to be possible to represent insertion order, as long as no parallel transactions are occurring, which I do not allow in the same instance of the program.
- According to tests, at least sometimes, when iterating through features, the features are returned from the database in fid order. I do not believe that this is guaranteed by any mechanism from gdal or sqlite.
- According to tests, a rust hashmap does not iterate over items in entry order. For this reason, I use a special map structure that iterates in fid order. This attempts to make it more likely that random operations with the same seed are always reproducible with the same input.
geometry: Polygon
database field type: Real
longitude of the node point for the tile's voronoi
database field type: Real
latitude of the node point for the tile's voronoi
database field type: Real
calculated area based on shape of world (this may not be the same as the area calculated by GDAL)
database field type: Real
elevation in meters of the node point for the tile's voronoi
database field type: Signed Integer
elevation scaled into a value from 0 to 100, where 20 is sea-level.
database field type: Grouping
Indicates whether the tile is part of the ocean, an island, a continent, a lake, and maybe others.
database field type: ID Reference
A unique id for each grouping. These id's do not map to other tables, but will tell when tiles are in the same group. Use lake_id to link to the lake table.
database field type: Real
average annual temperature of tile in imaginary units
database field type: Angle
roughly estimated average wind direction for tile
database field type: Real
average annual precipitation of tile in imaginary units
database field type: Real
amount of water flow through tile in imaginary units
database field type: Real
amount of water accumulating (because it couldn't flow on) in imaginary units
database field type: Optional ID Reference
if the tile is in a lake, this is the id of the lake in the lakes layer
database field type: List of Neighbor
id of neighboring tile which water flows to
database field type: Signed Integer
shortest distance in number of tiles to an ocean or lake shoreline. This will be positive on land and negative inside a water body.
database field type: Optional Neighbor
If this is a land tile neighboring a water body, this is the id of the closest tile
database field type: Optional Signed Integer
if this is a land tile neighboring a water body, this is the number of neighbor tiles that are water
database field type: String
The biome for this tile
database field type: Real
the factor used to generate population numbers, along with the area of the tile
database field type: Signed Integer
base population of the cell outside of the towns.
database field type: Optional String
The name of the culture assigned to this tile, unless wild
database field type: Optional ID Reference
if the tile has a town, this is the id of the town in the towns layer
database field type: Optional ID Reference
if the tile is part of a nation, this is the id of the nation which controls it
database field type: Optional ID Reference
if the tile is part of a subnation, this is the id of the nation which controls it
database field type: Optional Neighbor
If this tile is an outlet from a lake, this is the neighbor from which the water is flowing.
database field type: NeighborAndDirection
A list of all tile neighbors and their angular directions (tile_id:direction)
database field type: Optional Edge
A value indicating whether the tile is on the edge of the map
geometry: MultiPolygon
database field type: String
database field type: Signed Integer
database field type: BiomeCriteria
database field type: Signed Integer
database field type: Boolean
database field type: Boolean
database field type: Color
geometry: Polygon
geometry: MultiPolygon
database field type: String
database field type: String
database field type: CultureType
database field type: Real
database field type: ID Reference
database field type: Color
geometry: MultiPolygon
database field type: Real
database field type: LakeType
database field type: Real
database field type: Signed Integer
database field type: Real
database field type: Real
geometry: MultiPolygon
database field type: String
database field type: Optional String
database field type: ID Reference
database field type: CultureType
database field type: Real
database field type: ID Reference
database field type: Color
geometry: Polygon
geometry: NoGeometry
database field type: String
database field type: String
geometry: MultiLineString
database field type: ID Reference
database field type: RiverSegmentFrom
database field type: Real
database field type: Neighbor
database field type: RiverSegmentTo
database field type: Real
geometry: MultiPolygon
database field type: String
database field type: Optional String
database field type: ID Reference
database field type: CultureType
database field type: Optional ID Reference
database field type: ID Reference
database field type: Color
geometry: Point
database field type: String
database field type: Optional String
database field type: Boolean
database field type: ID Reference
database field type: ID Reference
database field type: Signed Integer
database field type: Boolean
storage type: Real
syntax: <real>
A real number from 0 to 360.
storage type: String
syntax: "Glacier" (Real) | "Matrix" (List of Unsigned Integer Pair) | "Ocean" | "Wetland" (Real)
Criteria for how the biome is to be mapped to the world based on generated climate data.
- Glacier: This biome should be used for glacier -- only one is allowed
- Matrix: The biome should be placed in the following locations in the moisture and temperature matrix -- coordinates must not be used for another biome
- Ocean: The biome should be used for ocean -- only one is allowed
- Wetland: The biome should be used for wetland -- only one is allowed
storage type: Integer
syntax: <bool>
An value of 1 or 0
storage type: String
syntax: <color>
A color in #RRGGBB syntax.
storage type: String
syntax: "Generic" | "Highland" | "Hunting" | "Lake" | "Naval" | "Nomadic" | "River"
The name for the type of culture, which specifies how the culture behaves during generation
- Generic: A culture with no landscape preferences, created when no other culture type is suggested
- Highland: A culture that prefers higher elevations
- Hunting: A culture that prefers forested landscapes
- Lake: A culture that prefers to live on the shore of lakes
- Naval: A culture that prefers ocean shores
- Nomadic: A culture that prevers drier elevations
- River: A culture that prefers to live along rivers
storage type: String
syntax: "North" | "Northeast" | "East" | "Southeast" | "South" | "Southwest" | "West" | "Northwest"
The name of a side or corner of the map.
- North: The north edge of the map
- Northeast: The northeast corner of the map
- East: The east edge of the map
- Southeast: The southeast corner of the map
- South: The south edge of the map
- Southwest: The southwest corner of the map
- West: The west edge of the map
- Northwest: The northwest corner of the map
storage type: String
syntax: "Continent" | "Island" | "Islet" | "Lake" | "LakeIsland" | "Ocean"
A type of land or water feature.
- Continent: A large land mass surrounded by ocean or the edge of the map if no ocean
- Island: A small land mass surrounded by ocean
- Islet: A smaller land mass surrounded by ocean
- Lake: A body of water created from rainfall, usually not at elevation 0.
- LakeIsland: A land mass surrounded by a lake
- Ocean: A body of water created by flooding the terrain to elevation 0.
storage type: String
syntax: <integer>
A reference to the 'fid' field in another table. This is stored as a String field because an unsigned integer field is not available.
storage type: String
syntax: "Fresh" | "Salt" | "Frozen" | "Pluvial" | "Dry" | "Marsh"
A name for a type of lake.
- Fresh: Lake is freshwater
- Salt: Lake is saltwater
- Frozen: Lake is frozen
- Pluvial: Lake is intermittent
- Dry: Lakebed is dry
- Marsh: Lake is shallow
storage type: String
syntax: [<Neighbor>, ..]
A list of comma-separated Neighbor values in brackets.
storage type: String
syntax: [<Unsigned Integer Pair>, ..]
A list of comma-separated Unsigned Integer Pair values in brackets.
storage type: String
syntax: <integer> | (<integer>,<Edge>) | <Edge>
Specifies a type of neighbor for a tile. There are three possibilities. They are described by their contents, not their name, in order to simplify the NeighborDirection fields.
- Tile: a regular contiguous tile, which is specified by it's id.
- CrossMap: a tile that sits on the opposite side of the map, specified by it's id and direction as an 'Edge'.
- OffMap: unknown content that is off the edges of the map, specified merely by a direction as an 'Edge'
storage type: String
syntax: (<Neighbor>,<real>)
A pair of Neighbor and angular direction (in degrees, clockwise from north) surrounded by parentheses.
storage type: String
syntax: "North" | "Northeast" | "East" | "Southeast" | "South" | "Southwest" | "West" | "Northwest"?
The name of a side or corner of the map.
- North: The north edge of the map
- Northeast: The northeast corner of the map
- East: The east edge of the map
- Southeast: The southeast corner of the map
- South: The south edge of the map
- Southwest: The southwest corner of the map
- West: The west edge of the map
- Northwest: The northwest corner of the map
storage type: String
syntax: <integer>?
A reference to the 'fid' field in another table. This is stored as a String field because an unsigned integer field is not available.
storage type: String
syntax: <integer> | (<integer>,<Edge>) | <Edge>?
Specifies a type of neighbor for a tile. There are three possibilities. They are described by their contents, not their name, in order to simplify the NeighborDirection fields.
- Tile: a regular contiguous tile, which is specified by it's id.
- CrossMap: a tile that sits on the opposite side of the map, specified by it's id and direction as an 'Edge'.
- OffMap: unknown content that is off the edges of the map, specified merely by a direction as an 'Edge'
storage type: Integer
syntax: <integer>?
A signed integer.
storage type: String
syntax: <string>?
A string of text
storage type: Real
syntax: <real>
A real number.
storage type: String
syntax: "Branch" | "BranchingConfluence" | "BranchingLake" | "Confluence" | "Continuing" | "Lake" | "Source"
A name for how the river segment begins
- Branch: The segment begins with the splitting of another river
- BranchingConfluence: The segment begins with a split that coincides with a confluence in the same tile
- BranchingLake: The segment begins with a split coming out of a lake
- Confluence: The segment begins with the joining of two rivers
- Continuing: The segment begins at the end of a single other segment
- Lake: The segment begins at the outflow of a lake
- Source: The segment begins where no other segment ends, with enough waterflow to make a river
storage type: String
syntax: "Branch" | "BranchingConfluence" | "Confluence" | "Continuing" | "Mouth"
A name for how a river segment ends
- Branch: The segment ends by branching into multiple segments
- BranchingConfluence: The segment ends by branching where other segments also join
- Confluence: The segment ends by joining with another segment
- Continuing: The segment ends with the beginning of a single other segment
- Mouth: The segment ends by emptying into an ocean or lake
storage type: Integer
syntax: <integer>
A signed integer.
storage type: String
syntax: <string>
A string of text
storage type: String
syntax: (<integer>,<integer>)
A pair of unsigned integers in parentheses.