triplea-game / triplea

TripleA is a turn based strategy game and board game engine, similar to Axis & Allies or Risk.
https://triplea-game.org/
GNU General Public License v3.0
1.35k stars 399 forks source link

Castles don't switch owner when territory is passed to ally (and then can't produce) #9523

Open RaiNova opened 3 years ago

RaiNova commented 3 years ago

When you form an alliance in "A Song of Ice an Fire" you automatically hand over any territory to your ally that you own and she originally owned. If such a territory holds a castle, the castle is not handed over but stays in your possession. But a castle on someone elses territory cannot be used. IMHO the correct behaviour is to hand over the castle to the new ower.

Cernelius commented 3 years ago

@RaiNova As much as it sounds easy to reproduce, I suppose it would be good to have a savegame.

Since castles are capturable (infrastructure) units, I'm farly certain this is a behaviour which cannot be justified, as I think castles should be conceptually the same as factories (for being bound to the territory), even though aa guns, instead, may or may not be turned over when a territory is liberated, depending on the rules-set.

RaiNova commented 3 years ago

@RaiNova As much as it sounds easy to reproduce, I suppose it would be good to have a savegame.

Since castles are capturable (infrastructure) units, I'm farly certain this is a behaviour which cannot be justified, as I think castles should be conceptually the same as factories (for being bound to the territory), even though aa guns, instead, may or may not be turned over when a territory is liberated, depending on the rules-set.

In order to provide a bug fix: could somebody tell me the exact criteria to test? My current version (not yer turned into a pull request) assigns all units which are not transportable and have no movement to the new territory owner. Is that good enough?

Cernelius commented 2 years ago

In the basic games, the only units which may be turned over to an ally are all "infrastructures". Also in the basic games, all immobile units are infrastructures (but not all infrastructures are immobile).

If you are going to make a general fix for this, it is opportune at least to consider what the rules are supposed to be for the two infrastructures you meet in all basic games before WWIIv5: the "factory" and the "aaGun".

You may have noticed that I've been vague about the "AA Gun" units. The reason is that the rules for them are not certainly clear to me and are not currently correctly supported by the program.

As I said, Factories have always the same owner as the territory where they are, but AA Guns may have a different owner and may or may not change ownership when a territory changes ownership, depending on the rules-set.

Specifically, talking about the intended behaviour for the basic games:

Let's make a practical example, and let's assume that we are having such situation in Classic, Revised basic and Revised LHTR all the same. At some point in the game, India (which is originally owned by the British) is owned by the British and the only units which are present in the territory are 1 British Infantry and 1 British AA Gun. Thereafter, the Japanese attack India, kill the British Infantry and capture both India and the AA Gun. Thereafter, the Germans capture the capital of the British. Thereafter, the Russians attack India (while the AA Gun is still in India) and capture the territory from the Japanese while the British control no capital. Thereafter, the Americans liberate the capital of the British (while the AA Gun is still in India).

In the detailed sequence of events,

About this, there are two main problems in the current program. Anyone can reproduce them both at once by starting "World War II v4" (at standard options) and enable Edit Mode, then remove 1 British infantry from Persia and change the ownership of Persia to Japanese and add 1 Japanese infantry and 1 Japanese aaGun in Persia and give the United Kingdom territory to Germans (or any other Axis player). Once the above is done, disable Edit Mode, skip the "Russians production" phase and attack Persia with Russians during the first "Russians Combat Move" phase, winning the battle. Thence skip every phase until the British retake the United Kingdom territory. If, immediately after all the above is done, you look at the Persia territory on the board, you will see that Persia is British and has 1 Russian AA Gun on it. However, if you look at the Territory tab of Persia, you will see that both the territory and the AA Gun are British owned. I assume that this is merely a visual glitch determined by the fact that the program misses to update the board view of the AA Gun when changing its ownership from Russians to British. Indeed, on the subsequent "British Non Combat Move" phase, you'll be able to move the Russian-looking AA Gun (although you cannot select it directly by clicking on it, but you can do so by Shift+LeftClicking on the territory), which will then immediately turn British. The second (and more important) problem is that the AA Gun turning British is a wrong behaviour, because, in the V4 game (as well as in Revised LHTR and the First Edition of the Europe/Pacific/Global 1940 series), AA Guns never change ownership when territories are returned (they do so only when they are captured or liberated during a battle against something or nothing). Ironically, the visual glitch make it look like the program is working correctly, as it fails to update visually something which happens yet should not happen. Thus, paradoxically, one could say that the glitch is correct. Generally speaking, it seems that, on this matter, the program simply applies the Revised basic behaviour to every infrastructure in every game. Since only Revised basic has such a behaviour for both Factory and AA Guns, this causes all relevant games but Revised basic to behave wrongly (thus Classic, Revised LHTR, V4 and the First Edition of the Europe/Pacific/Global 1940 series all behave wrongly). As said, the problem doesn't exist for V5 and later games simply because the AA Gun unit has ceased to be an infrastructure since V5.

However, especially since I'm very unsure about the intended behaviour of Classic (all I said being merely my interpretation of rules which I don't find to be very clear) I defer to @panther2.

I want to make everyone notice that the "Factory" behaviour we are looking at may be completely unrelated to it being an infrastructure, rules-wise. All we know, as far as the intended rules are concerned, is that Factories have always the same owner as the territory where they are, but I don't believe we know why is that: to relate that to being an infrastructure is merely a guess. For example, I could, instead, relate that to the fact that every Factory is a movement 0 unit (which seems to be the assumption on which the referenced Pull Request is based), thus stating that every movement 0 unit (which is only the Factory in every basic game but the Global 1940 series, and it is every unit which behaves the same as the Factory in the Global 1940 series) has always the same owner as the territory where it is. This may actually be better than the infrastructure-related assumption, as currently in "Napoleonic Empires" you have the oddity that turning over a territory to an ally do not turn over the fortresses and mortella towers (non-infrastructure immobile units) that are in that territory, which is quite clearly not what you would expect to happen in reality (and it may cause the even more odd oddity of having fortresses (or mortella towers) at war against the territories on which they stand, if you first turn back the territory to a new ally and thereafter declare war on that same player) even though it could happen that you turn over the land but keep the ownership of some estates on it, although usually the owner of an estate is also the "landlord".

In general terms, the fact is that, when territories are turned over to an ally, not all "infrastructure" units are to behave the same way in all rules-sets. The matter is that, in some rules-sets, the "Factory" behaves one way and the "AA Gun" behaves another way. Still in general terms, it has to be decided what makes the "AA Gun" behave differently from the "Factory". Is it the fact that the "AA Gun" moves (which would imply mobile Factories should then behave like AA Guns and immobile AA Guns should behave like Factories)? Is it the fact that the "AA Gun" is a combat unit? Something else maybe? In specific terms, it has to be decided whether the castle of this game should behave like a "Factory" or like an "AA Gun": I believe this is an open question.

RaiNova commented 2 years ago

@Cernel Thank you for the details rules description! The fix for this issue turns over all units of the old owner that cannot move (zero movement points) and cannot be transported to the new owner. Since the aaGun can move, I'll ignore your information about it in the following.

For example, I could, instead, relate that to the fact that every Factory is a movement 0 unit (which seems to be the assumption on which the referenced Pull Request is based), thus stating that every movement 0 unit (which is only the Factory in every basic game but the Global 1940 series, and it is every unit which behaves the same as the Factory in the Global 1940 series) has always the same owner as the territory where it is. This may actually be better than the infrastructure-related assumption, as currently in "Napoleonic Empires" you have the oddity that turning over a territory to an ally do not turn over the fortresses and mortella towers (non-infrastructure immobile units) that are in that territory, which is quite clearly not what you would expect to happen in reality (and it may cause the even more odd oddity of having fortresses (or mortella towers) at war against the territories on which they stand, if you first turn back the territory to a new ally and thereafter declare war on that same player) even though it could happen that you turn over the land but keep the ownership of some estates on it, although usually the owner of an estate is also the "landlord".

Exactly. With the fix, in "Napoleonic Empires" the fortresses and mortella towers should change ownership. I cannot verify that at the moment, though, because when I try to Download Maps I get the following error:

image

... which I just reported.

@DanVanAtta Would you know what I can do to download maps? (Be prepared for the discussion when I add a test case that demonstrates the correct behavior in "Napoleonic Empires" 😀)

Still in general terms, it has to be decided what makes the "AA Gun" behave differently from the "Factory". Is it the fact that the "AA Gun" moves (which would imply mobile Factories should then behave like AA Guns and immobile AA Guns should behave like Factories)? Is it the fact that the "AA Gun" is a combat unit? Something else maybe?

As implemented by my fix, the difference is that the aaGun moves - so now owner change - while the factory cannot move and cannot be transported (=> owner change).

In specific terms, it has to be decided whether the castle of this game should behave like a "Factory" or like an "AA Gun": I believe this is an open question.

I assume by this game you mean a song of ice and fire. I'm sure the castle should be turned over, because - like a factory - it produces units. And it can only produce units on a territory of the same owner. a song of ice and fire also has walls. My fix treats them the same way as the castles. I agree with your logic above: The territory owner should be the "landlord" of the real estate.

Do you know any units that cannot move but can be transported in any game?

beelee1 commented 2 years ago

@RaiNova Roger Cooper has been DLing manually.

https://forums.triplea-game.org/topic/3109/unable-to-download-maps-in-2-6-535/11?_=1643403257590 my guess is he goes here: https://github.com/triplea-maps but I'm not 100% sure of the process

RaiNova commented 2 years ago

@beelee1 my guess is he goes here: https://github.com/triplea-maps but I'm not 100% sure of the process

Yep - that worked. So if you'd every need to get a map - feel free to ask me how.

Cernelius commented 2 years ago

I think this behaviour deserves having a property which determines whether or not all movable units are turned over when the territory is. The default of such a property would be, of course, false. When the property is false, only infrastructures may be turned over. When the property is true, all movement 0 units (possibly excepting those which can be transported, if it is preferred excepting them) are turned over.

One may even consider having an option per unit, but this may be too much.

Of course, this would require also updating the map by adding the property valued true (and also updating all "Napoleonic Empires" games if preferred).


I'm not sure, but I tend to think it may be better that the behaviour does not take into account whether or not the unit may be transported. This would also likely shorten a property description.

Do you know any units that cannot move but can be transported in any game?

Both games of the https://github.com/triplea-maps/total_world_war map: the "Material" has movement 0 yet it can be transported and given movement by other units. https://raw.githubusercontent.com/triplea-maps/total_world_war/master/map/games/Total_World_War_Dec1941_3.0.xml

        <attachment name="unitAttachment" attachTo="Material" javaClass="UnitAttachment" type="unitType">
            <option name="movement" value="0"/>
            <option name="attack" value="0"/>
            <option name="defense" value="0"/>
            <option name="transportCost" value="2"/>
            <option name="canBeDamaged" value="true"/>
            <option name="maxDamage" value="1"/>
            <option name="canDieFromReachingMaxDamage" value="true"/>
            <option name="isAAmovement" value="true"/>
            <option name="isLandTransportable" value="true"/>
            <option name="isInfrastructure" value="true"/>
            <option name="isAirTransportable" value="true"/>
            <option name="canBeGivenByTerritoryTo" value="Germany:Britain:Japan:Australia:Canada:DanubeAxis:Egypt:Finland:India:Manchuria:SouthAfrica:Thailand:VichyFrance:ExiledAllies"/>
            <option name="requiresUnits" value="germanFactory"/>
            <option name="requiresUnits" value="russianFactory"/>
            <option name="requiresUnits" value="japaneseFactory"/>
            <option name="requiresUnits" value="chineseFactory"/>
            <option name="requiresUnits" value="britishFactory"/>
            <option name="requiresUnits" value="italianFactory"/>
            <option name="requiresUnits" value="americanFactory"/>
            <option name="requiresUnits" value="spanishFactory"/>
            <option name="requiresUnits" value="swedishFactory"/>
            <option name="requiresUnits" value="turkishFactory"/>
            <option name="requiresUnits" value="brazilianFactory"/>
        </attachment>
RaiNova commented 2 years ago

@Cernelius I think this behaviour deserves having a property which determines whether or not all movable units are turned over when the territory is. The default of such a property would be, of course, false. When the property is false, only infrastructures may be turned over. When the property is true, all movement 0 units (possibly excepting those which can be transported, if it is preferred excepting them) are turned over.

I assume you meant "whether or not all non-moveable units" when you wrote "whether or not all moveable units". Could you please describe a situation, in which it is better not to turn non-infrastructure, non-moveable units over?

In "Napoleonic Empires": How can I produce a situation, in which a territory is turned over to an ally? The only way I found so far was using "Edit mode".

Cernelius commented 2 years ago

@Cernelius I think this behaviour deserves having a property which determines whether or not all movable units are turned over when the territory is. The default of such a property would be, of course, false. When the property is false, only infrastructures may be turned over. When the property is true, all movement 0 units (possibly excepting those which can be transported, if it is preferred excepting them) are turned over.

I assume you meant "whether or not all non-moveable units" when you wrote "whether or not all moveable units". Could you please describe a situation, in which it is better not to turn non-infrastructure, non-moveable units over?

Yes, beside the fact that I'm not sure if writing "moveable" is better than writing "movable".

In "Napoleonic Empires": How can I produce a situation, in which a territory is turned over to an ally? The only way I found so far was using "Edit mode".

This matter applies mostly to the two FFA game-modifications, rather than to the basic Napoleonic Empires game. However, I believe you should be able to reproduce the situation in that game too by these steps, without requiring "Edit Mode":

Cernelius commented 2 years ago

Could you please describe a situation, in which it is better not to turn non-infrastructure, non-moveable units over?

Mostly, I don't like having options determining other things beside what they should determine. When I set a unit movement at 0 or not, I prefer not being forced setting other behaviours with this unless a property is saying that movement 0 units do that too. However, it can also be imagined a player is missing the ability to purchase a movement 0 unit which an other player has, and it is also supposed never to have it, so it is likely missing an image for the unit.

RoiEXLab commented 2 years ago

Closed via #9962

RaiNova commented 2 years ago

a player is missing the ability to purchase a movement 0 unit which an other player has, and it is also supposed never to have it, so it is likely missing an image for the unit.

If the owner change should not happen: What's the situation? What should happen? If the owner change should happen: Is there a requirement to automatically verify completeness of a map/game? Is so: Feature request please.

Cernelius commented 2 years ago

@RaiNova If you mean checking if the image is present to turn over the unit, I'm against having any game behaviour dependant on any skin, even the original.

The added feature is fairly good, just, as I said

I don't like having options determining other things beside what they should determine.

Thus I think the movement should determine only the mobility of the unit.

On top of that, the new feature not only requires map-makers to know that movement 0 units have this property (of being turned over with the territory if the owner is the same) but also to know that they are exempted if they are transportable.

I would agree most or even all games are likely to prefer turning over movement 0 units. However, I'm more doutful on the matter of excepting transportable ones.

RaiNova commented 2 years ago

However, I'm more doutful on the matter of excepting transportable ones.

Would you have a real example for me?

Cernelius commented 2 years ago

However, I'm more doutful on the matter of excepting transportable ones.

Would you have a real example for me?

Hardly any.

asvitkine commented 2 years ago

Re-opening since the PR was reverted.