BuildingMaps

From The Battle for Wesnoth Wiki
Revision as of 08:04, 20 February 2014 by Vultraz (talk | contribs)

A map is the most basic of user made content you can create. Complex scenarios can be developed on them, or they can be played on their own as simple battlefields with with no extra work required.

Wesnoth features a fully featured map editor, accessible from the Map Editor option at the main menu. Inside you will find all the tools you need to create your own arenas to stage your adventures.

Inside the individual map files themselves are simply terrain codes that the games translates into graphics when you play. Usually you will never have to edit these files manually, but it can come in handy to understand the format. For more on terrain codes and the map data format, see the TerrainCodesWML page as well as below.

For further instructions on how to distribute your completed maps, see BuildingMapsDistribution.

Creating a map

Making good, balanced, interesting maps is an art unto itself. ESR has a handy beginners guide in his Campaign Design How-To article. You can also ask for assistance on the Multiplayer Development forum.

Map data format

This is not the Matrix. You normally don't need to look at encoded maps. However, it can be beneficial and useful for more advanced users to understand the format. The encoding for maps has a specific format in Wesnoth:

  • A map starts with a header with the following keys
    • usage, this should be 'map' for a map and 'mask' for an overlay mask
    • border_size, the size of the border, should be 1 for map and 0 for mask. When the border_size is 1 the map border is part of the map data, this means the user can define the border instead of the game taking a guess.
  • Between the header and the data should be 1 empty line
  • A map data file consists of any number of lines, each with the same number of strings.
  • Each string must be a string specified in a string key specifying a terrain (see TerrainLettersWML).
  • Each string may be padded with spaces or tabs and must be separated with a comma, except for the last string on a line this one may not have a comma.
  • When the file is interpreted, each string will be replaced by the terrain it refers to.
  • Empty lines are allowed before, after and between lines of characters, between lines is not advised.
  • Terrains may be prefixed with a number followed by one space, these indicate the starting position for side n. n = 1, 2, 3, ... 9 (more might work but is untested and unsupported). This is a change from the previous system where a starting position was automatically a 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 ('Re') tiles, the map data would look like this:

usage=map
border_size=1

Re, Re, Gg, Gg, Gg, Gg, Gg, Gg
Gg, Gg, Re, Re, Gg, Gg, Gg, Gg
Gg, Gg, Gg, Gg, Re, Re, Gg, Gg
Gg, Gg, Gg, Gg, Gg, Gg, Re, Re

So now what?

You've created an awesome map with the map editor and you're ready to test it out. But how can you do this? It's actually quite simple.

Play your map

If you just want to play the map, maybe against the computer or with a friend, all you have to do is save it into the map editor's folder (the default location). Then, when you launch the game and host a multiplayer game, the map should appear at the top of the map choices screen.

When creating a game on the multiplayer server, your map will be described to other players as a "User Map" and any replays stored on the server will refer to the game as "User Map."

For the curious: Saving a map file like this creates a stand-alone file that holds the map data. That file is by default saved in userdata/editor/maps/, and maps in that location are added to the top of the multiplayer map selection list.

Share your map

When you're ready to share your map with the world, post it to the Multiplayer Development forum or package it to be distributed on the in-game add-ons server. For instructions on how to distribute maps, see BuildingMapsDistribution

Note

There is a proposed update for the map format coming up soon. Please read this to find out more.

New map format

See Also