TripleA Logo TripleA Forum
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags
    • Register
    • Login

    Unit Option When Damaged Change Into Different Unit (Weakened Battleships)

    Scheduled Pinned Locked Moved Feature Requests & Ideas
    83 Posts 11 Posters 42.8k Views 10 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • redrumR Offline
      redrum Admin @Hepps
      last edited by

      @hepps Thinking about this a little more, I don't think that approach is flexible enough. A use case I could even see in GD would be wanting to adjust bombard value or AA value which wouldn't be possible.

      I think making it so all unit attributes can be adjusted is a better way to go. This pretty much means you need a separate "unit attachment" to define them. I think this leads to 2 options (1 was your original proposal):

      1. Turn unit into other unit(s) when damaged. This is probably the most flexible option as you could even have it so it splits into multiple units (think some fantasy unit).
      2. Create new "damagedAttachment" which has all the same options as "unitAttachment" and would be used to just override any original values of the unit. Benefit here is you still keep the same "unit" which is a bit more cohesive but might actually be more challenging since you could potentially be changing lots of the units attributes.

      With any of these 3 options, you still have to add logic to repair to allow either the unit to be replaced or attributes adjusted.

      TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

      redrumR 1 Reply Last reply Reply Quote 0
      • redrumR Offline
        redrum Admin @redrum
        last edited by redrum

        @Hepps I think sticking with "whenDamagedChangesInto" concept is the way to go here and replacing units is gonna work best.

        XML Options:

        • whenHitPointsDamagedChangesInto - value="damage:unitType:keepDamage" count="numberOfUnits"
        • whenHitPointsRepairedChangesInto - value="damage:unitType:keepDamage" count="numberOfUnits"

        Initial example:

        <attachment name="unitAttachment" attachTo="germanBattleship" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
          <option name="movement" value="4"/>
          <option name="attack" value="8"/>
          <option name="defense" value="8"/>
          <option name="canBombard" value="true"/>
          <option name="isSea" value="true"/>
          <option name="hitPoints" value="3"/>
          <option name="bombard" value="6"/>
          <option name="requiresUnits" value="germanDocks:germanFactory"/>
          <option name="consumesUnits" value="1:germanHull"/>
          <option name="whenHitPointsDamagedChangesInto" value="1:germanBattleshipDamaged:true" count="1"/>
          <option name="whenHitPointsDamagedChangesInto" value="2:germanBattleshipHeavyDamaged:true" count="1"/>
        </attachment>
        
        <attachment name="unitAttachment" attachTo="germanBattleshipDamaged" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
          <option name="movement" value="2"/>
          <option name="attack" value="6"/>
          <option name="defense" value="6"/>
          <option name="canBombard" value="true"/>
          <option name="isSea" value="true"/>
          <option name="hitPoints" value="3"/>
          <option name="bombard" value="4"/>
          <option name="requiresUnits" value="germanDocks:germanFactory"/>
          <option name="consumesUnits" value="1:germanHull"/>
          <option name="whenHitPointsRepairedChangesInto" value="0:germanBattleship:true" count="1"/>
          <option name="whenHitPointsDamagedChangesInto" value="2:germanBattleshipHeavyDamaged:true" count="1"/>
        </attachment>
        
        <attachment name="unitAttachment" attachTo="germanBattleshipHeavyDamaged" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
          <option name="movement" value="1"/>
          <option name="attack" value="4"/>
          <option name="defense" value="4"/>
          <option name="canBombard" value="true"/>
          <option name="isSea" value="true"/>
          <option name="hitPoints" value="3"/>
          <option name="bombard" value="2"/>
          <option name="requiresUnits" value="germanDocks:germanFactory"/>
          <option name="consumesUnits" value="1:germanHull"/>
          <option name="whenHitPointsRepairedChangesInto" value="0:germanBattleship:true" count="1"/>
          <option name="whenHitPointsRepairedChangesInto" value="1:germanBattleshipDamaged:true" count="1"/>
        </attachment>
        

        TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

        HeppsH 1 Reply Last reply Reply Quote 1
        • HeppsH Offline
          Hepps Moderators @redrum
          last edited by

          @redrum Looks great! Seems you have a good plan. I thought the changing of a unit would be far more troublesome.

          "A joyous heart sours with the burden of expectation"
          Hepster

          redrumR 1 Reply Last reply Reply Quote 0
          • redrumR Offline
            redrum Admin @Hepps
            last edited by

            @hepps A few things to consider:

            1. Should we just have 1 unit option rather than 2 since they have the same format? Essentially replace 'whenHitPointsRepairedChangesInto' with 'whenHitPointsDamagedChangesInto' in my above example. Then both combat phase and repair phase just checks all of them?

            2. Can a unit have multiple hit points and take bombing damage? This gets into whether this feature should only address HP damage or also bombing damage.

            TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

            HeppsH 2 Replies Last reply Reply Quote 0
            • HeppsH Offline
              Hepps Moderators @redrum
              last edited by

              @redrum said in Unit Option When Damaged Change Into Different Unit (Weakened Battleships):

              @hepps A few things to consider:

              1. Should we just have 1 unit option rather than 2 since they have the same format? Essentially replace 'whenHitPointsRepairedChangesInto' with 'whenHitPointsDamagedChangesInto' in my above example. Then both combat phase and repair phase just checks all of them?

              I don't fully understand what you are asking here.

              1. Can a unit have multiple hit points and take bombing damage? This gets into whether this feature should only address HP damage or also bombing damage.

              Ideally both. But I don't know what it involves to expand this out to bombing damage. If possible yes.

              "A joyous heart sours with the burden of expectation"
              Hepster

              1 Reply Last reply Reply Quote 0
              • HeppsH Offline
                Hepps Moderators @redrum
                last edited by

                @redrum said in Unit Option When Damaged Change Into Different Unit (Weakened Battleships):

                1. Can a unit have multiple hit points and take bombing damage? This gets into whether this feature should only address HP damage or also bombing damage.

                The one thing I noted which was a curious addition was to the WAW variant where fighters could inflict bombing damage on other normal units. In this case grounded aircraft. It is a very unique use of the attachment. Having looked over the XML I am still confused how the engine handles the two different types of damage... since it appears you can attach both to the same unit.

                "A joyous heart sours with the burden of expectation"
                Hepster

                redrumR 1 Reply Last reply Reply Quote 0
                • redrumR Offline
                  redrum Admin @Hepps
                  last edited by

                  @hepps Hit point damage and bombing damage are treated completely separately. If either reaches 0 then the unit dies but they have no effect on each other. So in theory for this feature, you could set say battleships to have multiple hit points and be bombable. Then you could have different thresholds for each type of damage for it to turn into battleship_damaged. So we'd need separate unit options to handle each case, so something like this:
                  <option name="whenHitPointsDamagedChangesInto" value="1:germanBattleshipDamaged:true" count="1"/>
                  <option name="whenBombingDamagedChangesInto" value="1:germanBattleshipDamaged:true" count="1"/>

                  TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                  HeppsH W 4 Replies Last reply Reply Quote 1
                  • HeppsH Offline
                    Hepps Moderators @redrum
                    last edited by

                    @redrum Looks good. It would allow for a full range of options that can be picked by the designer.

                    "A joyous heart sours with the burden of expectation"
                    Hepster

                    1 Reply Last reply Reply Quote 0
                    • HeppsH Offline
                      Hepps Moderators @redrum
                      last edited by Hepps

                      @redrum Question Red. Does this theoretically mean that if you gave a unit 3 HP as well as 3 Bombing damage.... would the unit then be capable of sustaining 3+3 points of damage? I am curious how the engine would deal with a unit with 2 HPs of damage and 2 Bombing damage.

                      I'm guessing the two different types of damage would be unrelated to each other. Which could probably cause some issues and conflicts in how the unit is changed. Not that that is a huge issue as long as it is specified in the POS 2 XML.

                      "A joyous heart sours with the burden of expectation"
                      Hepster

                      redrumR prastleP 2 Replies Last reply Reply Quote 0
                      • redrumR Offline
                        redrum Admin @Hepps
                        last edited by

                        @hepps Yeah, the 2 types of damage (combat vs bombing) are treated completely separately. So for a unit with 3 HP and 3 max bombing damage then could sustain 2 of each before dying.

                        TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                        1 Reply Last reply Reply Quote 0
                        • prastleP Offline
                          prastle Moderators Admin @Hepps
                          last edited by

                          @hepps as always you amaze me H because I was actually thinking the same thing. Obviously they need to be Pu related and tied together. Damage = damage. I wonder if its possible? Once again you thought of the question before I even asked it. 🙂

                          If we open a quarrel between past and present, we shall find that we have lost the future! Sir Winston Churchill

                          HeppsH 1 Reply Last reply Reply Quote 0
                          • HeppsH Offline
                            Hepps Moderators @prastle
                            last edited by

                            @prastle Well they wouldn't necessarily need to be tied together or related... as long as the sample XML clearly defines the uses and limitations/potential conflicts of using both systems on the same unit... then you can have 2 independent types of damage.

                            "A joyous heart sours with the burden of expectation"
                            Hepster

                            prastleP 1 Reply Last reply Reply Quote 0
                            • prastleP Offline
                              prastle Moderators Admin @Hepps
                              last edited by

                              @hepps I cant see how independent would work when only one monetary system.

                              If we open a quarrel between past and present, we shall find that we have lost the future! Sir Winston Churchill

                              1 Reply Last reply Reply Quote 0
                              • HeppsH Offline
                                Hepps Moderators @redrum
                                last edited by

                                <option name="whenHitPointsDamagedChangesInto" value="1:germanBattleshipDamaged:true" count="1"/>
                                <option name="whenBombingDamagedChangesInto" value="1:germanBattleshipDamaged:true" count="1"/>

                                So question on this in case I am missing something here...

                                Even though the 2 types of damage are independent of one another.... if the unit changed into the same "Damaged" unit at the end of the current combat phase... wouldn't then either type of damage be cumulative?

                                ie. I send my strat. Bomber in to bomb a undamaged BB. Let's say it achieves a hit and the bombing damage option then changes the unit into a damaged ship (if there is only 1 type of damaged ship), then that new unit would by virtue of the unit change automatically be changed to a unit having only 2 remaining HP.... so then if you had also launched an attack against the same battleship... during the same pound wouldn't the unit now still have only 2 HP at the start of the naval combat? therefore basically overrighting the bombing damage?

                                "A joyous heart sours with the burden of expectation"
                                Hepster

                                redrumR 1 Reply Last reply Reply Quote 0
                                • redrumR Offline
                                  redrum Admin @Hepps
                                  last edited by

                                  @hepps It would only work that way if the damaged BB unit had say max HP of 2 instead of 3. The reason is it would only carry over the damage of the unit being replaced (if 'keepDamage'=true) which would only be bombing damage in your case. So you'd end up with a damaged BB unit with 1 bombing damage and 0 hit point damage.

                                  TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                                  HeppsH 1 Reply Last reply Reply Quote 0
                                  • HeppsH Offline
                                    Hepps Moderators @redrum
                                    last edited by

                                    @redrum Ah ok. So you would then have to have 4 different types of damaged unit, causing all kinds of issues with unit changing and re-changing depending on the damage taken... that does present an issue.

                                    "A joyous heart sours with the burden of expectation"
                                    Hepster

                                    HeppsH 1 Reply Last reply Reply Quote 0
                                    • HeppsH Offline
                                      Hepps Moderators @Hepps
                                      last edited by

                                      @hepps So using both types of damage on multi hit units is probably not a realistic goal.

                                      "A joyous heart sours with the burden of expectation"
                                      Hepster

                                      redrumR 1 Reply Last reply Reply Quote 0
                                      • redrumR Offline
                                        redrum Admin @Hepps
                                        last edited by

                                        @hepps Agree. There would need to be further thought and logic to better handle units that can take both types of damage. Probably something like a damageConvert unit option which would translate bombing damage to HP and vice-versa. So say if a BB had 3 HP and 15 max bombing damage then you could have a 1-to-5 damage conversion ratio so it is damaged evenly (ex. if it takes 5 bombing damage then would take 1 HP damage).

                                        You'd also have to think about how repair would work as well (again some conversion ratio so both are repaired at the same time or separate repairs). It gets pretty complicated pretty quickly.

                                        TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                                        HeppsH 1 Reply Last reply Reply Quote 0
                                        • HeppsH Offline
                                          Hepps Moderators @redrum
                                          last edited by

                                          @redrum Agreed.

                                          Probably best if those two conversions were independent of one another.

                                          "A joyous heart sours with the burden of expectation"
                                          Hepster

                                          redrumR 1 Reply Last reply Reply Quote 0
                                          • redrumR Offline
                                            redrum Admin @Hepps
                                            last edited by

                                            @hepps Initial PR to address the damage (not repair) portion of this feature: https://github.com/triplea-game/triplea/pull/2689

                                            Tested it by editing TWW to add unit, unit image, and below unit attachments:

                                            <attachment name="unitAttachment" attachTo="germanBattleship" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                                              <option name="movement" value="2"/>
                                              <option name="attack" value="7"/>
                                              <option name="defense" value="8"/>
                                              <option name="canBombard" value="true"/>
                                              <option name="isSea" value="true"/>
                                              <option name="hitPoints" value="2"/>
                                              <option name="bombard" value="6"/>
                                              <option name="requiresUnits" value="germanDocks:germanFactory"/>
                                              <option name="consumesUnits" value="1:germanHull"/>
                                              <option name="whenHitPointsDamagedChangesInto" value="1:true:germanBattleshipDamaged"/>
                                            </attachment>
                                            <attachment name="unitAttachment" attachTo="germanBattleshipDamaged" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType">
                                              <option name="movement" value="1"/>
                                              <option name="attack" value="3"/>
                                              <option name="defense" value="4"/>
                                              <option name="canBombard" value="true"/>
                                              <option name="isSea" value="true"/>
                                              <option name="hitPoints" value="2"/>
                                              <option name="bombard" value="3"/>
                                            </attachment>
                                            

                                            TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                                            HeppsH 1 Reply Last reply Reply Quote 3

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 1 / 5
                                            • First post
                                              Last post
                                            Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums