Change: Cap docking tile occupancy penalty to a max of one ship #9514
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.
Motivation / Problem
Main problem is that there is no cap to 'docking tile occupancy penalty' - if there are 50 ships on the docking tile, the cost is ~50 times higher.
The higher the penalty/cost, the more likely the chances for the pathfinder to report ship is lost for other ships that are part of this route. If there's lots of water near the docking tile which is also the pf's destination, it will start looking for those cheaper nodes first, resulting in more search nodes being needed to find a path.
It really seems like a waste to search nodes around the destination. It's understandable that the penalty is being used to help send the ships to other docking tiles of the same multi-dock station, but... oh well.
Also refer to #8001
Description
This PR limits the penalty cost to a max of one ship in the docking tile. There's the cost of the tile being a docking tile which is 300 in YAPF, and then there's the cost of it being occupied by ships, which is also 300 in YAPF. So, at max, it's an added 600 cost now, instead of a cost that was dependent on the number of ships in the tile.
Limitations
This PR may help mitigate 'ship is lost' messages which are triggered when the max number of search nodes is reached by the pf, but in all honesty, it feels insufficient still to what the game used to be before this penalty ever existed.
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.