Measuring Allies & Enemies



  • I have written code that distributes players randomly into 2 alliances.

        <attachment name="relationshipTypeAttachment" attachTo="War" javaClass="games.strategy.triplea.attachments.RelationshipTypeAttachment" type="relationship">
          <option name="archeType" value="war"/>
          <option name="isDefaultWarPosition" value="true"/>
        </attachment>
        <attachment name="relationshipTypeAttachment" attachTo="Allied" javaClass="games.strategy.triplea.attachments.RelationshipTypeAttachment" type="relationship">
          <option name="archeType" value="allied"/>
          <option name="alliancesCanChainTogether" value="true"/>
        </attachment>
        <attachment name="relationshipTypeAttachment" attachTo="Neutrality" javaClass="games.strategy.triplea.attachments.RelationshipTypeAttachment" type="relationship">
          <option name="archeType" value="neutral"/>
        </attachment>
        
    <attachment name="conditionAttachmentTurn1" attachTo="A" javaClass="games.strategy.triplea.attachments.RulesAttachment"  type="player"><option name="rounds"  value="1"/></attachment>
        
      <attachment foreach="$TriggerPlayer$" name="triggerAttachment@TriggerPlayer@ToA" attachTo="@TriggerPlayer@" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
          <option name="conditions" value="conditionAttachmentTurn1"/>
          <option name="relationshipChange" value="@TriggerPlayer@:A:Neutrality:Allied"/>
          <option name="uses" value="1"/>
          <option name="chance" value="1:2"/>
          <option name="when"  value="before:ABidPlace"/>
    	</attachment>
    
    <attachment foreach="$TriggerPlayer$" name="triggerAttachment@TriggerPlayer@ToB" attachTo="@TriggerPlayer@" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
          <option name="conditions" value="conditionAttachmentTurn1"/>
          <option name="relationshipChange" value="@TriggerPlayer@:B:Neutrality:Allied"/>
          <option name="uses" value="1"/>
          <option name="chance" value="1:1"/>
          <option name="when"  value="before:BBidPlace"/>
    	</attachment>
    
    

    I am running into trouble with the next step, providing some of sort of handicap to balance. Is there any general way to measure some piece of information about your allies or enemies, which I could then use to give PU's (or something else) to the weaker side?


  • Admin

    Nice! If this works it opens up possibilities for mapmakers and their map ideas and concepts 🙂



  • @Frostion I am actually close to getting something working.

    <attachment name="conditionAttachmentJapaneseEnemyUnitPresent" attachTo="Japanese" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
      <option name="enemyPresenceTerritories" value="all" count="each"/>
     </attachment>
     
     <attachment name="triggerAttachmentJapaneseEnemyUnitCount" attachTo="Japanese" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
      <option name="conditions" value="conditionAttachmentJapaneseEnemyUnitPresent"/>
      <option name="resource" value="PUs"/>
      <option name="resourceCount" value="1"/>
      <option name="when" value="after:BBidplace"/>
     </attachment>
    
    

    The trigger is not firing, but I am getting close to having a way of counting all enemy units and all friendly units. I can then use the difference for some rough handicapping.

    In many scenarios, there is no obvious historical (or hypothetical) conflict. This way I can just assign random sides and balance them, rather than having a free-for-all, which I find makes for uninteresting play.


Log in to reply