Skip to content

fix: adds padding in between maps if they are of odd width size, making it possible to tile those. Small performance improvements. #6971

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Scoppio
Copy link
Collaborator

@Scoppio Scoppio commented May 3, 2025

What it does?

Adds padding in between maps if they are of odd size, making it possible to tile odd width boards, a few perf improvements when rendering the board and when making changes in the Select Map Tab.

4 maps 15x15 with 3 column padding in between

image

4 maps 11x11 with 3 column padding in between (before I added pavement to the padding generator)
image

Here we can see in detail the "lerp" functionality added, it averages the height in between both sides.
image

All changes

  • Added option for high performance graphics, which changes the interpolation to nearest neighbor and uses rendering which values speed.
  • Changed the Board#getTags function to stop when it finds the first hex intead of going until the end of the file.
  • Added a map padding generator which averages the hexes between maps and creates a filler to fill the void, it is configurable and is currently set to 1 hex width padding when needed.

What it doesnt do

I does not make possible to rotate maps with odd number of columns, to do that the original board has to recreated with one extra column, it's possible and this makes it easier to do that.

Closes

…possible to tile odd width boards, a few perf improvements
@Copilot Copilot AI review requested due to automatic review settings May 3, 2025 06:08
@Scoppio Scoppio requested a review from a team as a code owner May 3, 2025 06:08
@Scoppio Scoppio self-assigned this May 3, 2025
@Scoppio Scoppio added Performance Severity: Critical Issues described as critical as per the new issue form Map and Board Specific Issues related to a Map, Board or Tileset labels May 3, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances board handling by adding configurable padding between maps when board widths are odd, ensuring proper tiling, and also includes minor performance improvements and UI updates.

  • Removed obsolete rotateBoard lists and updated calls to BoardUtilities.combine to use the new padding approach.
  • Added support for a high performance graphics option with its associated UI elements.
  • Made minor adjustments in Hex grid handling and additional cleanup in deployment and UI dialogs.

Reviewed Changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
TWGameManager.java Removed rotateBoard list usage in board combining.
ServerBoardHelper.java Adjusted combine() call to drop rotateBoard list.
BoardUtilities.java Added new combine() overload with padding support and deprecated legacy methods.
ScenarioV1.java Removed rotateBoard list from board creation.
BoardDeserializer.java Updated combine call to array-based version.
TWBoardTransformer.java Removed rotateBoards return value and refactored accordingly.
Hex.java Replaced stream-based map-to-array conversion with an explicit loop.
Board.java Added early break when “hex” tag is encountered in getTags().
UIUtil.java Updated rendering hints handling with separate paths for high quality and high performance graphics.
ChatLounge.java Minor change to board tag refresh call (with inline comment “is this necessary?”).
BoardView.java Removed redundant blank line before drawing.
GUIPreferences.java Added new HIGH_PERFORMANCE_GRAPHICS setting with corresponding getter/setter.
CommonSettingsDialog.java Added checkbox for high performance graphics with tooltip and updated layout.
BoardEditor.java Updated combine() call to remove unused rotateBoard parameter.
Files not reviewed (1)
  • megamek/i18n/megamek/client/messages.properties: Language not supported

@Scoppio Scoppio force-pushed the fix/maps-connector branch from 65a854a to ce60c26 Compare May 3, 2025 06:14
@Scoppio Scoppio changed the title fix: adds padding in between maps if they are of odd size, making it … fix: adds padding in between maps if they are of odd width size, making it possible to tile those. Small performance improvements. May 3, 2025
Copy link

codecov bot commented May 3, 2025

Codecov Report

Attention: Patch coverage is 0.82645% with 120 lines in your changes missing coverage. Please review.

Project coverage is 30.30%. Comparing base (362ce65) to head (8d0ecce).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...egamek/src/megamek/common/util/BoardUtilities.java 0.00% 91 Missing ⚠️
.../megamek/client/ui/swing/CommonSettingsDialog.java 0.00% 6 Missing ⚠️
...gamek/src/megamek/client/ui/swing/util/UIUtil.java 0.00% 6 Missing ⚠️
megamek/src/megamek/common/Hex.java 0.00% 6 Missing ⚠️
...ek/src/megamek/client/ui/swing/GUIPreferences.java 25.00% 3 Missing ⚠️
megamek/src/megamek/common/Board.java 0.00% 2 Missing ⚠️
...k/common/board/postprocess/TWBoardTransformer.java 0.00% 2 Missing ⚠️
.../src/megamek/client/ui/swing/lobby/ChatLounge.java 0.00% 1 Missing ⚠️
...amek/common/jacksonadapters/BoardDeserializer.java 0.00% 1 Missing ⚠️
...egamek/src/megamek/common/scenario/ScenarioV1.java 0.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6971      +/-   ##
============================================
- Coverage     30.32%   30.30%   -0.02%     
+ Complexity    15837    15823      -14     
============================================
  Files          2888     2888              
  Lines        283253   283348      +95     
  Branches      49328    49363      +35     
============================================
- Hits          85903    85879      -24     
- Misses       191748   191864     +116     
- Partials       5602     5605       +3     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

*/
public static Board combine(int width, int height, int sheetWidth, int sheetHeight,
Board[] boards, List<Boolean> isRotated, int medium) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

isRotated was not used by this function, apparently it's just an old appendage that made sense sometime in the past.

@rjhancock rjhancock added the For New Dev Cycle This PR should be merged at the beginning of a dev cycle label May 3, 2025
@rjhancock
Copy link
Collaborator

Im hesitant to merge this one for the .06 release. These are nice additions but it's also adding a new feature, so to speak.

@Scoppio
Copy link
Collaborator Author

Scoppio commented May 4, 2025

Im hesitant to merge this one for the .06 release. These are nice additions but it's also adding a new feature, so to speak.

In that case, I am reopening my previous PR which added the warning nag for users advising them for not selecting odd width boards for tiling maps together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For New Dev Cycle This PR should be merged at the beginning of a dev cycle Map and Board Specific Issues related to a Map, Board or Tileset Performance Severity: Critical Issues described as critical as per the new issue form
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Issue] When Tiling Maps (2x2) Right Side Maps Hexes Appear Scrambled
2 participants