BuildingMaps

From The Battle for Wesnoth Wiki
Revision as of 18:46, 15 September 2005 by Scott (talk | contribs) (Wesnoth map data format)

Wesnoth map data format

Map data is used to represent maps in Wesnoth. 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 where n = 1, 2, 3, ... 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:

gggrr
grrgg
rgggg

Map data is used in three ways.

  1. It is used as an input to the key map_data (see ScenarioWML).
  2. Files consisting entirely of map data can be read and edited easily by the WesnothMapEditor.
  3. Files in the folder ~wesnoth/editor/maps/ which consist entirely of map data can be played in multiplayer as user maps.

See Also