Proposal: Combine tags into `<territory>`


  • Admin

    Proposal: Condense several nodes into the <territory> node. This would be the addition of optional nodes {<territoryAttachment>, <placements>, <connections> }

    This update would be backwards compatible. Though, if specifying both old and new tags, the game engine would generate an error to avoid non-determinism.

    Below are two examples, I'm still considering between whether territoryAttachment properties would be nicer as attributes or if as nested child tags.

    Example 1

    <map>
      <territory name="Quebec">
         <territoryAttachment owner="Canadians" production="2" unitProduction="3" capital="Canadians" victoryCity="1"/>
         <placements>
             <placement unitType="Infantry" quantity="3"/> <!-- default owner = territory owner -->
             <placement unitType="Tank" quantity="3" owner="Canadians" />
         </placements>
         <connections>
            <territory name="SZ 20"/>
            <territory name="SZ 19"/>
            <territory name="Ontario"/>
         </connections>
      </territory>
    </map>
    

    Example 2 (Alternative territoryAttachment)

    <map>
      <territory name="Quebec">
         <territoryAttachment> 
           <owner value="Canadians"/>
           <unitProduction value="3" />
           <kamikazeZone value="true" />
         </territoryAttachment>
         <placements>
             <placement unitType="Infantry" quantity="3"/> <!-- default owner = territory owner -->
             <placement unitType="Tank" quantity="3" owner="Canadians" />
         </placements>
         <connections>
            <territory name="SZ 20"/>
            <territory name="SZ 19"/>
            <territory name="Ontario"/>
         </connections>
      </territory>
    </map>
    

    Example (for comparison, existing XML)

    The above would be equivalent to the XML below:

      <map>
        <territory name="Quebec"/>
        <connection t1="Quebec" t2="SZ 20"/>
        <connection t1="Quebec" t2="SZ 19"/>
        <connection t1="Quebec" t2="Ontario"/>
      </map>
      <initialize>
        <ownerInitialize>
          <territoryOwner territory="Quebec" owner="Canadians"/>
        </ownerInitialize>
        <unitInitialize>
          <unitPlacement unitType="Infantry" territory="Quebec" quantity="3" owner="Canadians"/>
          <unitPlacement unitType="Tank" territory="Quebec" quantity="3" owner="Canadians"/>
        </unitInitialize>
      </initialize>
      <attachmentList>
         <attachment name="territoryAttachment" attachTo="Quebec" javaClass="games.strategy.triplea.attachments.TerritoryAttachment" type="territory">
           <option name="production" value="2"/>
           <option name="unitProduction" value="3"/>
           <option name="capital" value="Canadians"/>
           <option name="victoryCity" value="1"/>
         </attachment>
      </attachmentList>
    


  • @LaFayette

    I like example 2 with the <attachment> (saying territoryAttachment in the <territory> block seems redundant) listed out separately, seems easier to read and flows more like the rest of the block.

    Would territory 'Ontario' need to show a connection to 'Quebec'? Maybe for clarity but on connection should be enough.

    Would canal connections be also included?

    I understand that this is just an example, but I do like the direction this is headed.

    Cheers...


  • Admin

    We could even remove the <territoryAttachment> node altogether, eg:

      <territory name="Quebec">
         <owner value="Canadians"/>
         <unitProduction value="3" />
         <kamikazeZone value="true" />
         <placements>
             :
             :
    

    Thoughts?

    For canals, they attach to multiple territories, nesting underneath one territory would potentially not be as helpful as it could be. Here is an example of what we have today:

    <attachment name="canalAttachmentCentral America - Colombia" attachTo="25 Sea Zone" javaClass="games.s
    trategy.triplea.attachments.CanalAttachment" type="territory">
       <option name="canalName" value="the Central America - Colombia channel"/>
       <option name="landTerritories" value="Central America:Colombia"/>
    </attachment>
    <attachment name="canalAttachmentCentral America - Colombia" attachTo="100 Sea Zone" javaClass="games.strategy.triplea.attachments.CanalAttachment" type="territory">
       <option name="canalName" value="the Central America - Colombia channel"/>
       <option name="landTerritories" value="Central America:Colombia"/>
    </attachment>
    

    I think that might be better as one 'canal' tag. It's a really good call-out - though if it's going to be a different tag then perhaps topic for another thread (thread created: https://forums.triplea-game.org/topic/2269/proposal-simpler-canal-node)


Log in to reply