Conquer Club

xml question

Topics that are not maps. Discuss general map making concepts, techniques, contests, etc, here.

Moderator: Cartographers

Forum rules
Please read the Community Guidelines before posting.

xml question

Postby Oneyed on Fri Dec 07, 2012 1:40 pm

is possible to code:
when you hold XYZ and ABC bonus is valid only for the first holding? or something similar?

Oneyed
User avatar
Private 1st Class Oneyed
 
Posts: 1058
Joined: Sat Dec 10, 2011 12:29 pm

Re: xml question

Postby ManBungalow on Fri Dec 07, 2012 1:54 pm

Not that I know of.

I've wondered before what would happen if region X is a bonus, but is also set to revert to neutral at the start of a turn. That way one would have to re-take the bonus to get it the next turn, which is a little bit like what you're asking.

Perhaps it would be processed in order of the appearance of the function in the XML - ie. by reading the XML from top to bottom.

One could probably find out by analysing the logs of some games on existing maps with killer neutrals. I suspect that the killer neutrals are processed before anything else though.
Image
Colonel ManBungalow
 
Posts: 3431
Joined: Sun Jan 13, 2008 7:02 am
Location: On a giant rock orbiting a star somewhere

Re: xml question

Postby Oneyed on Fri Dec 07, 2012 2:07 pm

this is my whole idea:

player holds France and he gains bonus for France and for France colonies if he holds any. when this player conquered England he will gains bonus for England, but no for England colonies.

Oneyed
User avatar
Private 1st Class Oneyed
 
Posts: 1058
Joined: Sat Dec 10, 2011 12:29 pm

Re: xml question

Postby nolefan5311 on Fri Dec 07, 2012 2:44 pm

Code: Select all
    <continent>
    <bonuses>
    <bonus required="5">5</bonus>
    <bonus required="8">15</bonus>
    <bonus required="11">45</bonus>
    </bonuses>
    <components>
    <component type="mandatory">essential country 1</component>
    <component type="mandatory">essential country 2</component>
    <component type="blocker">bad country!</component>
    <component>variable country 1</component>
    <component>variable country 2</component>
    <component>variable country 3</component>
    <component>variable country 4</component>
    <component>variable country 5</component>
    <component>variable country 6</component>
    <component>variable country 7/component>
    <component>variable country 8</component>
    <component>variable country 9</component>
    </components>
    </continent>


What this does, is say you hold all of France (that's would go under the "mandatory tag". You also hold French colonies (that would also go under the mandatory tag). But, if you put a "blocker" territory in there, let's say in this case England, you would then lose the bonus for France until you no longer held England. Is this what you mean Oneyed?
User avatar
Captain nolefan5311
 
Posts: 1768
Joined: Mon Nov 22, 2010 11:51 am
Location: Florida

Re: xml question

Postby Oneyed on Fri Dec 07, 2012 3:30 pm

nolefan5311 wrote:What this does, is say you hold all of France (that's would go under the "mandatory tag". You also hold French colonies (that would also go under the mandatory tag). But, if you put a "blocker" territory in there, let's say in this case England, you would then lose the bonus for France until you no longer held England. Is this what you mean Oneyed?


my idea is adversive. when you hold France at the first (and bonus for France ofcourse), then bonus for France colonies and then you capture England you will have only bonus for England but not for England colonies. until you have France.

when you lose France (and ofcourse bonus for France and its colonise) you gain alos bonus for England colonies.

is this possible?

Oneyed
User avatar
Private 1st Class Oneyed
 
Posts: 1058
Joined: Sat Dec 10, 2011 12:29 pm

Re: xml question

Postby nolefan5311 on Fri Dec 07, 2012 3:57 pm

Hmm. I'm not 100% sure what you mean.
User avatar
Captain nolefan5311
 
Posts: 1768
Joined: Mon Nov 22, 2010 11:51 am
Location: Florida

Re: xml question

Postby Oneyed on Fri Dec 07, 2012 4:10 pm

nolefan5311 wrote:Hmm. I'm not 100% sure what you mean.


it is my bad english....

France +3, +1 for every 2 French colonies
England +2, +1 for every 2 English colonies

so player holds France. then he conquer 4 French colonies. so he gains +5.
latter he conquer England. so he gains also +2. then he conquer 2 English colonies, but he does not has bonus for them beause he holds bonus for French colonies.

Oneyed
User avatar
Private 1st Class Oneyed
 
Posts: 1058
Joined: Sat Dec 10, 2011 12:29 pm

Re: xml question

Postby thenobodies80 on Fri Dec 07, 2012 5:33 pm

so you want to achieve this:

England = X
England + any england colonies = X + K
France = Y
France + any french colonies = Y + Z
England + France + any french colonies (or any england colonies) = X+Y+Z or (K)
England + France + any england colonies + any french colonies = X+Y+K

yes it is possible.
gimme few mins to write the code ;)
User avatar
Sergeant 1st Class thenobodies80
 
Posts: 5400
Joined: Wed Sep 05, 2007 4:30 am
Location: Milan

Re: xml question

Postby ManBungalow on Fri Dec 07, 2012 6:21 pm

My interpretation.

Oneyed wrote:France +3, +1 for every 2 French colonies
England +2, +1 for every 2 English colonies

so player holds France. then he conquer 4 French colonies. so he gains +5.
latter he conquer England. so he gains also +2. then he conquer 2 English colonies, but he does not has bonus for them beause he holds bonus for French colonies.


England = A
England + English Colonies = A + B

France = C
France + French Colonies = C + D

England + France = A + C

England + France + French Colonies = A + C + D

England + France + English Colonies = A + B + C

England + France + French Colonies + English Colonies = A + C + D


As nobodies says, this is possible. However, I worry more about how the information will be conveyed on a map.
Image
Colonel ManBungalow
 
Posts: 3431
Joined: Sun Jan 13, 2008 7:02 am
Location: On a giant rock orbiting a star somewhere

Re: xml question

Postby thenobodies80 on Fri Dec 07, 2012 7:02 pm

here what you need:

first of all you need to code the two main bonuses
Code: Select all
<continent>
<name>England</name>
<bonus>2</bonus>
<components>
<territory>TerrA</territory>
etc etc
</components>
</continent>
<continent>
<name>France</name>
<bonus>3</bonus>
<components>
<territory>TerrB</territory>
etc etc
</components>
</continent>



Now you can list all your colonies bonues (in this example I've set the limit to 6 for an easier code)

Code: Select all
<continent>
<name>2 English Colonies<name>
<bonus>0</bonus>
<components>
<territory>Eng Colony 1</territory>
<territory>Eng Colony 2</territory>
<territory>Eng Colony 3</territory>
<territory>Eng Colony 4</territory>
<territory>Eng Colony 5</territory>
<territory>Eng Colony 6</territory>
</components>
<required>2</required>
</continent>
<continent>
<name>4 English Colonies<name>
<bonus>0</bonus>
<components>
<territory>Eng Colony 1</territory>
<territory>Eng Colony 2</territory>
<territory>Eng Colony 3</territory>
<territory>Eng Colony 4</territory>
<territory>Eng Colony 5</territory>
<territory>Eng Colony 6</territory>
</components>
<required>4</required>
<overrides>
<override>2 English Colonies</override>
</overrides>
</continent>
<continent>
<name>6 English Colonies<name>
<bonus>0</bonus>
<components>
<territory>Eng Colony 1</territory>
<territory>Eng Colony 2</territory>
<territory>Eng Colony 3</territory>
<territory>Eng Colony 4</territory>
<territory>Eng Colony 5</territory>
<territory>Eng Colony 6</territory>
</components>
<required>6</required>
<overrides>
<override>2 English Colonies</override>
<override>4 English Colonies</override>
</overrides>
</continent>
<continent>
<name>2 French Colonies<name>
<bonus>0</bonus>
<components>
<territory>Fr Colony 1</territory>
<territory>Fr Colony 2</territory>
<territory>Fr Colony 3</territory>
<territory>Fr Colony 4</territory>
<territory>Fr Colony 5</territory>
<territory>Fr Colony 6</territory>
</components>
<required>2</required>
</continent>
<continent>
<name>4 French Colonies<name>
<bonus>0</bonus>
<components>
<territory>Fr Colony 1</territory>
<territory>Fr Colony 2</territory>
<territory>Fr Colony 3</territory>
<territory>Fr Colony 4</territory>
<territory>Fr Colony 5</territory>
<territory>Fr Colony 6</territory>
</components>
<required>4</required>
<overrides>
<override>2 French Colonies</override>
</overrides>
</continent>
<continent>
<name>6 French Colonies<name>
<bonus>0</bonus>
<components>
<territory>Fr Colony 1</territory>
<territory>Fr Colony 2</territory>
<territory>Fr Colony 3</territory>
<territory>Fr Colony 4</territory>
<territory>Fr Colony 5</territory>
<territory>Fr Colony 6</territory>
</components>
<required>6</required>
<overrides>
<override>2 French Colonies</override>
<override>4 French Colonies</override>
</overrides>
</continent>


Now you need to create nested continents:
Code: Select all
<continent>
<name> England and 2 Colonies</name>
<bonus>3</bonus>
<components>
<continent>England</continent>
<continent>2 English Colonies</continent>
<components>
<overrides>
<override>England</override>
<override>2 English Colonies</override>
</overrides>
</continent>
<continent>
<name> England and 4 Colonies</name>
<bonus>4</bonus>
<components>
<continent>England</continent>
<continent>4 English Colonies</continent>
<components>
<overrides>
<override>England</override>
<override>4 English Colonies</override>
<override>England and 2 Colonies</override>
<override>France and 2 Colonies</override>
</overrides>
</continent>
<continent>
<name> England and 6 Colonies</name>
<bonus>5</bonus>
<components>
<continent>England</continent>
<continent>6 English Colonies</continent>
<components>
<overrides>
<override>England</override>
<override>6 English Colonies</override>
<override>England and 4 Colonies</override>
<override>France and 2 Colonies</override>
<override>France and 4 Colonies</override>
</overrides>
</continent>
<continent>
<name>France and 2 Colonies</name>
<bonus>4</bonus>
<components>
<continent>France</continent>
<continent>2 French Colonies</continent>
<components>
<overrides>
<override>France</override>
<override>2 French Colonies</override>
<override>England and 2 Colonies</override>
</overrides>
</continent>
<continent>
<name> France and 4 Colonies</name>
<bonus>5</bonus>
<components>
<continent>France</continent>
<continent>4 French Colonies</continent>
<components>
<overrides>
<override>France</override>
<override>4 French Colonies</override>
<override>France and 2 Colonies</override>
<override>England and 2 Colonies</override>
<override>England and 4 Colonies</override>
</overrides>
</continent>
<continent>
<name> France and 6 Colonies</name>
<bonus>6</bonus>
<components>
<continent>France</continent>
<continent>6 French Colonies</continent>
<components>
<overrides>
<override>France</override>
<override>6 French Colonies</override>
<override>France and 4 Colonies</override>
<override>England and 2 Colonies</override>
<override>England and 4 Colonies</override>
<override>England and 6 Colonies</override>
</overrides>
</continent>


Now, probably you can clean the code, afterall it's just an example. ;)
It would be quicker if collection would allow to use the <continent> tag as component but actually it's not possible (i'm working to have it allowed :-$ :-# )

Hope it helps, sorry if I missed something.
Nobodies
User avatar
Sergeant 1st Class thenobodies80
 
Posts: 5400
Joined: Wed Sep 05, 2007 4:30 am
Location: Milan

Re: xml question

Postby Oneyed on Sat Dec 08, 2012 1:50 am

ManBungalow wrote:As nobodies says, this is possible. However, I worry more about how the information will be conveyed on a map.


I need day-two and I will post new map. you can find this there ;)
thenobodies80 wrote:Now, probably you can clean the code, afterall it's just an example. ;)
It would be quicker if collection would allow to use the <continent> tag as component but actually it's not possible (i'm working to have it allowed :-$ :-# )


this sounds as big help to xml codders. good luck with it :)
thenobodies80 wrote:Hope it helps, sorry if I missed something.
Nobodies


big thanks guys. be patient and wait how I implement this to map.

Oneyed
User avatar
Private 1st Class Oneyed
 
Posts: 1058
Joined: Sat Dec 10, 2011 12:29 pm

Re: xml question

Postby thenobodies80 on Sat Dec 08, 2012 9:35 am

I'm sorry but I noticed only now I wrote something not true.

The continent component is allowed with collections, but you can't set a type option into it.

So <continent> tag ca be used but, at the moment, you can NOT have tags like these as components: (using your england france colonies case as example)

<continent type="mandatory">England</continent>
<continent type="blocker">England</continent>
<continent type="multiplier" factor="1.5">England</continent>

The type options can be used only within <territory> tags, obivously if components of a bonus.
The <territory> and the <continent> tags can be mixed while listed as components, but all the type options are an exclusive of the former tag only so, for example, something like this IS possible:

<components>
<territory type="mandatory">English Colony 1</territory>
<continent>England</continent</continent>
</components>

So in few word, actually we lack only a way to set a whole continent as mandatory, blocker or multiplier for another continent (bonus).
Have these options will save time and lot of lines of code, but it was kept out for now to save processing power.
User avatar
Sergeant 1st Class thenobodies80
 
Posts: 5400
Joined: Wed Sep 05, 2007 4:30 am
Location: Milan

Re: xml question

Postby Oneyed on Sat Dec 08, 2012 4:08 pm

to be honest I do not much understand what you wrote, nobodies.

but could you look here viewtopic.php?f=63&t=182388&view=unread#unread and say if the bonuses are possible to code as I set up them?

thanks

Oneyed
User avatar
Private 1st Class Oneyed
 
Posts: 1058
Joined: Sat Dec 10, 2011 12:29 pm

Re: xml question

Postby thenobodies80 on Sat Dec 08, 2012 8:14 pm

Mmmm...i'm not sure I understand what you're trying to do with that map, the legend is not so clear, at least to me.
But I'm sure you can not give a bonus because it's the one you hold as first. Priority levels are set with overrides so it doesn't matter the order in which you hold a bonus.
If I got it right you want that if I hold england and you hold france, we both receive the bonuses, but if i take france from you i do not receive france bonus but just england bonus because I had the british one before. On the opposite if you take england for me, you want to have the bonus for france but not for england.
Then this is not possible. If you set that england bonus overrides (cancel) france bonus it will always in that way. It doesn't matter which one you hold first, overrides set priority levels.
User avatar
Sergeant 1st Class thenobodies80
 
Posts: 5400
Joined: Wed Sep 05, 2007 4:30 am
Location: Milan

Re: xml question

Postby Oneyed on Sun Dec 09, 2012 4:40 am

lets look at WWI map and lets spoke about "real" bonuses.

"Hold more as one entire states of the same Power, bonus for occupied regions valid only once."

so when you hold French Republic (you gain +3) and Westphalia, Bavaria you gain +1 for 2 occupied CP regions. when you then take Kingdom of Italy (you gain +2), but you will not gain +1 for Westphalia, Bavaria. is this possible?

"Hold entire states of different Powers, bonus for occupied regions valids only for the first one held."

this seems, when I good understand you, as impossible. yes? but the bonus is different here: the Entite Powers have bonus for occupied Central Powers regions, while Central Powers have bonus for occupied non Central Powers regions - so these regions are different.

it also seems that there would be realy huge work with codding, it is not possible to code something like:
German Empire (3) + any 3 occupied non CP regions (2) = 6
but
French Republic (3)+ German Empire (3) + any 3 occupied non CP regions = 6, here bonus for German Empire occupied regions will not valids.

does xml works that is is important order how are names/bonuses written? I mean is there difference:
German Empire + French Republic and French Republic + German Empire?

EDIT: it looks to me similar as bonus in Fragmentation of CSFR. here when you hold 1 Kraj in the SR you gain +2, but when you hold Praha you gain -1 for this Kraj...

Oneyed
User avatar
Private 1st Class Oneyed
 
Posts: 1058
Joined: Sat Dec 10, 2011 12:29 pm

Re: xml question

Postby koontz1973 on Sun Dec 09, 2012 4:59 am

oneyed, from what I am reading, is this:
Hold British bonus you get a +2
Hold British and 2 other types of territs you get +6. This is easy to code. All it is is a simple over ride.
To hold german empire (3) and france (3) is 6. That is a simple normal bonus structure.

But if you hold france(3), germany(3) and occupied regions (3) again this is possible. You code this as an over ride.

France (3)
Germany (3)
Germany with occupied land (6)
France with Germany (6) over rides normal Germany and France bonuses
France with Germany and occupied lands (6) over ride all bonuses that come before in this series.

Go and look at the xml for Rorke's Drift or Kingdom of Korea. Both use over rides a lot so you can see how they work. You only need to over ride the last over ride bonus so it is easy to code.

Over rides are easy to code in as it is only one extra line for the bonuses. Just remember to write them in sequence so you do not get a conflict.

Write all normal continent bonuses first.
Then the ones with a continent and occupied lands (These over ride the first lot)
Then do the ones that have more land. Again these over ride the second lot.
So on and so on.

Hope that helps.
Image
User avatar
Lieutenant koontz1973
 
Posts: 6960
Joined: Thu Jan 01, 2009 10:57 am

Re: xml question

Postby thenobodies80 on Sun Dec 09, 2012 8:10 am

Oneyed wrote:"Hold entire states of different Powers, bonus for occupied regions valids only for the first one held."


What I'm saying is that the above is not possible....or at least bad written on the map.
It can't be "only for the first held". It could be "only once".

As I said earlier it doesn't matter what region you hold first, overrides don't work in that way.

EDIT: a solution could be to set overrides so you give away only one bonus (not the first) and it is always the biggest the player holds. It can be done with overrides, like koontz said.
User avatar
Sergeant 1st Class thenobodies80
 
Posts: 5400
Joined: Wed Sep 05, 2007 4:30 am
Location: Milan

Re: xml question

Postby Oneyed on Sun Dec 09, 2012 2:33 pm

thenobodies80 wrote:It could be "only once".


this is also fine and the right thing which I needs for "holding more entire states of the same Power".
thenobodies80 wrote:EDIT: a solution could be to set overrides so you give away only one bonus (not the first) and it is always the biggest the player holds. It can be done with overrides, like koontz said.


this sounds also fine. just how "the biggest" bonus works? is it depends on current situation or is it which bonus is still higher?
example:
England +2, +1 for every 2 colonies
Germany +3, +1 for every 2 colonies

1, I hold Germany (+3) and England with 2 colonies (+2+1), so how will xml solve this?

2, I hold Germany (+3). then England (+2) then 4 english colonies (+2+2) - will be valid English bonus? and then when I take 4 German colonies (+3+2) - will the bonus change because German bonus is higher?

Oneyed
User avatar
Private 1st Class Oneyed
 
Posts: 1058
Joined: Sat Dec 10, 2011 12:29 pm

Re: xml question

Postby thenobodies80 on Sun Dec 09, 2012 4:36 pm

for 1 you can decide as you want, if they have the same value it's up to you decide which one overrides the other.
for 2 i think it's possible. Just make the german bonus overrides the english one.
User avatar
Sergeant 1st Class thenobodies80
 
Posts: 5400
Joined: Wed Sep 05, 2007 4:30 am
Location: Milan

Re: xml question

Postby Oneyed on Sun Jan 20, 2013 4:29 am

I have another XML quetsion:

is possible to code that player A receive bonus if player B holds XYZ?

Oneyed
User avatar
Private 1st Class Oneyed
 
Posts: 1058
Joined: Sat Dec 10, 2011 12:29 pm

Re: xml question

Postby koontz1973 on Sun Jan 20, 2013 5:26 am

Oneyed wrote:I have another XML quetsion:

is possible to code that player A receive bonus if player B holds XYZ?

Oneyed

No.
Image
User avatar
Lieutenant koontz1973
 
Posts: 6960
Joined: Thu Jan 01, 2009 10:57 am

Re: xml question

Postby Oneyed on Fri Jan 25, 2013 6:50 pm

is possible to:
if player holds A, B he can bombards X. when he holds A, B, C, D he can bombards Y but not X?

Oneyed
User avatar
Private 1st Class Oneyed
 
Posts: 1058
Joined: Sat Dec 10, 2011 12:29 pm

Re: xml question

Postby ender516 on Sun Jan 27, 2013 10:37 pm

Make a continent, "Can Bombard X", with components A and B and blocker components C and D. Use that as the condition for bombarding X. Make another continent, "Can Bombard Y" with components C and D, and use it as the condition for bombarding Y.
User avatar
Sergeant 1st Class ender516
 
Posts: 4455
Joined: Wed Dec 17, 2008 6:07 pm
Location: Waterloo, Ontario

Re: xml question

Postby Oneyed on Mon Jan 28, 2013 4:24 am

ender516 wrote:Make a continent, "Can Bombard X", with components A and B and blocker components C and D. Use that as the condition for bombarding X. Make another continent, "Can Bombard Y" with components C and D, and use it as the condition for bombarding Y.


what are blocker? it is something what can be codded in xml?
thanks.

Oneyed
User avatar
Private 1st Class Oneyed
 
Posts: 1058
Joined: Sat Dec 10, 2011 12:29 pm

Re: xml question

Postby koontz1973 on Mon Jan 28, 2013 5:45 am

Oneyed wrote:
ender516 wrote:Make a continent, "Can Bombard X", with components A and B and blocker components C and D. Use that as the condition for bombarding X. Make another continent, "Can Bombard Y" with components C and D, and use it as the condition for bombarding Y.


what are blocker? it is something what can be codded in xml?
thanks.

Oneyed

Yes. XML Guide
Oneyed, here is the guide from the xml guide, but it is worth reading it all. Most of it is old but their is a lot of new things now that can be played with.

4.3.3 - <mandatory>, <blocker> and <multiplier>

Blocker

Syntax
<continent>
__<name>ConName</name>
__<bonuses>
____<bonus required="#">BonusVal</bonus>
____...
__</bonuses>
__<components>
____<territory type="blocker">TerrName</territory>
____...
__</components>
</continent>


The blocker type identify a particular type of component. If you hold a blocker component you do NOT hold the continent.
To specify the blocker type for a territory you need to add type="blocker" into the opening territory tag: <territory type="blocker">

For example
Code: Select all
<continent>
    <bonuses>
    <bonus required="1">1</bonus>
    <bonus required="2">3</bonus>
    <bonus required="3">5</bonus>
    </bonuses>
    <components>
    <territory type="blocker">country 1</territory>
    <territory>country 2</territory>
    <territory>country 3</territory>
    <territory>country 4</territory>
    </components>
    </continent>


With the above code, if the player holds country 1 (it doesn't matter how many other territories he has) he doesn't hold the continent at all and that means if it was a subcontinent he doesn't hold that either, like in the example into the following spoiler:
show


IMPORTANT
The blocker type can be used ONLY with <territory> components. Do NOT use it with <continent>
Image
User avatar
Lieutenant koontz1973
 
Posts: 6960
Joined: Thu Jan 01, 2009 10:57 am

Next

Return to Foundry Discussions

Who is online

Users browsing this forum: No registered users