hmz2ter

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

hmz2ter

hmz2ter classifies each hex of the flat-top hex grid used by hmz2ele over a dem2hm heightmap (format 1.1). It gives each hex a landform (the game's physical geography), a depth for salt water, and flags such as coast, river, and impassable, and writes the result as JSON, with an optional PNG preview.

It does not assign final game terrain. Forest, grassland, tundra, desert, wetlands, and so on depend on climate, which is a later step.

Usage

go run ./cmd/hmz2ter [flags] <input.hmz>

Flags:

  • -apothem <px> sets the hex apothem in raster pixels. The default is 48.
  • -rivers <file> is an hmz2riv JSON file for the river flags. Optional; its grid must match.
  • -lake <name,lon,lat> names a point on a lake's surface. Repeatable. See Lakes.
  • -volcano <name,lon,lat> marks a volcano. Repeatable. The point must be in a land hex.
  • -output <file> is the JSON file to write. Required.
  • -preview <file> is a PNG preview to write. Optional.
  • -preview-scale <n> sets how many raster pixels, in each direction, one preview pixel covers. The default is 8.
  • -version prints the version.

The command prints the time taken by each phase and a summary: counts by landform, depth, and flag, and the number of salt-water hexes at each distance from land. A full run on the Panama heightmap (189 million pixels) takes about 7 seconds.

Hex statistics

Every pixel whose center lies in a hex counts toward that hex, so the statistics use all of the hex's pixels, not samples. Hexes on the raster's edge are clipped to the raster.

For each hex:

  • Pixels, valid pixels (not no-data), and land fraction: valid pixels above 0 m divided by pixels.
  • Elevation: the minimum, 5th percentile, median, 95th percentile, and maximum of the valid pixels, in meters. Percentiles are nearest-rank: the p-th percentile of n sorted values is value number ⌈p·n/100⌉.
  • Relief: the 95th percentile minus the 5th, in meters.

Relief uses the 5th to 95th percentiles instead of the minimum and maximum because the source is a surface model: tree canopy and buildings add spikes that would inflate the full range.

The center elevation is also copied from hmz2ele's 3 × 3 median sample, because it decides which hexes are land.

Landforms

Each hex gets a landform, using the game's names:

  1. fresh-water: more than half the hex's pixels are lake (see Lakes).

  2. Land: the center elevation is above 0 m, the same test hmz2ele uses. The landform comes from the relief:

    Landform Relief
    flats under 20 m
    plains 20 to 60 m
    rolling-plains 60 to 150 m
    hills 150 to 350 m
    mountains 350 m and over

    A land hex with a median elevation of 500 m or more and relief under 150 m is plateaus instead, and a plateau whose center is within 25 km of a volcano is volcanic-highlands. The 25 km is real (source) distance, about 8.5 hexes at apothem 48, because it describes the ground around the volcano; see Units.

  3. Border cut: a hex with more foreign no-data pixels than other no-data pixels (see Border cuts). A cut next to land becomes cliffs if it also touches water, another cut, or the grid's edge, and badlands if land surrounds it. Other cuts become salt water.

  4. salt-water: everything else.

There is no alpine landform: the alpine line depends on latitude, so the climate step decides it from the median elevation, as a biome.

Salt water also gets a depth from its distance to land, counted in hex steps from the nearest hex that isn't salt water (land, fresh water, cliffs, or badlands), through salt water only:

Depth Distance
shallow 1 to 12
open 13 to 19
deep 20 and more

Salt water that nothing reaches is deep. The source has no sea depths, so depth is distance.

Units

Rules about the ground use source units, so they keep describing the same ground if the hex size changes: relief and cliff heights in meters, lake size and border chains in pixels, and the volcanic-highlands radius in real kilometers (pixels × the heightmap's pixel_size_m). Rules about play use hexes, so they keep playing the same: depth bands, inland-sea straits, and coast. Real kilometers are not campaign kilometers: the campaign map is about 3.4 times real scale, and a hex is always 10 campaign km.

Surface and biome

The climate step sets each land hex's surface and biome, so hmz2ter leaves them unset. Water, cliffs, and badlands have no surface condition and no biome, so hmz2ter sets both to clear.

Lakes

A level is a set of 4-connected pixels that all have the same elevation above 0 m and together cover at least one hex's area (about 7,981 pixels at apothem 48). The source flattened its water bodies, so every lake is a level.

Not every level is a lake, though. On the Panama heightmap there are 66 levels, and only 6 of them are lakes. The rest are coastal wetlands and salt pans, wide stepped river reaches in Darién, and a few flat patches in the hills that look like filled data voids. Their shapes and settings don't separate them from lakes reliably, so each lake is chosen by a seed: a -lake point on its surface. A lake can have several levels; Gatun Lake has two (28 m and 29 m) and Lake Bayano has three (59, 60, and 62 m), so each level needs its own seed. A seed that is not on a level, or two lakes' seeds on one level, is an error.

A hex is a lake if more than half its pixels are lake. Levels that aren't lakes set the flat-surface flag on land instead.

Border cuts

The source was cut to Panama's borders, so no-data is both sea and foreign land, and land ends at the border in a sheer cliff.

  1. An edge pixel is a valid pixel with a no-data pixel among its 8 neighbors.
  2. A cliff pixel is an edge pixel above 10 m.
  3. A border pixel is a cliff pixel in an 8-connected chain of at least 1,000 cliff pixels. Sea cliffs are short: on the Panama heightmap, the Costa Rica and Colombia cuts are two chains of about 12,800 and 14,100 pixels, and the next-longest chain is 376 pixels.
  4. A no-data pixel is foreign if it is strictly closer to a border pixel than to any other edge pixel, measured in 8-neighbor steps straight across the raster.

Foreign no-data is the parts of Costa Rica and Colombia inside the raster. The game world has no neighboring countries, so the border cuts become cliffs, badlands, or sea.

The threshold is 10 m rather than 30 m because at 30 m the Costa Rica cut breaks where it crosses the Pacific lowland near Paso Canoas, at 15 to 30 m, and sea would leak into Costa Rica through the gap.

Inland seas

An inland sea is a body of salt water cut off from the open sea by a narrow strait.

  1. Salt water more than 1 hex from land is wide water. Each connected body of wide water is open sea if it reaches the grid's edge.
  2. The rest of the salt water joins the nearest body, stepping through salt water. A hex that two bodies reach at the same step joins an open body if either is open, and otherwise the body numbered lowest; bodies are numbered in hex order.
  3. Salt water that no body reaches forms bodies of its own.
  4. A body that doesn't reach the grid's edge, with at least 30 hexes, is an inland sea.

So a body's connection to the open sea, if it has one, is a strait whose hexes are all next to land: 2 hexes wide at most. On the Panama map this finds two inland seas: Bahía de Almirante, with 51 hexes, and Golfo de Montijo, with 47.

Flags

  • coast: land next to salt water, or salt water next to a hex that isn't salt water. Lakes don't make coast. Small boats can travel in coast water and in the water next to it: up to 2 hexes from land.
  • river: land with a river on at least one of its six edges, from the -rivers file.
  • volcano: land holding a -volcano point.
  • inland-sea: salt water in an inland sea.
  • impassable: every cliff and badland hex, and land holding at least one border pixel. The game treats these hexes as impassable by normal means.
  • flat-surface: land where more than half the pixels are levels that aren't lakes: a hint for the climate step's wetlands, mangroves, and salt flats.

Output

Elevations are in meters.

{
  "hmz2ter_version": "0.2.0",
  "heightmap": { "file_name": "pandemokh.hmz", "metadata": { ... } },
  "grid": { "apothem_px": 48, "side_px": 55.43, "columns": 106, "rows": 222, "hex_count": 23479, "hex_area_px": 7981.3 },
  "rivers": { "file_name": "pandemokh-a48-rivers.json", "hmz2riv_version": "0.3.0", "threshold_km2": 50 },
  "rules": { "flats_below_m": 20, ..., "open_max_hexes": 19, "inland_min_hexes": 30, "cliff_above_m": 10, "border_min_pixels": 1000 },
  "method": { "statistics": "...", "lakes": "...", "borders": "...", "cuts": "...", "sea": "...", "inland_seas": "..." },
  "lakes": [ { "name": "Gatun", "seed": { "name": "Gatun", "lon": -79.9038, "lat": 9.1879 }, "elevation_m": 28, "pixels": 294226 }, ... ],
  "volcanoes": [ { "name": "Barú", "lon": -82.543, "lat": 8.808, "col": 70, "row": 19 }, ... ],
  "stats": { "landforms": { ... }, "depths": { ... }, "flags": { ... }, "sea_distance": [ 0, 1280, 1120, ... ], ... },
  "hexes": [
    { "col": 48, "row": 0, "landform": "cliffs", "surface": "clear", "biome": "clear", "flags": [ "impassable" ], "center": null,
      "pixels": 7982, "valid_pixels": 835, "land_fraction": 0.1046,
      "elevation": { "min": 346, "p5": 366, "median": 423, "p95": 495, "max": 513 }, "relief_m": 129 },
    { "col": 50, "row": 3, "landform": "hills", "flags": [ "river" ], "center": 123,
      "pixels": 7982, "valid_pixels": 7982, "land_fraction": 1,
      "elevation": { "min": 83, "p5": 94, "median": 145, "p95": 258, "max": 369 }, "relief_m": 164 },
    { "col": 36, "row": 7, "landform": "salt-water", "surface": "clear", "biome": "clear", "depth": "shallow", "sea_distance": 1,
      "flags": [ "coast" ], "center": null, "pixels": 7982, "valid_pixels": 942, "land_fraction": 0.1175, ... },
    ...
  ]
}

surface and biome are omitted while unset. depth and sea_distance are set for salt water only. elevation and relief_m are null for a hex with no valid pixels. stats.sea_distance[d] is the number of salt-water hexes d steps from the nearest hex that isn't salt water. Hexes are ordered by row, then column.

Preview

The preview is the hmz2ele preview with each hex refilled: land by landform, from pale green (flats) through tan (hills) to brown (mountains), with plateaus orange and volcanic highlands rust; fresh water bright blue; salt water in blues, lightest for coast water and darker with depth; inland seas teal; cliffs red and badlands dark purple; impassable land dark red; volcano hexes magenta. Rivers are drawn along hex edges in dark blue.

License

MIT. See LICENSE.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Borders

func Borders(width, height int, data []int16, cliffAbove int16, minPixels int) (border, shore []bool)

Borders finds where the raster was cut along a national border rather than along a coast.

An edge pixel is a valid pixel with a no-data pixel among its 8 neighbors. A cliff pixel is an edge pixel above cliffAbove meters. The source was cut to the country's borders, so land there stops above sea level; sea cliffs exist too, but they are short. Border pixels are the cliff pixels in 8-connected chains of at least minPixels.

Borders returns the border pixels and the other edge pixels, the shore.

func ForeignPixels

func ForeignPixels(width, height int, data []int16, border, shore []bool) []bool

ForeignPixels reports, for each pixel, whether it is no-data on the far side of a border cut: foreign land, not sea. A no-data pixel is foreign when it is strictly closer to a border pixel than to a shore pixel, measuring distance in the chessboard metric (8-neighbor steps) straight across the raster.

func HexArea

func HexArea(apothem int) float64

HexArea returns the area of one hex in pixels.

func HexIndex

func HexIndex(g hmz2ele.Grid) []int32

HexIndex returns, for every pixel of a width × height raster, the slot of the hex that contains the pixel's center, or -1 if that hex is not in the grid.

func RenderPreview

func RenderPreview(g hmz2ele.Grid, centers []hmz2ele.Hex, hexes []Hex, rivers []hmz2riv.EdgeJSON, scale int) (*image.RGBA, error)

RenderPreview draws the hmz2ele preview, then fills each hex with its color (see hexColor), keeping the hex outlines. Rivers are drawn along hex edges.

func RiverSlots

func RiverSlots(g hmz2ele.Grid, rivers *hmz2riv.Rivers) (map[int]bool, error)

RiverSlots returns the slots of every hex on either side of a river edge.

func Slot

func Slot(g hmz2ele.Grid, col, row int) int

Slot numbers a hex in the grid's Columns × Rows rectangle: row × Columns + col.

func Version

func Version() semver.Version

Types

type Biome

type Biome string

Biome is a hex's ecology. hmz2ter sets only Clear, on hexes with no biome; the climate step sets the rest.

const (
	BiomeEmpty Biome = ""
	BiomeClear Biome = "clear"
)

type Depth

type Depth string

Depth is a salt-water hex's depth band, from its distance to land.

const (
	DepthNone Depth = ""
	Shallow   Depth = "shallow"
	Open      Depth = "open"
	Deep      Depth = "deep"
)

type ElevationJSON

type ElevationJSON struct {
	Min    int16 `json:"min"`
	P5     int16 `json:"p5"`
	Median int16 `json:"median"`
	P95    int16 `json:"p95"`
	Max    int16 `json:"max"`
}

ElevationJSON is a hex's elevation percentiles, in meters.

type Flag

type Flag string

Flag marks a feature that combines with a landform.

const (
	// Coast is land next to salt water, or salt water next to land.
	Coast Flag = "coast"
	// River is land with a river on at least one of its edges.
	River Flag = "river"
	// Volcano is land holding a listed volcano.
	Volcano Flag = "volcano"
	// InlandSea is salt water in a body cut off from the open sea by a
	// narrow strait.
	InlandSea Flag = "inland-sea"
	// Impassable is set on every cliff and badland hex and on the land
	// along a border cut.
	Impassable Flag = "impassable"
	// FlatSurface is land mostly covered by levels that aren't lakes: a
	// wetland, salt pan, wide river, or filled void in the source. It is a
	// hint for the climate step.
	FlatSurface Flag = "flat-surface"
)

type GridInfo

type GridInfo struct {
	ApothemPx int     `json:"apothem_px"`
	SidePx    float64 `json:"side_px"`
	Columns   int     `json:"columns"`
	Rows      int     `json:"rows"`
	HexCount  int     `json:"hex_count"`
	HexAreaPx float64 `json:"hex_area_px"`
}

GridInfo identifies the hex grid.

type HeightmapInfo

type HeightmapInfo struct {
	FileName string          `json:"file_name"`
	Metadata dem2hm.Metadata `json:"metadata"`
}

HeightmapInfo identifies the heightmap the terrain was classified from.

type Hex

type Hex struct {
	Col, Row int
	Stats    PixelStats
	// Center is the hex's center elevation, sampled as hmz2ele does, or nil
	// for no-data.
	Center   *int16
	Landform Landform
	Surface  Surface
	Biome    Biome
	Depth    Depth
	// SeaDistance is, for salt water, the number of steps from the nearest
	// hex that isn't salt water, or -1 if there is none. It is 0 for other
	// hexes.
	SeaDistance int
	Flags       []Flag
}

Hex is one hex's terrain.

func Classify

func Classify(in Inputs) ([]Hex, error)

Classify returns every hex in the grid, ordered by row, then column.

A hex is fresh water if more than half its pixels are lake. Otherwise it is land if its center elevation is above 0 m, as in hmz2ele. Otherwise it is a border cut if it has more foreign no-data pixels than other no-data pixels, and salt water if not.

A cut next to land becomes cliffs if it also touches water, another cut, or the grid's edge, and badlands if land surrounds it. Other cuts become salt water.

type HexJSON

type HexJSON struct {
	Col          int            `json:"col"`
	Row          int            `json:"row"`
	Landform     Landform       `json:"landform"`
	Surface      Surface        `json:"surface,omitempty"`
	Biome        Biome          `json:"biome,omitempty"`
	Depth        Depth          `json:"depth,omitempty"`
	SeaDistance  *int           `json:"sea_distance,omitempty"`
	Flags        []Flag         `json:"flags,omitempty"`
	Center       *int16         `json:"center"`
	Pixels       int            `json:"pixels"`
	ValidPixels  int            `json:"valid_pixels"`
	LandFraction float64        `json:"land_fraction"`
	Elevation    *ElevationJSON `json:"elevation"`
	ReliefM      *int           `json:"relief_m"`
}

HexJSON is one hex. Surface and Biome are omitted while unset; the climate step sets them for land. Elevation and ReliefM are nil for a hex with no valid pixels.

func HexesJSON

func HexesJSON(hexes []Hex) []HexJSON

HexesJSON converts hexes for output.

type Inputs

type Inputs struct {
	Grid  hmz2ele.Grid
	Rules Rules
	// Centers are hmz2ele's center samples, one per hex in the grid.
	Centers []hmz2ele.Hex
	// Stats, and the pixel counts below, are indexed by slot.
	Stats []PixelStats
	// LakePixels and FlatPixels count lake pixels and other level pixels.
	LakePixels, FlatPixels []int
	// ForeignPixels and SeaPixels count foreign and other no-data pixels.
	ForeignPixels, SeaPixels []int
	// BorderPixels counts border pixels.
	BorderPixels []int
	// RiverSlots and VolcanoSlots are the slots with a river edge and with
	// a volcano.
	RiverSlots, VolcanoSlots map[int]bool
	// Volcanoes are the volcanoes' positions in raster pixels, and
	// PixelSizeM is the real size of a pixel, in meters.
	Volcanoes  [][2]float64
	PixelSizeM float64
}

Inputs are the per-pixel and per-slot facts that Classify combines.

type LakeJSON

type LakeJSON struct {
	Name       string `json:"name"`
	Seed       Place  `json:"seed"`
	ElevationM int16  `json:"elevation_m"`
	Pixels     int    `json:"pixels"`
}

LakeJSON is one level chosen as a lake by a seed.

type Landform

type Landform string

Landform is a hex's underlying physical geography. The names are the game's.

const (
	// LandformEmpty is unset. It is an error in the output.
	LandformEmpty     Landform = ""
	FreshWater        Landform = "fresh-water"
	SaltWater         Landform = "salt-water"
	Flats             Landform = "flats"
	Plains            Landform = "plains"
	RollingPlains     Landform = "rolling-plains"
	Hills             Landform = "hills"
	Mountains         Landform = "mountains"
	Plateaus          Landform = "plateaus"
	VolcanicHighlands Landform = "volcanic-highlands"
	// Cliffs and Badlands are border-cut hexes: impassable by normal means.
	Cliffs   Landform = "cliffs"
	Badlands Landform = "badlands"
)

func (Landform) IsLand

func (l Landform) IsLand() bool

IsLand reports whether the landform is passable land shaped by relief.

type Level

type Level struct {
	// Lake is the name of the lake whose seed lies on the level, or "" if
	// no seed does.
	Lake string
	// Seed is the index of the first seed on the level, or -1.
	Seed      int
	Elevation int16
	Pixels    int
	// SlotPixels counts the level's pixels in each slot.
	SlotPixels map[int32]int
}

Level is a connected surface of pixels, 4-connected, that all have the same elevation above 0 m and together cover at least one hex's area.

The source is a surface model whose water bodies were flattened, so lakes are levels. So are wide rivers, coastal wetlands, salt pans, and patches of filled voids, which is why lakes are chosen by seed points.

func FindLevels

func FindLevels(width, height int, data []int16, index []int32, minPixels float64, seeds map[int]int, names []string) ([]Level, error)

FindLevels returns every level of at least minPixels pixels, in raster order of their first pixel. seeds maps a pixel index to a lake seed's index in names; a level holding a seed is that lake. It is an error for a seed to miss every level, or for one level to hold seeds of two different lakes.

type MethodInfo

type MethodInfo struct {
	Statistics string `json:"statistics"`
	Lakes      string `json:"lakes"`
	Borders    string `json:"borders"`
	Cuts       string `json:"cuts"`
	Sea        string `json:"sea"`
	InlandSeas string `json:"inland_seas"`
}

MethodInfo describes the rules that Rules doesn't hold.

type PixelStats

type PixelStats struct {
	// Pixels is the number of raster pixels in the hex; hexes on the
	// raster's edge are clipped.
	Pixels int
	// Valid is the number of pixels that are not no-data.
	Valid int
	// Land is the number of valid pixels above 0 m.
	Land int
	// Min, P5, Median, P95, and Max are nearest-rank percentiles of the
	// valid pixels' elevations.
	Min, P5, Median, P95, Max int16
}

PixelStats summarizes every pixel in one hex. Elevations are in meters and are zero when the hex has no valid pixels.

func ComputeStats

func ComputeStats(g hmz2ele.Grid, data []int16, index []int32) []PixelStats

ComputeStats returns the statistics of every slot's pixels.

func (PixelStats) Relief

func (s PixelStats) Relief() int

Relief is the spread between the 95th and 5th percentiles.

type Place

type Place struct {
	Name string  `json:"name"`
	Lon  float64 `json:"lon"`
	Lat  float64 `json:"lat"`
}

Place is a named point, such as a lake seed or a volcano.

func ParsePlace

func ParsePlace(s string) (Place, error)

ParsePlace parses "name,lon,lat".

func (Place) Pixel

func (p Place) Pixel(hm *dem2hm.HeightMap16) (int, error)

Pixel returns the index of the heightmap pixel under the place.

func (Place) String

func (p Place) String() string

type RiversInfo

type RiversInfo struct {
	FileName       string  `json:"file_name"`
	Hmz2rivVersion string  `json:"hmz2riv_version"`
	ThresholdKm2   float64 `json:"threshold_km2"`
}

RiversInfo identifies the hmz2riv output the river flags came from.

type Rules

type Rules struct {
	// A land hex's landform comes from its relief (p95 − p5): flats below
	// FlatsBelow, plains below PlainsBelow, rolling plains below
	// RollingBelow, hills below HillsBelow, and mountains otherwise.
	FlatsBelow   int `json:"flats_below_m"`
	PlainsBelow  int `json:"plains_below_m"`
	RollingBelow int `json:"rolling_plains_below_m"`
	HillsBelow   int `json:"hills_below_m"`
	// A land hex with a median elevation of at least PlateauMinMedian and
	// relief below PlateauBelow is a plateau, whatever its relief class.
	PlateauMinMedian int `json:"plateau_min_median_m"`
	PlateauBelow     int `json:"plateau_below_m"`
	// A plateau whose center is within VolcanicRadiusRealKm of a volcano is
	// a volcanic highland. The radius is in real (source) kilometers, not
	// campaign kilometers, because it describes the ground, and so doesn't
	// change with the hex size.
	VolcanicRadiusRealKm float64 `json:"volcanic_radius_real_km"`

	// Salt water up to ShallowMax hexes from land is shallow, up to OpenMax
	// is open, and farther out is deep.
	ShallowMax int `json:"shallow_max_hexes"`
	OpenMax    int `json:"open_max_hexes"`

	// A body of salt water is an inland sea if it has at least
	// InlandMinHexes hexes and is cut off from the open sea by removing
	// the salt water within StraitMax hexes of land.
	StraitMax      int `json:"strait_max_hexes"`
	InlandMinHexes int `json:"inland_min_hexes"`

	// A border cut is a chain of at least BorderMinPixels 8-connected land
	// pixels, each above CliffAbove meters and touching no-data.
	CliffAbove      int16 `json:"cliff_above_m"`
	BorderMinPixels int   `json:"border_min_pixels"`
}

Rules holds the thresholds that classify hexes. Elevations and relief are in meters. Rules about the ground use source units (real meters, kilometers, or pixels); rules about play, such as depth, use hexes.

func DefaultRules

func DefaultRules() Rules

DefaultRules returns the campaign's rules.

func (Rules) Depth

func (r Rules) Depth(distance int) Depth

Depth returns the depth band of salt water at the given distance from land.

func (Rules) Landform

func (r Rules) Landform(relief, median int) Landform

Landform returns the landform for a land hex's relief and median elevation. It never returns VolcanicHighlands, which depends on where the volcanoes are.

type Stats

type Stats struct {
	Landforms      map[Landform]int `json:"landforms"`
	Depths         map[Depth]int    `json:"depths"`
	Flags          map[Flag]int     `json:"flags"`
	SeaDistance    []int            `json:"sea_distance"`
	UnreachableSea int              `json:"unreachable_sea"`
	BorderPixels   int              `json:"border_pixels"`
	ForeignPixels  int              `json:"foreign_pixels"`
	OtherLevels    int              `json:"other_levels"`
}

Stats counts the hexes. SeaDistance[d] is the number of salt-water hexes d steps from the nearest hex that isn't salt water; UnreachableSea counts salt-water hexes that no such hex reaches.

func Summarize

func Summarize(hexes []Hex) Stats

Summarize counts the hexes.

type Surface

type Surface string

Surface is a hex's surface or hydrological condition. hmz2ter sets only Clear, on hexes whose surface can't change; the climate step sets the rest.

const (
	SurfaceEmpty Surface = ""
	SurfaceClear Surface = "clear"
)

type Terrain

type Terrain struct {
	Hmz2terVersion string        `json:"hmz2ter_version"`
	Heightmap      HeightmapInfo `json:"heightmap"`
	Grid           GridInfo      `json:"grid"`
	Rivers         RiversInfo    `json:"rivers"`
	Rules          Rules         `json:"rules"`
	Method         MethodInfo    `json:"method"`
	Lakes          []LakeJSON    `json:"lakes"`
	Volcanoes      []VolcanoJSON `json:"volcanoes"`
	Stats          Stats         `json:"stats"`
	Hexes          []HexJSON     `json:"hexes"`
}

Terrain is the classified hex grid, as written to JSON.

type VolcanoJSON

type VolcanoJSON struct {
	Place
	Col int `json:"col"`
	Row int `json:"row"`
}

VolcanoJSON is a listed volcano and the hex that holds it.

Directories

Path Synopsis
cmd
hmz2ter command
Command hmz2ter classifies each hex of a flat-top hex grid over a dem2hm heightmap (format 1.1) by landform and water, sets flags such as coast, cliff, and river, and writes the result as JSON, with an optional PNG preview.
Command hmz2ter classifies each hex of a flat-top hex grid over a dem2hm heightmap (format 1.1) by landform and water, sets flags such as coast, cliff, and river, and writes the result as JSON, with an optional PNG preview.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL