XML Tutorial
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.
Tags
XML is made up of tags. Tags let the game engine know which information means what. Tags are surrounded with <angled brackets> and come in pairs – one for <opening> and one for </closing>. For example, this is how you specify the name of a country with tags:
Code: Select all
<name>Western United States</name>First of all, your XML file must begin with this on the first line:
Code: Select all
<?xml version="1.0"?>Next you need a map tag which will contain everything else.
Code: Select all
<?xml version="1.0"?>
<map>
.
.
.
</map>Territories
Next we specify the territories on your map. Inside the map tag, include one pair of <territory> tags for each territory. For each territory you'll also need to specify <name>, <borders> and <coordinates>. Borders is a list of <border> tags containing exact names of other territories that this one is adjacent to. Coordinates is a list of the X and Y coordinates (in pixels) where the armies should be printed on the small and large maps. So a basic territory looks like this:
Code: Select all
<territory>
<name>Alberta</name>
<borders>
<border>Alaska</border>
<border>Northwest Territory</border>
<border>Ontario</border>
<border>Western United States</border>
</borders>
<coordinates>
<smallx>90</smallx>
<smally>90</smally>
<largex>120</largex>
<largey>111</largey>
</coordinates>
</territory>Code: Select all
<territory>
<name>Inner Mongolia</name>
<borders>
<border>Mongolia</border>
</borders>
</territory>You can also add some optional tags to a territory. If you want an 'autodeploy' bonus to be added to that territory each round, add a <bonus> tag. If you want the territory to be initialized with a certain number of neutral armies, add a <neutral> tag. The Neutral tag should come after the <coordinates> tag for the XML validator to check it correctly. This XML will make Alberta start off with 10 neutrals but you'll get a territorial bonus of 3 if you conquer and hold it:
Code: Select all
<territory>
<name>Alberta</name>
<borders>
<border>Alaska</border>
<border>Northwest Territory</border>
<border>Ontario</border>
<border>Western United States</border>
</borders>
<coordinates>
<smallx>90</smallx>
<smally>90</smally>
<largex>120</largex>
<largey>111</largey>
</coordinates>
<neutral>10</neutral>
<bonus>3</bonus>
</territory>If you want you can make these neutrals come back after someone takes the territory. We call these killer neutrals, which revert to neutral at the beginning of the occupying players turn. To make Alberta a killer neutral so that it goes back to being 10 after someone takes it you just change the neutral tag like so:
Code: Select all
<territory>
<name>Alberta</name>
<borders>
<border>Alaska</border>
<border>Northwest Territory</border>
<border>Ontario</border>
<border>Western United States</border>
</borders>
<coordinates>
<smallx>90</smallx>
<smally>90</smally>
<largex>120</largex>
<largey>111</largey>
</coordinates>
<neutral killer="yes">10</neutral>
<bonus>3</bonus>
</territory>To mimic long-range warfare, you can additionally give a territory a <bombardments> tag. Bombardments is a list of <bombardment> tags containing exact names of other territories that this one can attack. Bombardments differ from borders in that you cannot fortify to bombardments, and a successful attack leaves 1 neutral army in the opposing territory. For example, imagine that Great Britain had inter-continental ballistic missiles pointed at Australia:
Code: Select all
<territory>
<name>Great Britain</name>
<borders>
<border>Iceland</border>
<border>Scandinavia</border>
<border>Northern Europe</border>
<border>Western Europe</border>
</borders>
<bombardments>
<bombardment>Indonesia</bombardment>
<bombardment>New Guinea</bombardment>
<bombardment>Western Australia</bombardment>
<bombardment>Eastern Australia</bombardment>
</bombardments>
<coordinates>
<smallx>267</smallx>
<smally>84</smally>
<largex>356</largex>
<largey>104</largey>
</coordinates>
</territory>Continents
Next we must specify the continents on your map. Inside the map tag, before the territories, include one pair of <continent> tags for each continent. For each continent you'll also need to specify <name>, <bonus> and <components>. Components is a list of <territory> and <continent> tags containing exact names of territories and continents making up the continent. Usually you won't have continents inside continents so a basic continent looks like this:
Code: Select all
<continent>
<name>Oceania</name>
<bonus>2</bonus>
<components>
<territory>Indonesia</territory>
<territory>New Guinea</territory>
<territory>Western Australia</territory>
<territory>Eastern Australia</territory>
</components>
</continent>Code: Select all
<continent>
<name>Oceania</name>
<bonus>2</bonus>
<components>
<territory>Indonesia</territory>
<territory>New Guinea</territory>
<territory>Western Australia</territory>
<territory>Eastern Australia</territory>
</components>
</continent>
<continent>
<name>Half of Oceania</name>
<bonus>1</bonus>
<components>
<territory>Indonesia</territory>
<territory>New Guinea</territory>
<territory>Western Australia</territory>
<territory>Eastern Australia</territory>
</components>
<required>2</required>
</continent>Code: Select all
<continent>
<name>Oceania</name>
<bonus>2</bonus>
<components>
<territory>Indonesia</territory>
<territory>New Guinea</territory>
<territory>Western Australia</territory>
<territory>Eastern Australia</territory>
</components>
<overrides>
<override>Half of Oceania</override>
</overrides>
</continent>
<continent>
<name>Half of Oceania</name>
<bonus>1</bonus>
<components>
<territory>Indonesia</territory>
<territory>New Guinea</territory>
<territory>Western Australia</territory>
<territory>Eastern Australia</territory>
</components>
<required>2</required>
</continent>Objectives
Optionally, you can specify winning conditions for your map. An objective is a set of territories or continents that when held will give the player an early victory. A map can have several objectives and a held objective ends the game in both Assassin and Terminator games. In the case of a Terminator game points would be earned from all opponents who haven't been terminated. Suppose an objective is to hold Alaska, Greenland and the continent of Asia. The XML would look like this:
Code: Select all
<objective>
<name>Alaska & Asia</name>
<components>
<continent>Asia</continent>
<territory>Alaska</territory>
<territory>Greenland</territory>
</components>
</objective>
Putting it all together
Your final XML file should look something like this:
Code: Select all
<?xml version="1.0"?>
<map>
<objectives/>
<continents/>
<territories/>
</map>- Continent and territory bonuses can be negative.
- When multiple continents have the same name, the related log entries will be merged into one entry.
- Order is very important in xml, please follow the order in the last code snippet.


