Add Support for Land Transports Moving Through Canals


  • Admin

    Based on the recent changes to Red Sun Over China, canals reject units even when they should be transported by a land transport: https://forums.triplea-game.org/topic/947/red-sun-over-china-possible-bugs/51

    PR: https://github.com/triplea-game/triplea/pull/3894


  • Moderators

    I don't have a makercase right now, but I think it may be good to have a switch on/off in the canal itself, to determine if transported units are never validated. You could have, for example, heavy artillery pieces that can be moved by mules, but cannot go in mountains but through a limited numbers of routes, while the mules (eventually with lighter pieces) can.


  • Admin

    @cernel Considered it but felt it would probably never be used. I think instead of that I'd rather focus on other canal enhancements like:

    1. Add support for checking conditions in addition to the existing territory ownership checks. This is actually relevant to RSOC as I want a canal to open when war is declared so instead I have to trigger ownership of some fake territory then check that.
    2. Add field for units ('cantPassUnits') that never pass (essentially opposite of 'excludedUnits' which always pass). This would obviously allow RSOC to avoid needing 2 sets of canals per station connection. I think their are lots of use cases here but most obvious are you could have very large/heavy units say like battleships/carriers that can't pass through some minor canals.

  • Moderators

    @redrum said in Add Support for Land Transports Moving Through Canals:

    @cernel Considered it but felt it would probably never be used. I think instead of that I'd rather focus on other canal enhancements like:

    On this matter, there is a bug I never reported. Currently, canals block infantry, thus they block paratrooping bombers too, which they shouldn't (if @Panther can confirm bombers with infantries in them should ignore canals). This can be relevant for the Suez canal, in v3 games, and could be addressed by excluding infantry from validation, but that would be a workaround a wrong default setting. So, if you can extend this feature to air transports too, that would actually fix a bug as well.
    I still think being able to decide if transported units are excluded or not would make a good amount of sense as an option (of course, your excluded default is preferable), also for being informative, but I agree not a very useful item, likely.
    The other item, on this matter, is that until now transported units were not excluded, so you might have a custom map using that (not aware myself), and, practically, you currently have this option already for sea transports (I guess you are not changing that, as it would be useless, unless transports will start being able to transport air or other sea units), as you can have specifically excluded the land units you want (that cannot move on sea on their own anyways), to have the transports being able to pass only if not loaded (by excluding the transport from canal validation, but not the loaded units).
    For example, you could have something like this:

        <attachment name="canalAttachment05" attachTo="15 Sea Zone" javaClass="games.strategy.triplea.attachments.CanalAttachment" type="territory">
          <option name="canalName" value="Turkey"/>
          <option name="landTerritories" value="Turkey"/>
          <option name="excludedUnits" value="transport"/>
        </attachment>
        <attachment name="canalAttachment05" attachTo="16 Sea Zone" javaClass="games.strategy.triplea.attachments.CanalAttachment" type="territory">
          <option name="canalName" value="Turkey"/>
          <option name="landTerritories" value="Turkey"/>
          <option name="excludedUnits" value="transport"/>
        </attachment>
    

    That would allow (currently supported, albeit likely not intended) only unloaded transports to move through the Turkish straits, when Turkey is not owned, while transports loaded with any units would be blocked. Or you could say that some units can and other cannot (maybe materials only allowed and no the other land units, to represent an embargo on military stuff).
    Of course, that is not needed for WWII, as (Turkey being neutral) you can freely pass through the Turkish straits with merchant ships loaded with any kind of stuff, if the game is realistic.

    1. Add support for checking conditions in addition to the existing territory ownership checks. This is actually relevant to RSOC as I want a canal to open when war is declared so instead I have to trigger ownership of some fake territory then check that.

    This would be a great enhancement and, if you remember, this is what Veqryn suggested in the discussion we had years ago. Of course, everything can currently be hacked via territory ownership changed with triggers, or other devious means, but having it properly supported feels good. Likely, the most coherent way, at the moment, would be having a trigger that modifies the canal itself (look at my "WWIIv3 Tech Advance" game). Also, this would allow to cleanly have both parallel and serial canals in the same game. Finally, being able to test conditions would offer the possibility, with custom properties, to cleanly implement the missing optional rule for the Dardanelles in the v3 and v5 games (the editable property would be the condition's item), as per this topic:
    https://forums.triplea-game.org/topic/913/ww-ii-v5-1942-2nd-edition
    You will have, then, to decide if the "landTerritories" check should be deprecated, as redundant, and my suggestion is not to (as I think it is good not being obliged to refer to an external condition).
    I assume this would also imply the need of rework the message to the users, that you get when trying to pass a canal unsuccessfully (not sure if it would need to be customized, especially since it is a very minor item, that I doubt most even read).
    Finally, I definitely believe that, especially in case of supporting customized conditions, you should be allowed not having the "landTerritories" option for the canal. On this regard, I believe these should be the behaviours:

    • if both "landTerritories" and "conditions" are missing for the canal, the canal is always closed (all units but excluded ones (default all air) can never pass).
    • if "landTerritories" is present and "conditions" is missing, you only need "landTerritories" (as per current behaviour).
    • if "conditions" is present and "landTerritories" is missing, you only need "conditions".

    On the other hand, I don't have a strong opinion about what should happen when both "landTerritories" and "conditions" are present (it should be decided if needing either both or only one).

    1. Add field for units ('cantPassUnits') that never pass (essentially opposite of 'excludedUnits' which always pass). This would obviously allow RSOC to avoid needing 2 sets of canals per station connection. I think their are lots of use cases here but most obvious are you could have very large/heavy units say like battleships/carriers that can't pass through some minor canals.

    I personally don't have any problems with making serial canals for achieving that. Since the case of having only two serial canals, of which one always block the validated units, is just one of the many cases you can have, I don't see a good reason for having an alternative way to support that only. I think this feature would be superfluous, and I'd keep doing it via multiple serial canals (it would just need to support having canals that are always closed, to not require hacks in the form of setting dummy territories; see above).
    If you really want to go this way, I think the name may be not so good, in the moment you are not changing "excludedUnits"; I would call this option as "unallowedUnits". Alternatively, you could have an option called "includedUnits", default to all if missing, that limits the units that can possibly pass the canal, while the others are always blocked. In any cases, you will have to decide what actually happens if a mapmaker lists a same unit both in this new option and the "excludedUnits" one (another reason why it doesn't feel right to have an option for always blocking units in the moment you already have an option for never validating them).

    Final additional note, a problem I always had with canals is that they allow can openers; like British take the required territories and, then, Americans go through the canals, before Germans can do anything (if the Germans turn is not in between of British and Americans). That doesn't really make sense, but it is practically the same nonsense you get with land blockers and canopeners by multiple players, but I wonder if it's just me or there is interest in having something changing this item, sort of like the repair at start owner's turn?


  • Admin

    @cernel said in Add Support for Land Transports Moving Through Canals:

    On this matter, there is a bug I never reported. Currently, canals block infantry, thus they block paratrooping bombers too, which they shouldn't (if @Panther can confirm bombers with infantries in them should ignore canals).

    Confirmed. The movement of air units is completely unaffected by canals.
    In v3 bombers act as transport for one infantry unit. (In Global the paratrooper-unit flies "itself" - under the same restrictions as air units.)


  • Moderators

    @redrum Another suggestion may be adding an option for canals to consume units movement points. This way, you could set the canals to take more movement between stations that are farther away. In this case, it would be cool having also an "all" setting for it, where moving through the canal would consume all movement of the unit (so, you could pass the canal only if the unit does it as its first movement and it cannot more anymore after that). I would have a use for that in moving over the ice between Finland and Svealand.



  • What happens when there are multiple canals between two territories? Do units need to be able to pass every single one of them, or any single one of them in order to pass?


  • Moderators

    @alkexr https://github.com/triplea-maps/the_pact_of_steel/blob/master/map/games/pact_of_steel_2.xml
    In case of multiple canals (meaning multiple pairs of canal attachments) for the same two connected zones, a unit is blocked only if blocked by all of the canals. If the property "Control All Canals Between Territories To Pass" is true, a unit is blocked if blocked by any of the canals.

    I think it would be better if it can be specified for the single canal, instead of as a general property, but this would be an item only for a map needing both parallel and serial canals (that doesn't exist and low probability it's coming soon).
    Anyways, if @redrum adds support for conditions, you can just go whatever way with a single canal.


  • Admin

    @alkexr As @Cernel mentions, there is a map property that when 2 territories have multiple canals between them whether units have to control all or just one to pass. Here is the property:

        <property name="Control All Canals Between Territories To Pass" value="true" editable="false">
          <boolean/>
        </property>
    

    The default is 'false' meaning you only need to control one not all but you can look at the newly released Red Sun Over China to see how I set this to 'true' and have essentially 'serial' canals for trains.