From The Battle for Wesnoth Wiki
Revision as of 14:54, 9 July 2005 by WikiSysop (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Wesnoth map data format

Map data is used to represent maps in Wesnoth. Map data is used in three ways. First, it is used as an input to the key map_data (see ScenarioWML). Second, files consisting entirely of map data can be read and edited easily by the WesnothMapEditor. Finally, files in the folder ~wesnoth/editor/maps/ which consist entirely of map data can be played in multiplayer as user maps.

The encoding for maps has a specific format:

A map data file consists of any number of lines, each with the same number of characters. Each character must be either a letter specified in a letter key specifying a terrain (see TerrainLettersWML), or a digit. When the file is interpreted, each letter will be replaced by the terrain it refers to. Each nonzero digit n will be replaced by keep, with the leader of side n placed on the keep.

Since text file tiles are squares while game tiles are hexes, some tiles must be shifted. Tiles in even-numbered columns are shifted down 1/2 of a tile. For example, to have a road of connected dirt ('r') tiles, the map data would look like this:


See Also