[Official] XML Guide

How to make a map. Official Handbook, Guides, Tutorials and more...

Moderators: Global Moderators, Cartographers

Forum rules
Please read the Community Guidelines before posting.

Conditional Borders

Postby thenobodies80 on Mon Jan 07, 2013 4:35 pm

4.4.5 -Conditional Borders

We all know that standard territories have fixed borders. This means that Territory A always borders with Territory B.
But now we're going to learn how to make the border conditional.
Conditional Borders allow a more flexible usage of borders and this feature makes it possible to have borders which change over the course of a game, based on the possession of territories.
Using again the same example, with conditional borders, we can have that Territory A borders with Territory B only if the player holds a Territory C. The third territory will be a sort of key: holding it satisfies the condition and so activates that border.

Syntax
<territory>
__<name>TerName</name>
____<borders>
______<border condition="CondName">Ter2Name</border>
_________...
____</borders>
_________...
</territory>


So to define a conditional border you need to add the condition=" " option to the <border> tag.

There are few additional notes:
  • You can specify either a territory or a continent as condition
  • You must hold the territory/continent to activate the border
  • If there is a territory and a continent that both match the condition's name, the territory will be used as the condition
  • The conditional border is activated/disactivated immediately when you conquer or lose the condition

Here below an imaginary example of how the code looks like:
Code: Select all
    <territory>
    <name>Sao Paulo</name>
    <borders>
    <border>Bogota</border>
    <border>Lima</border>
    <border condition="New York">Buenos Aires</border>
    <border condition="Oceania">Dakar</border>
    </borders>
    <coordinates>
    ...
    </coordinates>
    </territory>


Sao Paulo can attack Buenos Aires only if the same player holds New York. In addition, Sao Paulo can assault Dakar if the player holds the whole Oceania continent.
Obviously this is just a stupid example and I'm sure you can find plenty of better ways to use it. ;)
User avatar
Corporal 1st Class thenobodies80
 
Posts: 5558
Joined: Wed Sep 05, 2007 4:30 am
Medals: 70
Standard Achievement (3) Doubles Achievement (2) Triples Achievement (1) Quadruples Achievement (2) Terminator Achievement (2)
Assassin Achievement (2) Manual Troops Achievement (2) Freestyle Achievement (2) Nuclear Spoils Achievement (2) Fog of War Achievement (3)
Speed Achievement (2) Teammate Achievement (1) Cross-Map Achievement (3) Bot Achievement (1) Ratings Achievement (4)
General Achievement (8) Map Contribution (7) Tournament Contribution (6) General Contribution (17)

4.5 - Transformation

Postby thenobodies80 on Sun Jan 19, 2014 4:30 pm

The concept of Transformation includes the general ability to apply rules that transform any territory in different ways.
Transformation rules, called Tranforms, can be applied:

  • to individual territories, or to every territory.
  • at the start of every turn, every round, or at the start of specific rounds
  • to neutral armies, player armies, opponents armies, or some combinations of these
  • to set armies to fixed amounts, change by fixed increments, change by fixed percentages, or make random changes within a range


XML Specification
In the XML, Tranforms are specified either globally or as children to a <territory> object, as follows:

<map>
...
___<transforms>
_____<transform>
_______<type></type>
_______<applyto></applyto>
_______<inc></inc>
_______<perc></perc>
_______<amount></amount>
_______<lower></lower>
_______<upper></upper>
_______<conditions>
_______<formula></formula>
_______<condition>
_______<id></id>
_______<variable></variable>
_______<ownership></ownership>
_______<minvalue></minvalue>
_______<maxvalue></maxvalue>
_______</condition>
....
_______</conditions>
_____</transform>
_____<transform>
...
_____<transform>
___</transforms>
...
...
___<territory>
...
_____<transforms>
...
_____</transforms>
...
___</territory>
</map>


show: CODE


In the following we use "Quantity" as representing the army count of a terit count before transformation.

TYPE <type>:

Controls when the tranform will execute, as follows:

T=Each Turn
R=Each Round (when first player starts)
RGN=Each Round after Round N
RLN=Each Round before ROund N

APPLYTO <applyto>:

Controls whether a tranform will be applied based on the type of occupying armies, as follows:

A=All
S=Self (the playing Player only)
N=Neutral only
P=Players only (not neutral)
OP=Other Players only (not neutral or the playing Player)
O=Others (all others, including neutral, except the playing player)

INC <inc>: [Optional]
+ or - Adds/Subtracts Amount to/from Quantity,
If this is not set then the Quantity will be set to a calculated Amount independent of its current value

AMOUNT <amount>:

Fixed amount to set Quantity to.

UPPER/LOWER <upper>/<lower>:
A upper and lower range given so that the system chooses an Amount randomly with equal probability across the range. May be fractional.

PERC <perc>: [Optional]

If set to any non-zero value, use Amount as a % of the current value, instead of as a fixed value.

CONDITIONS <conditions>:[Optional]
Each Conditions tag contains a set of Condition tags and optionally a Formula tag to tie them together. Currently conditions apply to territories only.

FORMULA <formula>:[Optional]
formula allows construction of boolean logic rules. conditions prefixed with COND_ (see example below). Default is to use logical AND for each condition.

CONDITION <condition>:
Each condition tag may contain ID, VARIABLE, OWNERSHIP, MINVALUE & MAXVALUE tags

ID <id>:
Territory id

VARIABLE <variable>: [Optional]
Variable name if you are using a formula

OWNERSHIP <ownership>:[Optional]
Test who owns the territory. See assigns_to tag spec for the transform tag for functioning.

MINVALUE <minvalue>:[Optional]
Test the minimum size of the army

MAXVALUE <maxvalue>:[Optional
Test the maximum size of the army

Tranformation Process

Tranformation is the very first thing to execute on a Begin Turn action.

Go through each territory:

- Set Quantity = Initial value of armies on this territory

For the territory, execute the following process for each applicable Tranform in turn:
- Apply filters. If Tranform does not apply do nothing and skip to next tranform for this terit.
- Calulate Amount by choosing random number if range or setting as fixed amount
- if % is set, multiply Amount by Quantity/100
- If INC = "-" negate Amount
- If INC is set add Quantity to Amount
- set Quantity to Amount

After all Tranforms have executed for a territory:
- Quantity is rounded to the closest integer and set to a minimum of 1
- If Quantity has changed, set new army count and send log to game log.

Go to next Territory

Examples

The original suggestion of neutrals that increase (or decrease by changing <inc> to "-") by 1 each turn would be specified as:

<transform>
<type>T</type>
<applyto>N</applyto>
<inc>+</inc>
<amount>1</amount>
</transform>

To modify this to make the neutrals change randomly by between -1 and 1, we would do

<transform>
<type>T</type>
<applyto>N</applyto>
<inc>+</inc>
<lower>-1.5</lower>
<upper>1.5</upper>
</transform>

Note that the range is specified as -1.5 to 1.5 to give each option -1,0,1 equal chance, since the number is rounded at the end.

The following transform makes a territory get thrown up in the air at the start of Round 20 - it will change by between -100% and 100% (note: a minimum of 1 army is always applied).

<transform>
<type>R20</type>
<applyto>A</applyto>
<perc>1</perc>
<amount></amount>
<lower>-100</lower>
<upper>100</upper>
</transform>

Conditions Example. The following Transform will only be applied if Territory 11 is Neutral OR Territory 32 is owned by the current player with an army size of 5 or more.

<transform>
....
<conditions>
<formula>COND_A OR COND_B</formula>
<condition>
<variable>A</variable>
<id>11</id>
<ownership>N</ownership>
</condition>
<condition>
<variable>B</variable>
<id>32</id>
<ownership>S</ownership>
<minvalue>5</minvalue>
</condition>
</conditions>
...
</transform>
User avatar
Corporal 1st Class thenobodies80
 
Posts: 5558
Joined: Wed Sep 05, 2007 4:30 am
Medals: 70
Standard Achievement (3) Doubles Achievement (2) Triples Achievement (1) Quadruples Achievement (2) Terminator Achievement (2)
Assassin Achievement (2) Manual Troops Achievement (2) Freestyle Achievement (2) Nuclear Spoils Achievement (2) Fog of War Achievement (3)
Speed Achievement (2) Teammate Achievement (1) Cross-Map Achievement (3) Bot Achievement (1) Ratings Achievement (4)
General Achievement (8) Map Contribution (7) Tournament Contribution (6) General Contribution (17)

Previous

Return to Tools & Guides

Who is online

Users browsing this forum: No registered users

Login