map2wxx

package module
v0.1.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: 6 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

map2wxx

map2wxx is a map converter: it reads a hex map written by hmz2map and writes it as a Worldographer map (.wxx), using the wxx reader and writer. It isn't part of the campaign-map pipeline; it only consumes the map.

The map is decoded with hmz2map's own Go types, so the schema is hmz2map's. map2wxx reads nothing else: not the heightmap, the climate file, or the rivers file.

Status

The converter is being built in small steps:

  1. Colored blank hexes (v0.1.0): every hex is Worldographer's Blank terrain, with its background colored as map2png fills it. This checks the geometry.
  2. Rivers, as Worldographer path shapes. Not yet written.
  3. Terrain, as Worldographer tile types. Not yet written.

Usage

go run ./cmd/map2wxx [flags] <map.json>

Flags:

  • -output <file> is the .wxx file to write. Required.
  • -app <version> is the Worldographer application version to write, such as 2.07. The default, current, is the newest version wxx writes (xmlio.CurrentApp(), 2.08 with wxx v0.48.0-beta); -h shows which version that is. A version wxx doesn't write is an error.
  • -version prints the version.

The command prints the time taken by each phase, the map size, and the application version it wrote.

map2wxx has no border option: it converts whatever map it is given. For a map with a deep-ocean border, give it the map from hmz2map -border.

Input

The input must have schema_version 1 (hmz2map.SchemaVersion) and layout "flat-top, 0-based, odd columns down" (hmz2map.Layout); any other value is an error. It must be at least 2 × 2 (the smallest map wxx makes) and list columns × rows hexes, ordered by row, then column, with col and row matching each position. A landform, surface, biome, or depth outside the terrain model is an error, since it has no color. map2wxx doesn't otherwise validate the map; hmz2map did.

Output

The map is built with xmlio.NewMap, so it carries the defaults the chosen application version writes for File > New World/Kingdom map: flat projection, WORLD view level, the grid and numbering, the map key, and the eight map layers.

Geometry

The map is COLUMNS: flat-top hexes with odd columns pushed down half a hex, which is hmz2map's layout. So no coordinates are converted: hex (col, row) is tile [col][row], and Worldographer's column and row numbers are hmz2map's. A columns × rows map is columns tiles wide and rows tiles high.

Hexes

Every tile's terrain is Blank, the only entry in the terrain table. Its custom background color (@bgColor) is map2png.FillColor of the hex, with each 8-bit component divided by 255; alpha is 1.

Testing

go test ./...

The tests check that every pair of hexes hmz2map calls neighbors is one hex apart on Worldographer's grid, that every tile is Blank with its map2png color after a write and a read in each version wxx writes, and that bad input and an unsupported -app are errors.

License

MIT; see LICENSE.

Documentation

Overview

Package map2wxx converts an hmz2map hex map into a Worldographer map.

Index

Constants

View Source
const AppCurrent = "current"

AppCurrent is the -app value that names the newest application version wxx writes (xmlio.CurrentApp).

Variables

This section is empty.

Functions

func Check

func Check(m *hmz2map.Map) error

Check returns an error if m is not a map map2wxx can convert: the wrong schema version or layout, or a hex list that doesn't match the map's size.

func CheckApp

func CheckApp(app string) error

CheckApp returns an error if wxx doesn't write application version app.

func Convert

func Convert(m *hmz2map.Map, app string) (*wxx.Map_t, error)

Convert returns m as a Worldographer map with the new-map defaults of application version app (a registered version such as "2.08"; see ResolveApp).

The Worldographer map is COLUMNS, which is hmz2map's odd-q layout: hex (col, row) is tile [col][row]. Every tile is Blank, with its background colored as map2png fills the hex.

func ResolveApp

func ResolveApp(app string) string

ResolveApp returns the application version an -app value names: app itself, or xmlio.CurrentApp() for AppCurrent. Whether wxx writes that version is checked by Convert.

func Version

func Version() semver.Version

Types

This section is empty.

Directories

Path Synopsis
cmd
map2wxx command
Command map2wxx converts an hmz2map hex map into a Worldographer map.
Command map2wxx converts an hmz2map hex map into a Worldographer map.

Jump to

Keyboard shortcuts

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