Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Sleet01
Copy link
Collaborator

@Sleet01 Sleet01 commented Jul 22, 2024

Our current ground map pathing code for Aerospace units is fairly simplistic, and in the situation where turns are free (because ASFs on airless / trace atmosphere maps use Spheroid movement) will enter an infinite regress while trying to determine all possible valid moves.

The fix is to restrict Aerospace pathing to 1/2 default Java stack size; there's really no need to even go this far for every possible turn-move-turn combo, because (IIRC) the maximum hover path length on the ground map is 8 hexes, but I wanted to be circumspect.

In my testing I found that reducing the max pathing depth to 256 moves was actually quite fast, so we may wish to consider this in the future.
Note that Princess is actually not very good with Spheroid movement on ground maps but at least this will prevent the StackOverflow error.

Testing:

  • Tested with previously-failing Airless ground map and a variety of enemy and friendly units.
  • Ran all 3 projects' unit tests

Close #3595

@Sleet01 Sleet01 requested a review from HammerGS July 22, 2024 16:57
@Sleet01
Copy link
Collaborator Author

Sleet01 commented Jul 22, 2024

On second thought, let's start with 1/4th of the stack size; the speedup seems worth it, and if we run into any issues we can roll back to 1/2.

@codecov
Copy link

codecov bot commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.07%. Comparing base (fc2bc92) to head (91c8ae9).
Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5771      +/-   ##
============================================
- Coverage     29.07%   29.07%   -0.01%     
+ Complexity    13910    13909       -1     
============================================
  Files          2507     2507              
  Lines        266309   266312       +3     
  Branches      47598    47599       +1     
============================================
- Hits          77422    77421       -1     
- Misses       184968   184971       +3     
- Partials       3919     3920       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gsparks3
Copy link
Collaborator

You are correct on the maximum path length.

Spheroid units may move into any ground hex within eight hexes of their current position at a cost of 1 MP. [sic]

TW, page 92. I assume the "1 MP" is supposed to be "1 Thrust".

Copy link
Member

@HammerGS HammerGS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and seems to work .

@IllianiBird IllianiBird merged commit 3141e08 into MegaMek:master Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Princess freezes on Movement Phase with Vacumm Atmosphere. (java.lang.StackOverflowError)

4 participants