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

Incorrect Handling of v3+ Transports Stalemate and Defining 0v0 Stalemate Behavior #2367

Closed panther2 closed 4 years ago

panther2 commented 7 years ago

My Operating System:

Windows 7.64

TripleA version:

1.9.0.0.6620

Map:

wwIIv3, v4, v5, v6, Pacific 1940, Europe 1940, Global 1940

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

In case the result of a sea battle is an attacking transport facing a defending transport TripleA does not offer the attacker's option to retreat but ends the battle leaving both transports in the contested seazone.

Instead of this error, what should have happened?

In the given (special) scenario the attacker should have the option to either leave the transport in the contested seazone or retreat (given a retreat route had been established before).

Any additional information that may help:

The rulebooks of the affected games say

In a sea battle, if both sides have only transports remaining, the attacker’s transports can remain in the contested sea zone or retreat per the rules in Condition B below, if possible.

This is an exception of the scenarios dealt with (and correctly resolved) in #1270 - and most likely this had never been implemented correctly in TripleA.

Older wwII versions (v2 and earlier) are not affected, as transports defended at 1 there, so the issue could not occur.

transports_remaining_stalemate.zip (wwII_Global 1940.2nd, see SZ 115 in history mode)


EDIT: In addition to this v3+ transport issue, NML also has 0v0 stalemate between conscripts and trenches that should allow retreating instead of being forced to stay: https://forums.triplea-game.org/topic/1399/domination-1914-no-man-s-land-official-thread/164

DanVanAtta commented 4 years ago

That's correct @panther2 , the distinction of 'combat' vs 'non-combat' might still be useful for this though IMO. It's really tricky if the rule is just a special rule for one specific unit on a few very specific maps. If we add a 'combat' and 'non-combat' attribute to units, the combat decision logic suddenly makes more sense (IE: combat units are not given a choice to retreat if only non-combat units remain, hence carriers are not given a retreat option because they are combat units, while transports are not combat units and are given a choice to retreat).

In furtherance of this, we can define that non-combat units must be chosen last as casualties (and that would be why transports are chosen last, not because they are transports, but because they are non-combat units).

Cernelius commented 4 years ago

That's correct @panther2 , the distinction of 'combat' vs 'non-combat' might still be useful for this though IMO. It's really tricky if the rule is just a special rule for one specific unit on a few very specific maps. If we add a 'combat' and 'non-combat' attribute to units, the combat decision logic suddenly makes more sense (IE: combat units are not given a choice to retreat if only non-combat units remain, hence carriers are not given a retreat option because they are combat units, while transports are not combat units and are given a choice to retreat).

In furtherance of this, we can define that non-combat units must be chosen last as casualties (and that would be why transports are chosen last, not because they are transports, but because they are non-combat units).

I believe the option you want already exists, and it is called isCombatTransport.

I, of course, believe that 0/0 "V3 Rules" transport having this option false should be subjected to the retreat before stalemate if alone special rules, but not if this option is true. Of course, if "V3 Rules" don't generally apply, all transports are "combat transports", without needing that unit option, so they should never have the special retreating privilege.

This is what I was going to say if anyone would have answered me this question:

Ok, so the next question is: is the item relevant for v3/deprioritized transports only or for whatever transports?

DanVanAtta commented 4 years ago

I believe the option you want already exists, and it is called isCombatTransport.

Oh.. that kinda makes me slightly sad as that is just kinda hacky. The existence of that option does not really negate the usefulness of having a bona fide concept of combat and non-combat attackers.

There is more flexibility in having a more generalized attribute IMO and makes the rules much more coherent. For example, what if there are multiple kinds of transports, what about say non-combat support units, like an "admiral ship" that is not itself a combat unit. It would not make much sense to need to designate the "admiral ship" as a "isCombatTransport=false" so it gets the right rules treatement.

DanVanAtta commented 4 years ago

@Cernelius what do you mean by a 'deprioritized' transport? A transport that must be chosen last in casualties?

If so, I think that reinforces the notion and value of considering some units as "combat" and others as "non-combat attackers"

Cernelius commented 4 years ago

@Cernelius what do you mean by a 'deprioritized' transport? A transport that must be chosen last in casualties?

Yes.


So, can anybody answer me if this change have been made on transports in general or only to transports that follow v3 rules AND are isCombatTransport false?

Whatever the answer, this rule should apply only to transports that follow v3 rules AND are isCombatTransport false.

DanVanAtta commented 4 years ago

Nothing has changed regarding these rules yet.

DanVanAtta commented 4 years ago

Whatever the answer, this rule should apply only to transports that follow v3 rules AND are isCombatTransport false.

Perhaps, though that is quirky and would not be flexible for other map types. For example, 'conscripts', let's say we wanted them to actually be treated like v3 transports (and if not conscripts, then perhaps some other fictitious unit on some other map), there would be no way to get the same transport retreat option and the game mechanics would be inconsistent and extremely specialized to one rule variant.

I'd suggest we define it as combat and non-combat attacker units. 'isCombatTransport=false' would then imply that the unit is a 'non-combat attacker'. Then for other units, potentially units that are not transports, we could give them the same rule by marking them as a 'non-combat attacker'.

DanVanAtta commented 4 years ago

To pile on, the coding, logic, consistency all get stupid simple if we say "non-combat attackers" are allowed to retreat if remaining against only units with 'zero defensive' power. That naturally extends to other maps in a pretty logical way, it also easily resolves why for example a carrier or any other unit could or could not be given the same retreat option.

Cernelius commented 4 years ago

Of course, I would be totally on board with recoding the special retreat option so that any mapmakers can apply it more specifically, and to land units too, if wanted, or even to cases in which we don't have 0/0, but this is probably expanding this one issue too much.


I'd suggest we define it as combat and non-combat attacker units. 'isCombatTransport=false' would then imply that the unit is a 'non-combat attacker'. Then for other units, potentially units that are not transports, we could give them the same rule by marking them as a 'non-combat attacker'.

No. This would be inconsistent with how everything currently works. All unit boolean options are default false, so all units are isCombatTransport false, already, unless they are true. If you take Classic or Revised, and add isCombatTransport false to the transports, nothing changes because they are already false, of course. But v1/v2 rules transport that are isCombatTransport false, by default or because you actually specify it in the attachment, are fully combat able transports, even if they are 0/0 (they may still get supported too). What the isCombatTransport unit option is doing is that it removes ALL the v3 special transport rules from units having transport capacity, thus it is supposed to be used only when having such rulesets.


Ok, I'll make an example, that I hope will be clear. Let's say we have World War II Global 1940 2nd Edition. I make a mod of that game in which I give each carrier the ability to transport 1 infantry. If I do nothing else, then the attacking carriers should have the retreat before stalemate special rules, just like the transports, as well as being generally treated as transports, under v3 rules (the program will force me to have them as 0/0). However, if I give each carrier the ability to transport 1 infantry AND set isCombatTransport true for the carrier, then the carriers of my mod behaves exactly like the original, being a fully combat able unit, beside only being also able to load, carry and offload 1 infantry. I hope all is clear now.

Cernelius commented 4 years ago

Really, that option would benefit a name change from isCombatTransport to something like doNotFollowV3OnlyTransportRulesIfInEffect, or something like that.

DanVanAtta commented 4 years ago

Of course, I would be totally on board with recoding the special retreat option so that any mapmakers can apply it more specifically, and to land units too, if wanted, or even to cases in which we don't have 0/0, but this is probably expanding this one issue too much.

No. This would be inconsistent with how everything currently works.

Hyperbole aside, the 'isNonCombat' attribute perhaps would not even be a boolean value. A first iteration may not even expose it to map makers as the value would need to be implicitly defined in perhaps odd ways to account for backward compatibility to all existing rule sets. The value exposed in XML, if any, and when, might be an 'override' , TBD when we get there.

For now the general concept I think is more useful, otherwise we remain in the realm where we can't say why such a rule does not apply to other '0' attack units (just because they are not transports, but that gets to be wonky because TripleA is a rule engine, not a specific rule set or specific set of maps).


Understood about your example. I'm saying 'isCombatTransport' is a non-intuitive option for the behavior we are talking about. Let's say I create a map, I want a unit called "admiral ship", that behaves like transports but instead of transporting it buffs all other combat boats present in the battle. Adding 'isCombatTransport' makes little sense because the unit can't transport to begin with.


Part of the problem is that the game engine has no real concept of V3. It makes things kinda difficult. I think if we create a lot of rules that are specific to naval "Transport" unit, we'll fail to ever make it general for land transports, or other non-transport non-combat attacker units. It generally stays complex. I think the solution here is for us to define the 'non-combat attacker' term, build it in the back-end, and then think about how to expose it to map makers in a way that makes sense. In part, there is no way to say "if v3 transport, then .., otherwise if not v3 transport then do...". Beyond that, does it really make sense for "V5" rules to be using a bunch of attributes that reference V3?

To bring it back, this issue is only open still because:

Cernelius commented 4 years ago

To bring it back, this issue is only open still because:

  • no code changes have been made
  • we're looking for a generic solution that could apply to land transports, or perhaps maybe non-transports that would logically follow this same special rule.

Ok, thanks for the answer.


So, let's say, starting from the program condition as I know it in 1.9.0.0, assuming no relevant changes at all already made, I suggest the following changes, for a minimalist approach, that should be enough to (finally!) close this issue:

If a unit is:

isSea=true

AND

transportCapacity=ANYTHING (see below for the meaning)

AND

isCombatTransport=false (or absent)

While the following property:

Transport Casualties Restricted=true

Then (and only then) that unit can retreat immediately before and instead of stalemating, any time it is against enemy defending units that cannot hit it (either because they are all defence 0 or all rolls 0 or there are supports bringing them down to strength or rolls 0 or for whatever other reasons, like "canNotTarget" or "canNotBeTargetedBy").

ANYTHING Means that it can have whatever value, comprising 0 (if having 0, it means it is a transport too, but only able to transport an infinite quantity of units taking no space on the transport). To be clear, a unit that completely lacks the transportCapacity option in its attachment is not a transport, while a unit having transportCapacity equal to 0 is FULLY a transport, albeit with a capacity equal to 0.


Btw, I'm not saying I like this rule or the way things are coded, but probably is better first to completely finish off this matter for all that pertains to the "official" rules, closing this issue, then start discussing, maybe initially in the feature request section of the mapmakers forum, about what is arguably better for expanding the behaviour taking into account all the "custom" cases, like conscripts against trenches (that I don't think they really make sense as they currently work).

Cernelius commented 4 years ago

Optionally, instead of directly testing "Transport Casualties Restricted" being true, you can also add another property specifically for this matter, then having the property "Transport Casualties Restricted" setting that property true if true. This is less minimalist, but I think it would be better (I really don't like packing behaviours on same options that are themselves describing something else). Of course, even better would be that other property being completely independend, but, then, you would need finding and updating all games supposed to have transports working by v3 rules.

Sadly, TripleA currently lacks a single property for generally turning the game to "V3" rules, and that's really a bad thing, but likely out of the scope of this issue, thus it would be inconsistent to link anything directly to the, currently next to useless, WW2V3 property already available.

DanVanAtta commented 4 years ago

Btw, I'm not saying I like this rule or the way things are coded, but probably is better first to completely finish off this matter for all that pertains to the "official" rules, closing this issue, then start discussing, maybe initially in the feature request section of the mapmakers forum, about what is arguably better for expanding the behaviour taking into account all the "custom" cases, like conscripts against trenches (that I don't think they really make sense as they currently work).

Optionally, instead of directly testing "Transport Casualties Restricted" being true, you can also add another property specifically for this matter,

I think the 'non-combat attacker' concept solves this cleanly. We do not have to test other properties, and the value itself is potentially not even a boolean. Not all properties need be boolean. That approach would generally avoid packing behaviors onto existing attributes, would avoid having to update existing maps (necessary), and would enable this rule to be cleanly implemented.

Sadly, TripleA currently lacks a single property for generally turning the game to "V3" rules, and that's really a bad thing, but likely out of the scope of this issue, thus it would be inconsistent to link anything directly to the, currently next to useless, WW2V3 property already available.

Yeah, I hope that one day that will be fixed. I'd like to see one day rule variants turned-on/off just as dice and LL are turned on and off.

The talk of v3 is pertinent as we need to account for transports that are pre-v3 and those that are after.

Cernelius commented 4 years ago

Also, personally, I think this rule is rather dependent the most to the v1 and v3 rule that you can never send transports alone in attack. That, in my personal opinion, has nothing to do with being able to transport other units, but it is to be generally intended as not sending offenceless alone in attack (thus, for example, conscripts too).

If you take the retreat before stalemate rule for transports alone without taking the no attack rule for transports alone, then you can send transports against transports to attack and, then, strafe, instead of stalemating.

Which should be something you can currently actually do, after implementing only the rule at this issue, since TripleA is completely missing enforcing the rule of being generally unable to send transports alone in attack.

Sorry for the, maybe, off topic, but just trying to make clear that my suggestion of binding this to the Transport Casualties Restricted property is not because I think this makes totally sense, but merely due to the fact that I don't believe there is, currently, anything better than that, assuming we don't want go changing all game xml of all v3 games.

panther2 commented 4 years ago

@DanVanAtta

I'm going to take another stab at being clear about this suggestion:

  • Why should retreat rules be different for carriers attacking at zero vs transports attacking at zero? Perhaps the answer should be based on "non-combat" and "combat" units where "combat" units have a non-zero HP (can be used as fodder).

Because the retreat rules (from the rulebooks) are totallly unrelated to the attack value of any unit or any of those related thoughts.

The retreat rule is as simple as this:

Again, I am just talking from the rules systematics perspective. From this perspective the Carrier must be treated different from Transports. I don't want to block any wider scope that you might want to achieve with my statements. Just another information.

Cernelius commented 4 years ago

Also, let's be clear stopping this thing of v3 transports having no or 0 HP. V3 transports have 1 HP each (unless you make a mod in which they have 2 or more each (which you can)), and, therefore, you can assign them 1 damage each, just, per rules, only after all other units have been taken as casualties or removed, as long as regular attacks go.

This is important also since you can have a mod in which, for example, submarines make AA attacks against V3 Rules transports, also possibly on fly-over (when a transport moves through a zone occupied by submarines with a fly-over attack against transports).

ron-murhammer commented 4 years ago

@DanVanAtta @panther2 @Cernelius Alright, so I'd like to come to an agreement on this so I'll lay out what I'm thinking of moving forward with.

Goals

Proposed 0v0 Stalemate Rules (checked in this order)

  1. v3+ transports: If all remaining units on both sides are v3+ transports then allow option to retreat or stay
  2. Regular sea battles: If sea zone then units stay (no option to retreat, this covers the global carrier v transport)
  3. Regular land battles: If land territory then units can retreat or stay (I might decide to force retreat as long as battles have unlimited rounds since generally you shouldn't have contested land territories in those type of maps)

Out of Scope But Possible Future Feature Requests (generally want to avoid further discussion around these right now)

Cernelius commented 4 years ago

@ron-murhammer So, are you sure we are talking about 0vs0 in general here now?...

If so, I suggest updating the title of this issue (as I said, I think such a general and highly opinable discussion would be better held in forum).


  1. Regular sea battles: If sea zone then units stay (no option to retreat, this covers the global carrier v transport)
  2. Regular land battles: If land territory then units can retreat or stay (I might decide to force retreat as long as battles have unlimited rounds since generally you shouldn't have contested land territories in those type of maps)

I'm definitely against treating land and sea differently just because they are land or sea (and same thing for the inability to attack: if offenceless cannot attack alone on sea, then they cannot attack alone on land, as well). Also don't forget that both land and sea zones can be territories.

With this said, I think we have 2 different rulesets, instead.


V2 and before

Under these rules, there is no stalemate, thus when you have 0 vs 0 what happens is that the battle keeps going on, nobody hitting each other, hence, only the following tweaks are advisable:


V3 and later

Under these rules, it is very clear that it is an absolutely general principle the fact that any time you are in a situation where nothing can hit anything, the battle immediately ends, so this should be applied in all cases, regardless of being on land or sea, hence:

Now, it is left to decide what happens to land and sea territories, alike, when you have a stalemate against defenceless.

What I believe it should happen is that the territory should be conquered, as, if the defending units are powerless against you, then they are also powerless in avoiding you conquering the territory. This is also consistent the most with the fact that a 0 vs 0 situation allows my transports to offload units into a land territory, those units possibly conquering that territory.

Example: In a mod of WWII Global 2nd Edition with convoy zones (sea territories) added, only carriers remain in an enemy convoy zone against only transports What should happen: The battle immediately ends and the carriers conquer the convoy zone (if they are able to do so in a zone without enemy units).

Example: In Domination 1914 NML, since the game is supposed to be v3 rules based, some attacking conscripts only remains in an enemy territory against trenches only. What should happen: The battle immediately ends and the conscripts conquer the territory.


Off topic: Also in all v1 and v3+ rules games offenceless should be unable to attack alone (for example, conscripts cannot attack alone unless it is a v2 rules game), but there should be a property for it, so that you can have a v1 or v3 game and allowing offenceless attacks or have a v2 game and disallowing offenceless attacks.


I would be also fine with generally applying the v3 case to v2 and before too. After all, the concept of having an infinite battle with nobody rolling anything is silly, so I think the concept of ending the battle as soon as nobody can hit anybody can be generalized to all rulesets (of course, both for land and sea alike).

Cernelius commented 4 years ago

Though, sorry for the off topic, but it's really very related, I believe the fact that offenceless cannot attack alone is a general V1 and V3+ principle, since in Global (thus V3-ish) both carriers alone or transports alone (or both alone) cannot do it, while in V1 transports cannot do it and they are 100% combat units, otherwise. This is a huge matter for the 0 vs 0 stalemate, because it greatly restricts its application in the moment it can happen only if you happen to end in that situation, but cannot deliberately start the conduct combat phase in any situation in which you have 0 offence (and for games like D1914NML we are talking about almost 100% of situations, as you would never take concripts after other units, in attack, thus ending with 0 vs 0 after starting a battle in which you have positive offence).

@panther2 Can you con firm that in Global carriers cannot be sent alone to attack, for example to make 1 combat round and retreat (just like transports cannot too)?

I believe that, in any cases, attacks using only units with no attack value are illegal, for v1 and v3/4/5/1940 correct?

Hence, would you agree that if I take V3 or Global and change the attack value of infantry to 0, then it would be consistent the most that infantry cannot attack alone, under the rules and clarifications?

Cernelius commented 4 years ago

On the other hand, instead, if it is preferred that conscripts alone against trenches alone stay in the territory without conquering it (like it happens now), then conscripts alone should be unable to conquer completely empty territories, as well (and, preferably, unable to be sent alone into empty enemy territories, in the first place).

What I'm mostly saying is that both should go the same way, but I would personally prefer allowing conscripts conquering empty territories, as well as territories with only trenches (not bunkers) inside.

ron-murhammer commented 4 years ago

@Cernelius Please try to keep the discussion concise and just focused on 0v0 stalemate for now. Let's create a separate issue or forum thread for anything outside of that.

Now, I see your point about trying to keep sea and land behavior consistent but the problem with that is that on land, enemy units generally don't end up in the same territory while in sea territories they do. This is just a fact of how land and sea combat/movement/production work differently. I also wish A&A instead just always offered retreat when 0v0 stalemated but unfortunately it didn't go that direction for sea units (IMO 0 attack carriers should have been allowed to retreat and Larry or whoever made a poor decision or oversight there as allowing a transport to but not a carrier seems unintuitive).

I also really don't want 0 attack units to conquer territories when 0v0 stalemated as that starts to be inconsistent with having limited combat rounds. Essentially if a stalemate or running out of battle rounds, the defender kind of "wins" and holds the territory.

I also don't want different rules for v2- vs v3+, if we can avoid it. I'd rather just focus on v3+ transports being a unique type of unit.

So given those parameters, I still think the 3 rules I laid out are the best option even if it isn't perfect. It also addressed NML in a somewhat logical way which is the only non-A&A map that I know of that has 0v0 stalemate with non-transport units.

Cernelius commented 4 years ago

In my opinion, a main problem of this issue (as well as many others) is people trying to be concise. When you don't talk enough of something, what happens is that the other side has only an insufficient part of the picture, then it keeps going back and forth, and becomes much longer than being comprehensive in the first place.

I really don't get why talking of something that easily becomes next to irrelevant next to something else that is missing and being ignored. What is the point of talking of stalemate of conscripts alone in the moment one is ignoring that they cannot be sent alone in battle in the first place, thus, the condition you are talking about would virtually never actually happen?

Anyways, since you seem convinced that this one is the right way to go:

  1. Regular sea battles: If sea zone then units stay (no option to retreat, this covers the global carrier v transport)
  2. Regular land battles: If land territory then units can retreat or stay (I might decide to force retreat as long as battles have unlimited rounds since generally you shouldn't have contested land territories in those type of maps)

Here it is why I believe it is not.

You are creating a difference only based on land and sea that is based on nothing or just tendencies. Then gamers have that if they are 0 vs 0 on land they can choose to retreat and if they are 0 vs 0 on sea they cannot choose to retreat. You are arguing that it happens to have enemy units mixed in same sea zones but not in land territories, but this is beside the point because you are still allowing them stalemating if they want. That would have a reason to be (but I would still be against, unless optional) if your proposal would have been to outright remove the stalemate option on land (as my V1/2 case actually does), but your proposal is not doing that, just add an optional retreat ability you don't have on sea, so you are not actually impeding mixing enemy units on land.

Then, the next item is: why is that on sea you mix up, while on land you don't, or less often? As you said:

Now, I see your point about trying to keep sea and land behavior consistent but the problem with that is that on land, enemy units generally don't end up in the same territory while in sea territories they do. This is just a fact of how land and sea combat/movement/production work differently.

To be clearer, beside politics (that also allows mixing in both land and sea), the reasons are placement in hostile sea zones, submersible units and ignorable units. All these things are so much unrelated to the topic that I don't think anything coming out of such unrelated matters should influence how stalemate should work. If completely unrelated things have a tendency to cause mixing of enemy units on sea more frequently than they do on land, it doesn't follow that stalemate should do the same, if I'm understanding correctly your point, here.

So, I reiterate that my solution is, instead, in my opinion, the best option, thus I advice you go that way and, if preferred, just applying the v3+ case generally (that is, retroactively).

I also really don't want 0 attack units to conquer territories when 0v0 stalemated as that starts to be inconsistent with having limited combat rounds.

I definitely believe there is no inconsistency. If you stalemate because you run out of time, you haven't finished the job, and enemy units are still impeding you from taking the territory. The battle is not really over, just it is still going on, waiting to be retaken on the following turn. If you stalemate because you still have time but nobody can hit anybody, then you cannot be stopped from taking the convoy zone or the land territory, if you can do it when completely empty, with these same units, just like stalemating transports cannot be stopped from offloading their units.

DanVanAtta commented 4 years ago

I also really don't want 0 attack units to conquer territories when 0v0 stalemated as that starts to be inconsistent with having limited combat rounds.

Agree with @Cernelius analysis. FWIW, the code path that checks for a 0v0 battle is independent (IIRC) of the battle round expiration situation. The rule for this special checkmate does not need to be evaluated at all in the case of round expiry.

ron-murhammer commented 4 years ago

@Cernelius I would like to actually force land units to retreat as mentioned but I can't guarantee without thinking through all scenarios and looking at the code that it will be easy to do (if something like politics change causes it then they might not have a retreat path). Generally, I would have NML manually enforce having to retreat on land which isn't ideal but a step in the right direction if I can't achieve forcing them.

While bringing up related items I think is good, at this point, I've decided I'm not going to address making a change to 0 units not being able to attack alone and even if I did we'd still need a default behavior in case a battle started not 0v0 but ended up that way like the Global examples based on casualties.

In just about any game I can think of, all stalemate type situations are considered that the defender wins. That's just the natural and intuitive behavior. So I can't really see any reason to have 0 attackers win over 0 defenders.

DanVanAtta commented 4 years ago

I strongly recommend this:

We may need to tweak that list so we do not change any existing behavior and ensure that the right transports get the right retreat option.

Once we have the term defined, and the critiera locked down, then the code only needs to check if all attacking units have this "property" and if so the engine offers retreat and ends combat. Otherwise, the code falls into existing behavior and if all units are zero vs zero then combat is ended in a stalemate.

Note that having this computed property does not change whether units can attack or if they can capture territory, we would design it to target pretty much just this situation. The conversation then moves to how do we properly narrow the criteria to not change any existing rules except this special transport vs transport situation.

I think this is a good move as:

Cernelius commented 4 years ago

@Cernelius I would like to actually force land units to retreat as mentioned but I can't guarantee without thinking through all scenarios and looking at the code that it will be easy to do (if something like politics change causes it then they might not have a retreat path).

Beside politics, a more common cause of no retreat path is offloading. That is why in my v1/2 case, in which stalemate would never happen, the rule would be that all attackers are removed if they cannot retreat, as I wrote.


Look, I agree with you on the fact that it is needed to differentiate between two cases, one causing stalemate just like carriers and the other one never causing stalemate, but it should not be done by checking if we are on land or on sea, in my opinion.

I also want to bring attention to the fact that, like it or not, default TripleA is v1, and in Classic II Edition you can never stalemate in land and sea alike (submersible and hostile sea zone placement are yet to come as default).

If really wanted, then have two properties, regulating stalemate or not for land and sea, respectively, letting the mapmakers set it for one and the other (I guess you will set yes stalemate in sea and no stalemate in land for D1914NML), but the default behaviour should be the same for both, because there are no clear reasons why it should not.

Cernelius commented 4 years ago

I strongly recommend this: we create a term to define this behavior where a unit is given an option to retreat on stalemate. on the backend we compute this value and decide what criteria need to be used. I'd suggest that be: unit has zero attack power unit must be chosen last for casualties unit cannot initiate a combat unescorted We may need to tweak that list so we do not change any existing behavior and ensure that the right transports get the right retreat option. Once we have the term defined, and the critiera locked down, then the code only needs to check if all attacking units have this "property" and if so the engine offers retreat and ends combat. Otherwise, the code falls into existing behavior and if all units are zero vs zero then combat is ended in a stalemate.

You mean adding a unit option for having the retreat on stalemate ability and, under the listed condition, that option would be true for the units meeting all conditions, if not specified in the unit attachment themselves (basically to avoid having to update all v3 maps to add this unit option to the transports)?

DanVanAtta commented 4 years ago

@Cernelius correct, that is a good summary :smile:

ron-murhammer commented 4 years ago

@Cernelius Well, it seems our core difference in opinion is having sea and land battles act differently and I think that can be argued either way.

The best alternative I can think of to my original proposal to address that is instead consider the default for 0v0 stalemate to allow retreat and consider global carriers the exception by having a XML unit option for them (which I was generally trying to avoid creating XML properties/options at this time to keep what is a pretty rarely occurring situation simple). This is essentially just making global carriers a special case. So here is an alternative proposal:

2nd Proposed 0v0 Stalemate Rules (checked in this order)

  1. Can't retreat unit option: If any remaining attackers have new unit option canNotRetreatDuringZeroPowerStalemate set to true then units stay (no options to retreat, this would be set for global carriers)
  2. Default: Units can retreat or stay (I might decide to force retreat for land battles as long as battles have unlimited rounds since generally you shouldn't have contested land territories in those type of maps but open to thoughts here)

@DanVanAtta I was trying to avoid adding XML properties/options given the rarity and minimal impact of this situation but if we are going to go that direction, I've added my alternative proposal above.

DanVanAtta commented 4 years ago

given the rarity and minimal impact

While maybe not common, and not always that impactful; not presenting proper rules is significant. I think mostly because most players would not know that they are entitled to an 'edit' to correct this, they probably just would not have known about it. IMO that makes the impact larger as the incorrect rules is likely to not be noticed and hence unlikely to be remedied if needed.

DanVanAtta commented 4 years ago

FWIW, to help clarify the conversation, here's a decision tree that I think should apply:

decision-tree-retreat

Cernelius commented 4 years ago

Since by rules the transports are the exception and the carrier the norm, I suggest not making confusion by going the other way round.

Cernelius commented 4 years ago

@DanVanAtta What I'm understanding from the conversation is that in your graph at the question "All all attackers non-offensive?" you would answer yes if they are all v3 transports and no if there are any Global carriers. I don't think that is a good way to describe it, as Global carriers are definitely considered non offensive (lacking an offence value), by the rulebook.

Basically, we need to isolate what makes the transport special, so that they can retreat instead of stalemate, while whatever other units having attack 0 cannot, but this cannot be "being non offensive".

Cernelius commented 4 years ago

Well, anyways, I stand with my concept that, especially if not having a way to customize it per unit (deciding what units can retreat on stalemate and what not), you should have two generally applying behaviour, the same for land and sea.

1- The first behaviour assures never to stalemate, by forcing retreat, if possible, or removing all attackers, if they cannot retreat.

2- The second behaviour always stalemate without any retreat allowed.

Then, on top of that, I would add an exception to allow the option to retreat instead of stalemating, for the second case (in v3 applying to transports only).

It is fine if in some game you want to have 1 for land and 2 for sea, but it should be customized in that particular game only. Default should be the same for both macrospaces.

DanVanAtta commented 4 years ago

A 'non-offensive' combat unit is for us to define, or would you have a direct rule book reference that uses that exact term already and defines it?

Are you implying that 'zero attack' means non-offensive? I am not. 'non-offensive' I'm considering to be anything that meets the three criteria outlined earlier (which does not include a 'zero attack' power). For example, there could be units literally called 'fodder', even though they have no attack value they are useful offensive units.

Cernelius commented 4 years ago

Zero attack surely means non offensive in the "official" rulebooks, as such units are often referred as having no offence value.

DanVanAtta commented 4 years ago

Can you quote the rulebook on that one @Cernelius ? I disagree with the 'surely' and I'm in part saying, "we are defining this term to mean X". If you really don't like the term, replace it with any other word that suits your mental model, it does not change the decision tree or the criteria at any point, it is just semantics.

ron-murhammer commented 4 years ago

@Cernelius That doesn't really make sense as v3 transports are the most common case by far. I think you are taking the way the A&A rules are written too literally. If you consider before Global was released, all 0v0 battles would have provided the option to stay or retreat (as transport was the only case). Now Global has come around and decided to have different behavior for carriers.

Cernelius commented 4 years ago

@ron-murhammer Nope. That is given by the fact that you have the carrier stalemate behaviour based on the rules, while for the transport retreat before stalemate behaviour you need adding a rule. Hence that is the exception, as if you take out that rule, then transports stalemate like whatever units having offence 0.

DanVanAtta commented 4 years ago

I'm tempted to now withdraw from this conversation. I'll clarify/discuss the decision tree, but otherwise I don't know if I have anything more to add. I think what I've proposed is something that:

Cernelius commented 4 years ago

I'm not against @DanVanAtta solution, while I'm against @ron-murhammer solution, for what is worth.

ron-murhammer commented 4 years ago

@Cernelius You can rewrite the rules to say instead: "if both sides have only units with 0 attack/defense power then offer them retreat or stay but for global carriers they must stay." You end up with the same functionality and its just how it was chosen to be worded.

The point being that really we have 3 scenarios of this today that much be handled by whatever solution:

  1. v3+ transports - can stay or retreat
  2. global carriers - must stay
  3. NML land combat (conscripts v trenches) - should be able to retreat (maybe have the option to stay as well)

I think the 2 proposals I put up are the simplest ways to address these. I don't want to create lots of different XML properties or have to update tons of maps as this is a rare situation and has pretty minimal impact.

Any solution we do here should ideally meet these criteria:

  1. Not add any more than 1 XML property or unit option (ideally we add 0)
  2. Address the 3 situations above properly
  3. Create sensible defaults for maps moving forward
  4. Not require updating tons of maps
Cernelius commented 4 years ago

I don't think so. In order to do that, you should give the option to retreat in whatever case you are left with no eligible targets, not only because of all units having 0 and 0. That is when the battle ends, thus you cannot retreat anymore. @panther2 to confirm, in case.

Cernelius commented 4 years ago

D1914NML is a custom game, so it is just your opinion that conscripts alone vs trenches alone should be able to retreat. Maybe the best translation of the rule would actually be that conscripts alone should not be allowed to even move into empty enemy territories, then nobody would be taking conscripts last as casualties, just to create the 0 vs 0 condition.

In my opinion, as I said multiple times by now, conscripts vs trenches alone should immediately end combat and the territory being conquered, if conscripts alone can take undefended territories.

I know I said in forum they should be obliged to retreat or die, but there I was thinking at old games, while the v3 rule I think it's clear enough on the stalemate.

And, anyways, I always pointed out that conscripts alone should not be able to attack.

My suggestion, at this point, let's go with what @DanVanAtta is proposing (if I understand it correctly). It seems the best way to at least close this issue that nobody else will probably ever go through reading, so it's basically locked.

ron-murhammer commented 4 years ago

@Cernelius Correct but given I'm the one currently maintaining it and that the general consensus of NML players that I've seen is that it should allow retreat (and possibly force retreat) means I'd like to move forward with fixing that. It doesn't seem that most NML players agree with your opinion on not allowing conscripts to alone capture undefended territories or not allowing them to attack alone. If you show they do then I'm open to considering those.

Cernelius commented 4 years ago

It doesn't seem that most NML players agree with your opinion on not allowing conscripts to alone capture undefended territories or not allowing them to attack alone. If you show they do then I'm open to considering those.

  1. This is just because TripleA never enforced the rule that offenceless cannot attack, so people just play by what the program gives, and gets accustomed to it.

  2. Personal preferences on a specific game should determine the options set in the XML of that game, and nowhere else.

DanVanAtta commented 4 years ago

@ron-murhammer , not sure I'm a fan of making 0vs0 generalized except in the case of global carriers. That strikes me as complex, potentially changes existing maps to fit rules that would conveniently fit NML, and I'm not sure if that route is open to creating a way to easily turn on and off the behavior going forward with a potential new attribute.

For example consider a hypothetical where we want a new unit, that does not transport, that is a 0 attack value, that we would want to behave like transports in terms of retreat and casualty rules. It seems appending to the 0vs0 logic does not necessarily get us there. We can also have the inverse where we want that unit to behave like a global carrier perhaps, in which case we might be stuck.

In the end I think the 0vs0 is actually just the wrong specification for this specific rule. It does not matter that the offensive power is 0, what matters is that we have transports. I suspect the coding is actually kinda hacky/buggy, under-abstracted (inappropriately modeled) - as if we are using a correlated value instead of creating a concept around the behavior we are describing. It's complex as 'non-offensive' so far has been defined as being partly a zero attack value, but that is more for the sake of backward compatibility and does not mean in the future map makers couldn't create such a unit that can't stay in a battle but does have an attack value.

ron-murhammer commented 4 years ago

@DanVanAtta Both of those are achievable with my 2nd proposal. The new 0 attack sea unit that can't transport would by default be able to retreat or stay if it ends in a 0v0 stalemate. If you want a unit like the global carrier then you set the new unit property just like global carriers will have.

@Cernelius I agree but isn't that kind of the point. People play by the rules or how the engine enforces/allows and generally get used to that unless they are particularly bad then people ask to change them or complain. In this case, most folks are fine with the NML behavior except they don't like that the 0v0 stalemate doesn't allow retreat (not sure what players think about the Global 0v0 rules but we don't really have the option to change those since its a standard A&A map). Are those the best rules, who knows but to some extent that is personal opinion. The map maker ultimately designs the map and determines the rules.

DanVanAtta commented 4 years ago

@ron-murhammer unfortunately I don't think that covers the case where such a potential unit does have a non-zero attack power. For example say something like "supporting artillery barrage", fires as long as there are existing supporting ground troops (eg: marine ghost spotter + stealth bomber)

There is a degree of equivalency for sure, as demonstrated a bit in the decision tree, I'm suggesting we check for special retreat rule before and independent of attack power (if the attribute is also defined in terms of attack power, that is transparent at least to this level of decision making, which is part of the point).

In essence I think this is essentially the difference between the proposals:

let 0v0 = defenders.allMatch(noDefensePower) && attackers.allMatch(noOffensePower)

if( 0vs0 ) {
  if(attackers.noneMatch(canNotRetreatDuringZeroPowerStalemate)) {
    offerRetreat
  }
  endBattle
}

// vs

if(attackers.allMatch(nonOffensive) && defenders.allMatch(noDefensePower)) {
  offerRetreat
  endBattle
} else if( 0vs0) {
  endBattle
}