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

Improves the harvester AI. #934

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Rampastring
Copy link
Member

Closes #201 , Closes #203

This pull request implements 2 features to improve the harvester AI:

  • The harvester's refinery-seeking algorithm now considers both free refineries and occupied refineries when figuring out which refinery to unload at. If the closest occupied refinery is much closer to the harvester than the closest free refinery, the harvester queues for the occipied refinery instead of going for the free refinery.

  • In vanilla TS, harvesters always go for the northernmost tiberium patch if there is one. This means that on some starting locations, harvesters tend to move just further and further away from your refinery as they harvest, because on each cycle they just go further and further to the north. On other starting locations this behaviour, on the other hand, is usually beneficial (if your refineries are to the north of a tiberium field). This creates a bad imbalance for most maps. Instead of having fixed preferred directions for the tiberium-seeking algorithm, harvesters now pick the most valuable patch that's also closest to their last refinery. This keeps the resources flowing faster, keeps your harvesters safe and levels the playing field between different starting locations.

These features are also explained in the following issues:

#201
#203

Earlier I also had a fix for #202 but it was noted to cause desync errors in multplayer, so a better solution for that will have to be found.

Rules.ini settings

To allow customizing the behaviour of these features, this PR adds the following Rules.ini key, section [General]:

; When looking for refineries, harvesters will prefer a distant free
; refinery over a closer occupied refinery if the refineries' distance
; difference in cells is less than this.
MaxFreeRefineryDistanceBias=<int> ; defaults to 16

@github-actions
Copy link

github-actions bot commented Dec 3, 2022

This comment is automaticly generated by Nightly.link and allows non-registered users to get download the artifacts for this pull request.

These links are also updated when the pull request is pushed to.

@CCHyper CCHyper changed the title Improves the harvester AI. #201, #203 Improves the harvester AI. Dec 12, 2022
@CCHyper CCHyper force-pushed the develop branch 3 times, most recently from 48cd2ea to b789478 Compare December 22, 2022 08:32
Copy link
Contributor

@CCHyper CCHyper left a comment

Choose a reason for hiding this comment

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

Before I perform a full review;

Can this PR be rebased to the upstream develop branch, also can a pass be made on the implementation approach, where some static functions can be moved to the extension classes for a cleaner implementation (for example, footext_functions.h is outdated here).

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants