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

Fix Issue #35 "Improve mineral saturation" #50

Merged

Conversation

ImpulseCloud
Copy link
Contributor

This will send new/idle workers to a non-saturated townhall. Townhalls will build an extra worker over Ideal and it will go to a new non-saturated townhall upon creation, so each townhall will continually build workers if there are any townhalls that are not yet saturated (until 80 total). After constructing a building, workers will go to an unsaturated townhall instead of the closest/starting one.

@ImpulseCloud
Copy link
Contributor Author

ImpulseCloud commented Mar 2, 2021

I'm intending to do a proper evenly-redistribute-workers-among-bases when doing the decide-when-to-automatically-expand logic. Should I make a separate Issue for that, or include it with this one tomorrow?

@alkurbatov
Copy link
Owner

It is ok to continue work in the same issue.

src/core/Helpers.cpp Outdated Show resolved Hide resolved
src/core/Helpers.cpp Outdated Show resolved Hide resolved
src/Hub.cpp Show resolved Hide resolved
src/Hub.cpp Outdated Show resolved Hide resolved
src/Hub.cpp Outdated Show resolved Hide resolved
src/plugins/Miner.cpp Outdated Show resolved Hide resolved
src/Hub.cpp Outdated Show resolved Hide resolved
@alkurbatov
Copy link
Owner

Linter has failed:

src/Hub.cpp:257:  Lines should be <= 90 characters long  [whitespace/line_length] [2]
src/Hub.cpp:258:  Lines should be <= 90 characters long  [whitespace/line_length] [2]
src/Hub.cpp:261:  Lines should be <= 90 characters long  [whitespace/line_length] [2]
Done processing src/Hub.cpp
src/Hub.h:145:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]

@ImpulseCloud ImpulseCloud force-pushed the improve-mineral-saturation branch 4 times, most recently from 8603d8a to 61c91f6 Compare March 4, 2021 05:04
@ImpulseCloud
Copy link
Contributor Author

Extended Expansion class and polished some places. Works pretty well now. I changed the MarinePush strategy a bit to reflect that it can't use Stim or Reactors correctly yet.

@alkurbatov
Copy link
Owner

Linter errors:

src/Hub.cpp:126:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/Hub.cpp:140:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/Hub.cpp:273:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/Hub.cpp:277:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/Hub.cpp:281:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/Hub.cpp:284:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/Hub.cpp:291:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/Hub.cpp:339:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/Hub.cpp:348:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/Hub.cpp:356:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/Hub.cpp:362:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/Hub.h:157:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/blueprints/TownHall.cpp:16:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/core/Map.cpp:98:  Missing space before {  [whitespace/braces] [5]
src/core/Map.cpp:155:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/plugins/Miner.cpp:26:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]

src/Hub.cpp Outdated Show resolved Hide resolved
src/Hub.cpp Outdated Show resolved Hide resolved
src/core/Map.h Outdated Show resolved Hide resolved
src/plugins/Miner.cpp Outdated Show resolved Hide resolved
src/Hub.h Outdated Show resolved Hide resolved
src/Hub.cpp Outdated Show resolved Hide resolved
@ImpulseCloud ImpulseCloud force-pushed the improve-mineral-saturation branch 3 times, most recently from 0b18a9e to ea8ee37 Compare March 4, 2021 20:06
@ImpulseCloud ImpulseCloud mentioned this pull request Mar 4, 2021
src/plugins/Plugin.h Show resolved Hide resolved
src/Hub.cpp Outdated Show resolved Hide resolved
src/plugins/Miner.cpp Outdated Show resolved Hide resolved
src/plugins/Miner.cpp Show resolved Hide resolved
src/Hub.cpp Outdated Show resolved Hide resolved
src/Hub.cpp Show resolved Hide resolved
src/Hub.cpp Show resolved Hide resolved
@ImpulseCloud
Copy link
Contributor Author

I re-wrote a couple sections. Works really well to keep pumping workers on 3 base.

Thank you for taking the time to review and comment.

Copy link
Owner

@alkurbatov alkurbatov left a comment

Choose a reason for hiding this comment

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

Looks much better, thank you!
Please, take a look at the remaining issues. This is not critical changes, but could be better to do them now.

src/plugins/Miner.cpp Outdated Show resolved Hide resolved
src/plugins/Miner.cpp Outdated Show resolved Hide resolved
src/plugins/Miner.cpp Outdated Show resolved Hide resolved
src/plugins/Miner.cpp Outdated Show resolved Hide resolved
src/plugins/Miner.cpp Outdated Show resolved Hide resolved
src/plugins/Miner.cpp Show resolved Hide resolved
src/core/Map.cpp Show resolved Hide resolved
src/Hub.cpp Outdated Show resolved Hide resolved
@ImpulseCloud
Copy link
Contributor Author

I believe I have made requested changes now. Two of the Expansion/Owner questions I believe are best resolved within issue #53, "Secure/Defend new expansions" when there will be military actions to enable testing.

@ImpulseCloud
Copy link
Contributor Author

Can this pull request be accepted now?

@alkurbatov
Copy link
Owner

I need to review it and since the request is relatively large it'll take some time.

Copy link
Owner

@alkurbatov alkurbatov left a comment

Choose a reason for hiding this comment

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

Several minor fixes left.

src/Hub.cpp Show resolved Hide resolved
src/plugins/Miner.cpp Outdated Show resolved Hide resolved
src/plugins/Miner.cpp Outdated Show resolved Hide resolved
src/plugins/Miner.cpp Outdated Show resolved Hide resolved
This will send new/idle workers to a non-saturated townhall. Townhalls will build an extra worker over Ideal and it will go to a new non-saturated townhall upon creation, so each townhall will continually build workers if there are any townhalls that are not yet saturated (until 80 total). After constructing a building, workers will go to an unsaturated townhall instead of the closest/starting one.
@ImpulseCloud
Copy link
Contributor Author

Question: Should I have been just adding normal commits to resolve change-requests, and only doing a squash+force-push at the end after it's been reviewed successfully? I think perhaps the constant force-pushing is making looking at past change-requests more difficult.

@alkurbatov
Copy link
Owner

There are different ways of doing it. I prefer clean history without intermediate commits, however, you could have split the whole patch into several commits according to particular idea. To me it is ok in both ways.

@@ -145,6 +145,16 @@ void Dispatcher::OnUpgradeCompleted(sc2::UpgradeID id_) {
i->OnUpgradeCompleted(id_);
}

void Dispatcher::OnUnitEnterVision(const sc2::Unit* unit_) {
// gHistory.info() << sc2::UnitTypeToName(unit_->unit_type) <<
Copy link
Owner

Choose a reason for hiding this comment

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

Why this part was commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's triggered too often during big fights and slows the game. It's not just first time seen, but every time. If thought to leave it in commented out, so authors can easily uncomment it of they need to use for debugging, but maybe that isn't needed.

Copy link
Owner

Choose a reason for hiding this comment

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

I think better to remove it, but ok.

@@ -12,14 +12,14 @@ IsUnit::IsUnit(sc2::UNIT_TYPEID type_): m_type(type_) {
}

bool IsUnit::operator()(const sc2::Unit& unit_) const {
return unit_.unit_type == m_type && unit_.build_progress >= 1.0f;
return unit_.unit_type == m_type && unit_.build_progress >= BUILD_FINISHED;
Copy link
Owner

Choose a reason for hiding this comment

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

Seems that we need to add it to the api e.g. unit_.isBuildFinished().

@alkurbatov
Copy link
Owner

Very good job! Thank you!

@alkurbatov alkurbatov merged commit 3e4a5de into alkurbatov:master Mar 13, 2021
@ImpulseCloud ImpulseCloud deleted the improve-mineral-saturation branch March 13, 2021 20:54
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