-
-
Notifications
You must be signed in to change notification settings - Fork 534
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
Added an algorithm for distributing damaged units between free repair stations #3686
Open
Monsterovich
wants to merge
1
commit into
Warzone2100:master
Choose a base branch
from
Monsterovich:feat-repair
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eliminating these repair facilities from contention altogether (which is what this does) seems like it could have other potentially-undesirable drawbacks.
(For example, with this change, if all repair facilities are crowded - by the metric - then none of them are candidates to even move towards. This then triggers the fallback behavior, and could (if there are no repair droids) lead to droids up for repair going all the way to the HQ. Whereas someone might want all the droids to head towards repair facilities, even if they are currently crowded.)
Did you not find the existing behavior that already "randomly" distributes droids amongst multiple nearby repair facilities sufficient? (See where there's
int32_t which = gameRand(vFacilityCloseEnough.size());
- perhaps we could try increasingMAGIC_SUITABLE_REPAIR_AREA
as an alternative?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, this most likely won't happen, because if units are normally distributed to repair facilities, they will be faster to repair (at most we can increase the limit from 8 to 12, but I think it's fine as it is).
Second, as a last resort, let them go to HQ instead of crowding around the repair facilities. It can happen that a lot of damaged units will be repairing and crowding around, but suddenly an enemy comes (ex. VTOL bombers) and kills them all.
The situation can be improved by utilizing the droid repairers additionality as you've already mentioned.
No, it doesn't work well in practice, no matter how you do it you still have to make the stations close together and perpendicular to the flow for greater efficiency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that's based on the current way the code selects which facilities are "close enough", which seems like something we could alternatively change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I'm suggesting...
You can make any algorithm you want, but it still has to take into account that some units are already "queued" for repair in a certain repair facility and this facility should be skipped after the queue overflows and another nearby should be picked instead. Then the repairing structures can essentially be positioned however you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the most basic example showing the problem. Making repair facilities next to each other creates another problem, but it solves the problem on the screenshot.
The other problem is that repaired units accumulate closer to the center of the certain facility, and damaged units can't get any closer due to the large amount of already repaired units. This PR completely eliminates this problem too as it limits the size of the unit group next to the structure.