Page 2 of 2

Conditional Borders

PostPosted: Mon Jan 07, 2013 4:35 pm
by thenobodies80
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. ;)

4.5 - Transformation

PostPosted: Sun Jan 19, 2014 4:30 pm
by thenobodies80
The concept of Transformation includes the general ability to apply rules that transform any territory in different ways.
Transformation rules, called Transforms, 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>
_______<variable></variable>
_______<type></type>
_______<id></id>
_______<operator></operator>
_______<value></value>
_______</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 transform will execute, as follows:

turn=Each Turn
round=Each Round (when first player starts)

APPLYTO <applyto>:

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

all=All
self = Self (the playing Player only)
neutral = Neutral only
players = Players only (not neutral)
opponents = Other Players only (not neutral or the playing Player)
others = Others (all others, including neutral, except the playing player)
team = anyone in your team (so includes you and your teammates, also applies to poly where it would be all of your different players. Works in single player as well and acts like self)
nonteam = non-neutral players not in your team (same as team but players that are not in your team, works for poly for the other teams. Also works in single player where it will act like the opponents label)
teammates = anyone in your team, except for you (is like others but just for your team. Will not do anything in single 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.

<element name="conditions">
<optional>
<element name="formula">
<data type="normalizedString"/>
</element>
</optional>
<oneOrMore>
<element name="condition">
<optional>
<element name="variable">
<data type="normalizedString"/>
</element>
</optional>
<element name="type">
<data type="normalizedString"/>
</element>
<optional>
<element name="id">
<data type="unsignedShort"/>
</element>
</optional>
<optional>
<element name="operator">
<data type="normalizedString"/>
</element>
</optional>
<optional>
<element name="value">
<data type="normalizedString"/>
</element>
</optional>

</element>
</oneOrMore>
</element>

CONDITION <condition>:
Each condition tag may contain VARIABLE, TYPE, ID, OPERATOR and VALUE tags

ID <id>:
Territory id

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

TYPE <type>:
The type of test, which controls what the condition will be applied to:

round: the round of the game
player: a specific player
territory: a specific territory
armycount: the size of the army

ID <id>:[Optional]
Used when type = player or type=armycount to represent the territory id of the corresponding player or army. For example to set a condition that territory 8 must be neutral, we can use type=player, id = 8, and value=0.

OPERATOR <operator>:[Optional
Logical operator to apply to the test, can be and of the standard logical operators: = (default),!=,>,>=,<,<= (< needs to be written as &lt; for both < and <=) as well as "in" or "not in" when a set of values is used in the value tag

VALUE <value>:[Optional
A value to test against (or a comma separated set of values when using "in" or "not in" operator)
(if using player can also use the same labels as the applyto tag: self, neutral, players, opponents, others, team, nonteam and teammates)

Transformation Process

Transformation 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 Transform in turn:
- Apply filters. If Transform does not apply do nothing and skip to next transform for this terit.
- Calculate 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 Transforms 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>turn</type>
<applyto>neutral</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>turn</type>
<applyto>neutral</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>round</type>
<applyto>all</applyto>
<perc>1</perc>
<amount></amount>
<lower>-100</lower>
<upper>100</upper>
<conditions>
<condition>
<type>round</type>
<operator>=</operator>
<value>20</value>
</condition>
</conditions>
</transform>

Conditions Example. The following Transform will only be applied if Territory 11 OR Territory 32 has an army size of 5 or more.

<transform>
....
<conditions>
<formula>COND_A OR COND_B</formula>
<condition>
<variable>A</variable>
<type>territory</type>
<id>11</id>
<operator>>=</operator>
<value>5</value>
</condition>
<condition>
<variable>B</variable>
<type>territory</type>
<id>32</id>
<operator>>=</operator>
<value>5</value>
</condition>
</conditions>
...
</transform>