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

Rule problem: should not offer option to retreat #4688

Open panther2 opened 5 years ago

panther2 commented 5 years ago

Engine version

1.9.0.0.13066 1.10.14019

Map name

ww2-global_1940

Can you describe how to trigger the error? (eg: what sequence of actions will recreate it?)

(1) only a defending AAA-gun is left.

TripleA should not offer the attacker's option to retreat, if after a round of combat only a defending AAA-gun is left. In the attached savegames (1.9/1.10) the remaining infantry is incorrectly offered a retreat option when facing only a "defending" AAA gun.

(2) only a "defending" Transport is left

TripleA should not offer the attacker's option to retreat, if after a round of combat in a seazone only a "defending" Transport is left. In the attached savegame (1.10) the attacking submarines are incorrectly given the option to retreat/submerge: subs

Instead of this error, what should have happened?

(1) The AAA gun is autodestroyed, the territory is taken by the attacker. There is nothing to retreat from.

(2) The defending destroyer transport should be autodestroyed.

Any additional information that may help

Reference: https://github.com/triplea-game/triplea/issues/1270, an issue that had already been solved is back again.

@simon33-2 mentioned in https://www.axisandallies.org/forums/post/1258083

What about the retreat rules? Issue #1270. #2080 was reverted due to performance problems in #2544. So there’s still problems - if you attack and only have a transport or an AA Gun defending, you are still permitted a retreat.

I could reproduce the AA Gun issue as mentioned above: savedGames.zip

The transport issue is reproducible in case the attacking units are submarines: defTrp_2.zip (1.10 file here)

simon33-2 commented 5 years ago

Just pointing out there is a typo above where you say "destroyer" instead of "transport"

Also, there's a good improvement here potentially, that when you send a sub to kill an undefended transport, you shouldn't get a prompt to submerge the sub like you do in 1.9.

There's actually two ways of achieving this, I was thinking you'd need an incompatible release way (1) is to change the order so that undefended transports are removed before the submerge prompt (2) is to remove the prompt when only defenseless units are defending.

Actually (2) may be better because in (1) you would still get the submerge prompt which would be annoying.

panther2 commented 5 years ago

Just pointing out there is a typo above where you say "destroyer" instead of "transport"

Fixed that, thank you @simon33-2 .

ron-murhammer commented 5 years ago

@panther2 It appears the check for submerging subs is done before the check for undefended transports. Would flipping the order of those 2 checks solve the issue? Or would that create a different problem?

panther2 commented 5 years ago

@ron-murhammer In case there are undefended transports the battle ends with the transports being destroyed and the subs remaining. So there shouldn't be an offer for the subs to submerge/retreat at all. If that was the (only) result of your idea it would be fine.

Regarding possible different problems: Is there anything else behind the check for undefended transports?

Cernelius commented 5 years ago

Since TripleA is not only about some games, and I guess you are not hardcoding this to work only with these specific games and nothing else, I believe you should also decide what that AA gun rule means in general terms. Like, does it mean that anytime the defender has no rolls available (also notice that this doesn't mean all cases you are powerless, as you may also have some rolls hitting at 0, thus never; still, in this case, you would have 0 total strength yet not 0 rolls (so, a unit with 0 rolls would be autodestroyed while a unit with 1 roll at 0 wouldn't)), then all defending not-infrastructure units are autodestroyed and the attacker cannot retreat? Or adding a unit option to define if that unit is autodestroyed if only such units are left, beside infrastructures? Or what?

In any case, I suggest this matter being discussed in forum, as it is liable to impact on present and future custom games (for example, the trenches of Domination 1914).

DanVanAtta commented 4 years ago

I've proposed a fix for part (2) relating to the subs with: https://github.com/triplea-game/triplea/pull/6505

6505 adds a check if subs are attacking only undefended transports. If so, then the submerge prompt is suppressed and in both cases of attacking only undefended transports or if we have at the end of combat killed all non-transports, then the undefended transports are auto-destroyed and there is no option to submerge.

Cernelius commented 4 years ago

Can we please have, for custom games, a property for allowing retreating when all enemy units left are defenceless (basically, keeping the current behaviour as an option for gamemakers that prefer it)?

I personally prefer the current (wrong) behaviour, as it avoids the (in my opinion weird) trick of selectively removing your non-defenceless units to take away the option to retreat from your opponent.

DanVanAtta commented 4 years ago

@Cernelius I'm not sure that applies here. The transport in this case is not eligible as a casualty. For example, 3 subs vs 1 cruiser and 1 transport, the cruiser is the only available casualty selection and is auto-selected.

If the transport is available as casualty, then A) I don't think that is in the scope of this problem report, and B) would not change with #6505

Cernelius commented 4 years ago

@Cernelius I'm not sure that applies here. The transport in this case is not eligible as a casualty. For example, 3 subs vs 1 cruiser and 1 transport, the cruiser is the only available casualty selection and is auto-selected.

If you mean the second paragraph at my previous post, correct, as, since you must always take transports last, there is no trick in this case (still, in this case, I think it makes sense that you can decide to retreat instead of proceeding finishing off all transports left, but I would agree this is consistent with the fact that, on land, you must conquer a territory after destroying all enemy war units in it). However, I was actually referring to the v5 aaGun case (but it also applies to any custom maps having defenceless war units that are not deprioritized, for example the trenches of D1914NML), where, as the defender, if you take a number of hits that is less that the total hitpoints you have in the battle but as many as or more than the total hitpoints discounting the defenceless units, then you can take out all defenceless units, obliging the attacker automatically to destroy the remaining defenceless units, thus making it unable to retreat.

I'll use D1914NML, with Low Luck enabled and no Tech, to make an example of what I mean.

6 infantry and 6 field_gun attack 1 territory defended by 2 trench and 1 infantry. During the first round of combat, the defender takes out 1 infantry and 1 trench, while only 1 damaged trench remains in the battle, on the defensive side.

CURRENT BEHAVIOUR: The attacker can retreat. CORRECT BEHAVIOUR: The attacker cannot retreat and it is forced to kill the remaining trench and take the territory.

The consequence of that is that, under the correct behaviour, you can never strafe such a territory safely, as the defender can always pull the trick of taking out the infantry (thus, even if you score only 1 hit, the defender can take out the infantry and leave 4 hitpoints of trenches that you will be obliged to kill).

I personally prefer the current wrong behaviour, so I was suggesting leaving it as an option (property) for mapmakers. I also guess the players of D1914NML are currently playing by the (wrong) engine behaviour, since I'm under the impression either almost no one reads any rulebooks or most people just prefer going with the engine anyway, or both.

simon33-2 commented 4 years ago

I agree with @Cernelius .

I just wonder if there is a better way of requiring units to be taken as casualties last. I tried to enable that a while back for AA Guns but couldn't see a way of doing it.

Should there be a separate property on the unit attachment which forces it to be taken last (or even a group number) and/or a property which causes that unit type to not be counted for the purposes of determining if a retreat is valid?