Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #201, Closes #202, Closes #203
NOTE This implementation has been noted to cause sync errors when manually ordering harvesters to enter refineries. I'll fix the implementation later.
This pull request implements 3 features to significantly 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.
If a refinery is reserved for a harvester that is far away and a nearby harvester is seeking for a refinery to unload to, the nearby harvester takes the far-away harvester's place in the refinery queue. This feature is also known as "queue jumping" as coined by cfehunter in his mod for TD Remastered that he has since taken down.
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
#202
#203
Rules.ini settings
To allow customizing the behaviour of these features, this PR adds the following Rules.ini keys, section
[General]
: