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
Improved logic of sharing industry production between stations #7922
Conversation
Hm, apparently there was PR #7184 that got completely derailed and rejected. So, just to emphasize some points.
It only solves one specific quirk of game mechanics that so far is only known to confuse people and/or being abused. For example, currently there is no such thing as competition between three companies on one industry. Third station won't even get any cargo unless it uses another exploit to start acceptance. |
eddf593
to
59989d5
Compare
After a discussion in IRC I changed implementation so that it takes cargo bits that would've been lost previously to rounding issues and distributes them among the best rated stations, similarly to what original implementation did. Also I left CanMoveGoodsToStation as a separate function for better readability even though I don't need to call it twice anymore. Notably it works about as fast as original implementation in the most common cases of 0 or 1 stations. For the other cases it's about 6 times slower but that seems to be ok as they are quite rare when playing normally and it's probably going to waste even more time in StationFinder anyway. P.S. Can also be similarly optimized for 2 stations I just didn't see any particular reason to complicate it even more. |
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.
Nothing too major
59989d5
to
1e7307e
Compare
FWIW here is the simple code I'm using to roughly check performance. |
Since the dawn of time Industries in TTD only share cargo between two stations max. This behavior doesn't seem to be based on any logic and leads to some issues in mp as it can be easily abused.
So this patch:
Shares are still based on station rating like it was before and, in fact, this patch doesn't change behaviour at all if there are less than 3 stations around (except for negligible rounding losses).
I didn't add a new setting for this change as IMO it only fixes exploits/limitations and doesn't change the gameplay logic. So I can't imagine why would anyone ever want to opt-out of it.