Difference between revisions of "BuildingMaps"

From The Battle for Wesnoth Wiki
m (See Also)
m (Wesnoth map data format)
Line 1: Line 1:
 
== Wesnoth map data format ==
 
== Wesnoth map data format ==
  
Map data is used to represent maps in Wesnoth.
+
Map data is used to represent maps in Wesnoth. The encoding for maps has a specific format:
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.
+
* A map data file consists of any number of lines, each with the same number of characters.
Each character must be either
+
* Each character must be either a letter specified in a ''letter'' key specifying a terrain (see [[TerrainLettersWML]]), or a digit.
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.
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.
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.
 
Since text file tiles are squares while game tiles are hexes, some tiles must be shifted.
Line 25: Line 15:
 
  grrgg
 
  grrgg
 
  rgggg
 
  rgggg
 +
 +
Map data is used in three ways.
 +
# It is used as an input to the key ''map_data'' (see [[ScenarioWML]]).
 +
# Files consisting entirely of map data can be read and edited easily by the [[WesnothMapEditor]].
 +
# Files in the folder '''~wesnoth/editor/maps/''' which consist entirely of map data can be played in multiplayer as user maps.
  
 
== See Also ==
 
== See Also ==

Revision as of 18:46, 15 September 2005

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