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.32k stars 392 forks source link

2.7 Crash with an Air Battle #12770

Closed TheDog-GH closed 1 month ago

TheDog-GH commented 1 month ago

TripleA-2.7.14814 Map 1941 Global Command Decision v175 (new) Saved Game crash.zip triplea.log

Click on Air Battle in Rostov

This will produce the crash.

@asvitkine one for you?

DanVanAtta commented 1 month ago

PR with a mitigation is up. That update does resolve this crash.

Though, it's probably not the best of fixes. @asvitkine - I think you might have some more context into the code. I'm very unclear what "killed" vs "old" units represent. The PR I submitted just updates the data structures to be Sets. The underlying problem is we have a duplicate add of a unit -there is only 1 german inf in Rostov, that unit is added twice which leads to the non-unique key error later.

A fix for why the duplicate is added in the first place would likely be much better.

TheDog-GH commented 1 month ago

@DanVanAtta @asvitkine Although it does not crash, the lone German Infantry does not fight in the land battle.

image

DanVanAtta commented 1 month ago

Hmm, that is certainly more serious. The infantry is being selected as a "killed unit", which seems incorrect. The patch I applied really was just covering over a deeper problem.

@TheDog-GH any idea when this problem might have started?

@asvitkine - if you could look into this one - would be really hefpful!

TheDog-GH commented 1 month ago

any idea when this problem might have started? No, in my testing I have never just attacked with one infantry and both AI would never attack like this.

I think a lot of the problems/issues come from me bending TripleA by using <option name="canNotTarget" value="$All-Air$"/>

This stops 3 and 4 attack armour from using their main attack on air, so must use their 1/12 AA values to target air. The above is just a calculated guess, so could be be way off.

frigoref commented 1 month ago

@TheDog-GH Is the above linked crash.zip the zipped save game you are referring to in your comment of PR 12783? That would be a crucial information for me. I have just found this issue 12770 (2.7 Crash with an Air Battle) and loaded the mentioned save game. After pressing Air Battle in Rostov the battle start. Could you explain what exactly this issue is about, meaning how is triplea behaving vs. how it should? Maybe I am missing something as @DanVanAtta seems to understand better what the issue is about, but it would make sense to have a proper documentation here - not just for potential helpers to pick the issue and try to solve it.

TheDog-GH commented 1 month ago

Yes, that is part of my findings. I have copied it here, just to try to keep it in one place. @frigoref The Germany Infantry does not appear in the Battle, it has disappeared, also it is not listed as a casualty.

image

frigoref commented 1 month ago

K, we are getting closer, but we are still not quite there yet. @TheDog-GH Please provide me a step-by-step guide on how to reach your screenshot. Let me try to show you what I mean by starting with the steps I assume should be done first:

  1. Start triplea (->triplea UI starts)
  2. Press button Saved Game (->popup opens)
  3. Select file crash.tsvg (zipped in crash.zip) and press button Open (-> popup closes; triplea UI is shown again)
  4. Press button Play (->game starts, i.e., map is building up)
  5. ?

Note that I can neither see a "Battle in Rostov" in the history panel nor can I start such a battle by clicking in Panel Actions on button Battle in Rostov... (leads to error popup with message "Must finish Air Battle in Rostov first").

I might seem a bit too much if you are not familiar with raising technical support tickets, but the increased effort is definitely going to pay off.

TheDog-GH commented 1 month ago

@frigoref

5 You should see this

image

Select Air Battle in Rostov Do the Battle, note the Air-Transport should be should with 0 Atk Select Battle in Rostov Do the Battle, note the lack of Inf-Trained

6 As mentioned before do this

Game> Show History image

You will then see this on the left (press the + to expand the 'folder' image

frigoref commented 1 month ago

With some assistance from @DanVanAtta I was able to track down that the issue resides in the save game (crash.zip) itself, meaning that the Air Battle in Rostov is saved in a way that variable attackingWaitingToDie already contains the unit Air-Transport (GER). This is most likely not correct, therefore, the save game is corrupted. We would need to reproduce the creation of this Air Battle to analyze how/why the variable gets filled with the unit even though other units Bomber-Tac (GER) are present. In order to do so I have used the game history to get a save game of an early step (Combat Move GER): crash_R3_GER_Combat_Move_Rostov.zip I also checked the history for the order of the moves were performed (or at least recorded): image

So for me the step-by-step guide looks as follows:

  1. Start triplea (->triplea UI starts)
  2. Press button Saved Game (->popup opens)
  3. Select file crash_R3_GER_Combat_Move_Rostov.tsvg (zipped in crash_R3_GER_Combat_Move_Rostov.zip) and press button Open (-> popup closes; triplea UI is shown again)
  4. Press button Play (->game starts, i.e., map is building up)
  5. Go to territory Bryansk and select 3 Bomber-Tac (GER) and move them to territory Rostov
  6. In popup "Bomb?" press button Attack
  7. Go to territory Bryansk and select 1 Air-Transport (GER)
  8. In popup "What transport do you want to load" set the Air-Transport (GER)-counter to 1 and press button OK
  9. In popup "What units do you want to load" set the Inf-Trained (GER)-counter to 1 and press button OK
  10. Click on territory Rostov to move them
  11. Go to territory Bryansk and select 4 Bomber (GER) and move them to territory Rostov
  12. In popup "Bomb?" press button Attack
  13. In tab Actions press button Done
  14. In popup "Attack?" press button No
  15. In tab Actions press button Air Battle in Rostov...
  16. In popup "Germany attack USSR in Rostov" confirm with space button

I also took a save game after step 14, reloaded it and tried step 15 again. Also here I did not "loose" the Air-Transport (GER) or the loaded Inf-Trained (GER).

@TheDog-GH So far I was not able to recreate the issue, so I would ask you to give it a try and provide an updated step-by-step guide once you are able to reproduce the issue. Note that after the recreation a save game would not help in our analysis as the root cause seems to lie in the building of the Air Battle.

As the issue might be already resolved, it is perfectly possible that you are not able to recreate the issue 12770. If so, we can just close it.

TheDog-GH commented 1 month ago

Thanks for your perseverance/time, I did not create the zip file, it was by a player who changes and edits the 1941 GCD map, so I am unlikely to reproduce it.

The changes that you made to get to this point appear to produce more warning messages than usual when I run my AI v AI testing, normally I get 0-1 warnings. Do you want to remove the code or shall I post the warning messages? Last two times was 5 and 6 warnings?

frigoref commented 1 month ago

@TheDog-GH I am not aware that I did any changes "to get to this point". Can you link the changes you are referring to and why to you think they "get to this point" (assuming to mean the corrupted save file)? Due to the unclear change, I cannot remove any code and would not know what "warning messages" you would want to post and where you would want to post them. As I do not know which warnings you are referring to I have also no clue how many there were. Please be more precise in your communication and if it helps you, consider that the reader does not know anything about where you are, what you were doing, what you want to do or what you would like to get improved.

TheDog-GH commented 1 month ago

From my point of view you have been working on this issue and Dan working on lobby issues.

I am on todays latest TripleA-2.7.14834, some very recent code has changed the way my AI v AI testing works and I get more warning errors than normal, the ones that say if this persists raise it on GitHub.

As I have not posted the very recent warning issues I cannot be more precise.

So I will now post them as they occur, if that's OK?

frigoref commented 1 month ago

@TheDog-GH Yes, if you have found some issues or unexpected things, please post them with all the information available to you.

frigoref commented 1 month ago

@TheDog-GH If you cannot recreate the issue either and do not know who can, I think we should close it as there is nothing more we can do.

TheDog-GH commented 1 month ago

I cannot recreate it. So I will close it, again thanks for looking at it.

DanVanAtta commented 1 month ago

@TheDog-GH FWIW - the log file should have full error details for those warnings.