-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sub combat rules wrong #1645
Comments
@simon33-2 While I have some free cycles, I'd like to at least start putting together acceptance tests for the scenarios you described above. I'm not quite sure where to begin, so I thought I'd look for some existing tests that verify battle step order. I found some tests in Is any one of these tests a good place to start writing the acceptance tests for this issue? |
I would guess so. If you commit & push, I can download it and have a look so long as you tell me the branch name. You should also be aware that there are maps like classic which don't have destroyers and handle air vs subs differently. Normally, the sub can retreat after the first shot even though it's defending. AFAIA, these rules work fine at present. However, 1940 maps, v5, probably v3 & v4 all don't work. Not sure about revised or Triple-A only games like Big World. Hopefully we won't need a property. |
@simon33-2 I have a few more questions. To make things simpler, I'm going to focus on your first use case (attacker without destroyer; defender with destroyer). I'm trying to match these steps up to those documented in
Is there an explicit step corresponding to "defender chooses air casualties"? Or is this really just merged into "defender chooses remaining casualties" now that you've made those two steps consecutive? (That is, in your "current behavior" list of steps, "defender chooses air casualties" would indeed be a "defender Also, do the sub submerge steps ( |
There is no step in the step strings for defender chooses air casualties. That is another bug in the current system. Not exactly an important one though! If the defender has a destroyer but the attacker doesn't, only the defender gets the "SUBS_SUBMERGE" option. SUBMERGE_SUBS_VS_AIR_ONLY is in the wrong place - I wanted to fix that in #1599 IIRC but it does break serialisation, I think. It is dumb to ask if you want to submerge the subs when the next step is to check if it is mandatory. Should be the other way around obviously. So in this use case, I would presume that SUBMERGE_SUB_VS_AIR_ONLY would be dropped wrt the attacker's subs because we already know the defender has a destroyer. SUBMERGE_SUB_VS_AIR_ONLY for the defender should really be the first action, followed by defender submerges subs, then defender subs fire. I'll update the OP to reflect that. |
Sorry about that oversight there. |
The fix for this is nearly certain to break backwards compatibility. How should this be handled looking forwards? Just tell people to use their existing installation for it? |
Something else that I'm not 100% sure about and would appreciate clarification... It looks like I'm trying to figure out what I should actually test. I started off testing the return value of |
Consider the following partial set of steps from the current and proposed battle orders for the case where the defender has a destroyer but the attacker does not have a destroyer (bold entries are differences):
Is the proposed battle order specific to the WW2 global map or is this the way it should be for all maps? Regardless of whether it is specific to a map, it looks like it's going to require some major changes. The I suppose it wouldn't be possible to somehow create a single So if this is going to require coming up with a more flexible alternative to the use of |
Yeah, not the easiest change to make. Your correct on step strings and battle steps ought to be correlated. I don't know why it was written this way but it was. To my knowledge, it should work that way on every map which includes a destroyer as a unit, which means revised onwards. Classic works differently to allow for the lack of a destroyer - subs can retreat after the first round if they have a SZ to go to but air units CAN hit subs. |
Also v2 has been the last edition where Subs can always be hit by air units. |
Thanks for that correction @panther2 . Checking the rules, I'll note that in that edition subs still get a surprise strike only when a destroyer is not present. So in Revised (v2), as you might expect that the air attack/defend steps are never used. So as far as you are aware, subs can never hit air in any edition, right? |
That's correct, @simon33-2 . |
One thing to clarify in the order list:
With the above, the defender knows how many hits they will have to allocate total before they allocate any at all? That may prove to be some effort with the current code setup, I think the flow expects hits/casualty selection to happen in sequence. A first iteration change perhaps could just allow for that, so that selection could happen in proper sequence after a series of attack rolls. It may be some effort to get the UI to be intuitive, we would probably want to keep track and display for the user how many of each type of hit there is to allocate. For the actual phase changes, my recommendation is we first re-work the battle sequencing code to be more functional. If the code resembled something more like a decision engine, where a single component would take state data and tell us which next battle phase to enter, it could make testing much more straight forward and code more modular perhaps. |
That is indeed the problem, @DanVanAtta ! Basically, the Fire needs to be split into two methods - one rolls and one allocates casualties. Did you ever look at the notes for the 1940 games or the list of bugs? Or the rulebook? |
There's another problem in the same area of code. If you do a mixed amphibious/overland assault including planes, if/when all the land units are destroyed, the MustFightBattle code looks for the step string for "retreat planes" but what was added when the step strings were created was "retreat non amphibious units". This causes the console to flash up which is not correct. |
@simon33-2 or @panther2 , could you re-summarize the remaining problems in this issue as individual and new tasks? There is a lot to this thread, it's very hard to grok what has been done, needs to be done, and what exactly is the problem and what the needed fix would be. |
@DanVanAtta In case @simon33-2 does not intend to continue his work he and @ssoloff already put a lot of effort in, I am of course willing to somehow look into it. But I would need to start from the beginning, that means comparing today's TripleA conduct combat logic with those of the rulebooks with all their specific cases. |
Okay @panther2 , thank you for the response. It seems then that either way we need to research and define what needs to be done (which would lead to new tickets). In either case of whether that is done or not, this tracking ticket no longer seems useful nor actionable. |
One additional comment from #1638 @ssoloff , the first issue with the sub combat logic is the #1 remaining issue for users of world_war_ii_global at least. The fix is very likely to break serialisation. Be good if we could get enough of these changes in one go. Have a look in triplea/delegate/MustFightBattle.java
The important point here is that only subs without a countering destroyer can force the person receiving the fire to have to select casualties without knowing how many hits are caused in the remaining round.
In detail, when the defending side has a destroyer and the attacker doesn't, the order is:
Order should be:
And vice versa. I'll spell out the correct order for all four cases to eliminate any confusion. If the attacker has a destroyer and the defender doesn't, then the correct order is:
If both sides have a destroyer, desired order is relatively simple:
If neither side has a destroyer, desired order is:
It's slightly different in a few maps in that subs can be hit by air without a destroyer, so you might need to be mindful of that but you should be able to see it from the existing code.
In case you want to know why there should ever be consecutive boxes for choosing casualties, that is because not all units can hit other units. Subs can never hit air. Air can't hit subs without a destroyer, and allied (different power, same alliance) destroyers only count when defending.
The text was updated successfully, but these errors were encountered: