XML

## Introduction

Hello everybody and welcome to the XML Guide. This guide will teach you how to write the XML code for your map. To make it easier to follow and to consult, this guide is divided in three different parts. The first part is an Overview section about what's "the map XML", why you need it if you want to make a map, and how it works. The second part is a quick Tutorial. In that part we will first create the XML for the Classic map. After that,in the third part, the XML Tags Index, we will look more in depth the code structure, understand any single feature currently available and finally we will learn how to use the advanced features like objectives, autodeploy, or killing neutrals, etc.

But before to start, a very special "Thank You!" for contributing with the development of this XML Guide goes to OliverFA, MrBenn, ender516, natty dread and the whole Cartographers Team

Pretty graphics are not enough to make a successful map. You also need to think up good gameplay rules and write them down in an XML file. This tutorial will explain how to do that. Don't worry, you don't need any technical skills or special software. Just pay attention and fire up your favourite text editor, such as **notepad**.

## Header

First of all, your XML file must begin with this on the first line:

```
<?xml version="1.0" encoding="UTF-8"?>
```

Don't worry about understanding it – it's a special tag that tells the game engine that this is an XML file. The

It is customary to indent tags when they are nested inside other tags and put one tag on each line. This isn't necessary but makes your XML easier to read.

## Tags and comments

### Map tags

Tags, please notice that tags must come in pairs. There is an opening <tag> and a closing </tag>. They are named the same, except that the closing tag has a slash. Everything between the opening and closing tags is considered to be information describing that element. As an example, most map elements will have sub-tags inside describing their names.

### Comments

A comment is a tag in the style
```
<!-- Comment -->
```
. Although comments are optional, it's a good practice to use comments to structure your code, and also to help understand it and navigate through it.
## Territories

Territories are the basic unit for constructing any map. The map is described by a collection of territories, how they connect to each other, and how they group in continents. Territories always have an owner (even if it's the "neutral" player) and each player needs at least one territory to stay alive. Troops are placed in territories, and battles are fought for the control of such territories. In some parts of Conquer Club, territories are referred to as regions.

A territory is described by the tag of the same name, <territory>.
Nested inside the <territory>tag there are other sub-tags that describe all the properties of that territory.

### Naming a territory

We use the <name> tag to name a territory. In this example we will start by the Anchorage city, as it is the first in alphabetic order (this doesn't mean you have to do the same, in fact the game engine lists the territories in alphabetical order in any case).

```
<territory>
      <name>Anchorage</name>
</territory>
```

### Setting coordinates on map

How does the CC engine know where to place the armies numbers for each territory? We provide this information via the Fatal error: The format of the coordinate could not be determined. Parsing failed.

 </territory>
### Borders with other territories

Now we have a city in our map. But it is isolated without connections with any other city. To link territories, we use the <borders> tag. Inside this tag there will be a <border> sub-tag for each territory that borders the one we are describing. Looking at the image, there are three cities bordering Anchorage. So we place all of them in our code.

```
   <territory>
      <borders>
         <border>Edmonton</border>
         <border>Vancouver</border>
         <border>Magadan</border>
      </borders>
   </territory>
```

An important thing to remember is that borders are only one way, like adjacencies in a graph. This means that Edmonton, and Magadan also need to have in their own descriptions a <border> withAnchorage. If we linked Anchorage with Edmonton, but forgot linking Edmonton to Anchorage>, we would make it a one way trip. We would be able to go from to , but we would not be able to come back.

### Coordinates

SXCoord: The value of the X Coordinate, in pixels, for the small map.
SYCoord: The value of the Y Coordinate, in pixels, for the small map.
LXCoord: The value of the X Coordinate, in pixels, for the large map.
LYCoord: The value of the Y Coordinate, in pixels, for the large map.

### Territory Summary

This is how it looks when we put everything together(keep in mind code order as it is important):

```
   <territory>
      <name>Anchorage</name>
      <borders>
         <border>Edmonton</border>
         <border>Vancouver</border>
         <border>Magadan</border>
      </borders>
      <coordinates>
         <smallx>30</smallx>
         <smally>125</smally>
         <largex>35</largex>
         <largey>145</largey>
      </coordinates>
   </territory>
```

## Continents

Continents are groups of territories that provide an extra bonus when held together at the beginning of a turn. In the Classic map Africa is a continent, but America is divided in two continents (North America andSouth America). We describe continents in our XML file by using the <continent> tag.

```
   <continent>
   </continent>
```

Notice that depending on the map theme, "Continents" could be something different from the geographical continents. They could be other zones of the map that share something in common. For this reason they are also called bonus zones<. As said, a continent is a group of territories.

Similar to what happened with territories, the <continent> tag contains other tags nested inside that define the different properties of that bonus region.

### Naming continents

We use the <name> tag to name a continent. The following example is how you would name Africa.

```
   <continent>
      <name>Africa</name>
   </continent>
```

### Naming continent components

Inside the <components>tag we list all the components of that continent. This will tell the engine which territories a player has to own at the beginning of the turn to receive the zone bonus. Let's list the territories that form Africa.

```
   <continent>
      <components>
         <territory>Dakar</territory>
         <territory>Cairo</territory>
         <territory>Nairobi</territory>
         <territory>Lagos</territory>
         <territory>Cape Town</territory>
         <territory>Johannesburg</territory>
      </components>
   </continent>
```

### Continent bonus

We know how to name continents and how to specify the territories that form that continent. The last thing left is saying how many troops a player receives for holding the continent at the beginning of the turn. We specify that information with the <bonus> tag. For Africa, the bonus tag looks like this:

```
   <continent>
      <bonus>3</bonus>
   </continent>
```

### Continent within continent

The 13 Colonies map shows that is possible to use the <continent> tag as component. In this case, the 3 bonus troops are awarded if the player holds any 2 of the component continents.

```
...
<continent>
   <name>2 colonies</name>
   <bonus>3</bonus>
   <components>
      <continent>Georgia</continent>
      <continent>South Carolina</continent>
      <continent>North Carolina</continent>
      <continent>Virginia</continent>
      <continent>Maryland</continent>
      <continent>Delaware</continent>
      <continent>Pennsylvania</continent>
      <continent>New Jersey</continent>
      <continent>New York</continent>
      <continent>Connecticut</continent>
      <continent>Rhode Island</continent>
      <continent>Massachusetts</continent>
      <continent>New Hampshire</continent>
      <required>2</required>
    </components>
...
```

### Continent summary

```
   <continent>
      <name>Africa</name>
      <bonus>3</bonus>
      <components>
         <territory>Dakar</territory>
         <territory>Cairo</territory>
         <territory>Nairobi</territory>
         <territory>Lagos</territory>
         <territory>Cape Town</territory>
         <territory>Johannesburg</territory>
      </components>
   </continent>
```

## Minimum reinforcements

Adjusts the value of minimum reinforcements for the map. At the beginning of every turn, each player is guaranteed to get at least the number of troops specified in this tag, no matter how many territories or bonuses he has.

Syntax
<minreinforcement>Number or troops</minreinforcement>

Number of troops: The minimum of troops we want players to receive at the beginning of each turn.

Notes:
If this tag is not specified, the map will have a default value of 3 troops minimum.

The minimum number of reinforcement troops can't be 0. It has to be at least 1.

Location:
It goes after the opening <map> tag and before the <reinforcements> tag.

Example:
Imagine we want to eliminate the standard minimum of 3 troops. We can do it by setting the value to 1. (It can't be 0). The City Mogul map does it.

```
<minreinforcement>1</minreinforcement>
```