Skip to content
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

vtols off the ground; bombs expansion #2701

Merged
merged 3 commits into from
Jun 17, 2021

Conversation

NickAragua
Copy link
Member

Three changes:

  • generated VTOLs no longer start at elevation 0
  • only put 1 TAG on bombers, hook it up with other types of bombs for the rest of the space instead
  • wait a little longer to load transports; this seems to be a thread timing issue

@codecov
Copy link

codecov bot commented Jun 12, 2021

Codecov Report

Merging #2701 (4e0a37e) into master (ac90643) will decrease coverage by 0.00%.
The diff coverage is 1.88%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2701      +/-   ##
============================================
- Coverage     10.62%   10.62%   -0.01%     
- Complexity     3848     3850       +2     
============================================
  Files           717      717              
  Lines         99442    99472      +30     
  Branches      16329    16337       +8     
============================================
+ Hits          10563    10565       +2     
- Misses        87506    87535      +29     
+ Partials       1373     1372       -1     
Impacted Files Coverage Δ
MekHQ/src/mekhq/AtBGameThread.java 0.00% <0.00%> (ø)
...hq/campaign/mission/AtBDynamicScenarioFactory.java 1.72% <4.16%> (-0.01%) ⬇️
MekHQ/src/mekhq/campaign/universe/Faction.java 66.66% <0.00%> (-0.66%) ⬇️
...ekHQ/src/mekhq/campaign/market/ContractMarket.java 59.15% <0.00%> (+0.20%) ⬆️
.../mekhq/campaign/mission/enums/AtBContractType.java 13.28% <0.00%> (+0.69%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ac90643...4e0a37e. Read the comment docs.

@lgtm-com
Copy link

lgtm-com bot commented Jun 12, 2021

This pull request introduces 1 alert when merging 5e4e651 into ac90643 - view on LGTM.com

new alerts:

  • 1 for Result of multiplication cast to wider type

Copy link
Contributor

@Windchild292 Windchild292 left a comment

Choose a reason for hiding this comment

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

Bombs look good, the elevation hack is okay but there should be an issue opened to allow that to be set, but the thread sleep increase just goes entirely against the entire reason the option exists.

@@ -318,7 +318,8 @@ public void run() {

// we need to wait until the game has actually started to do transport loading
// This will load the bot's infantry into APCs
Thread.sleep(MekHQ.getMekHQOptions().getStartGameDelay());
// sometimes it needs more time?
Thread.sleep(MekHQ.getMekHQOptions().getStartGameDelay() * 2);
Copy link
Contributor

Choose a reason for hiding this comment

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

This makes no sense... the option exists so you can set the time based on your setup, and if it is having communication troubles you should just increase the option's value

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe I'm being excessively cynical, but I imagine most people don't touch the default setting for that, and have no idea what it means. Thus, the sequence of events I'm picturing is: 1. Person sees units not loading into transport. 2. Person goes onto github/discord/slack to complain about it. 3. Somebody has to waste their time explaining about the delay setting, maybe successfully maybe not. I'd like to skip parts 1-3 of this process.

Another option is to get rid of this, but set the default delay to 2x or even 3-4x higher. I'm currently leaning towards that.

A third option is to go back to sending entities over one at a time, which will most likely guarantee correct behavior, but will be considerably slower in the general case.

Copy link
Contributor

Choose a reason for hiding this comment

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

You probably aren't being cynical but instead realistic... I'd go with 4x the default as a base if this is as much of an issue as it sounds.

Copy link
Member Author

Choose a reason for hiding this comment

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

Narrowed down the actual cause of the problem, so now we basically wait for all the bot's units to load before attempting to load transports.

Comment on lines 2394 to 2395
int numBombs = (int) ((entity.getWeight() - weightModifier) /
(BombType.getBombCost(bombIndex) * 5));
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it be 5.0, to ensure it isn't int / int division? Also, rounding?

Copy link
Member Author

Choose a reason for hiding this comment

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

All the numbers involved in the operation are integers. Rounding down (the default behavior) is correct because otherwise it would result in putting more bombs in than the unit has capacity.

Copy link
Contributor

Choose a reason for hiding this comment

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

To prevent misreads and IDE / CI issues, can I suggest this be written to use the double and a specified round?

@NickAragua
Copy link
Member Author

Fixed a couple of other issues observed while testing:

  • LAMS were deploying in air mech mode (that's no good, bot doesn't know how to drive them)
  • Transport VTOLs were failing to load infantry because of the elevation check (irrelevant in lobby)
  • Move loadTransports method to more appropriate location given when it's called.

@NickAragua NickAragua mentioned this pull request Jun 16, 2021
14 tasks
@NickAragua NickAragua merged commit 92f1a4f into MegaMek:master Jun 17, 2021
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.

2 participants