-
-
Notifications
You must be signed in to change notification settings - Fork 946
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
Add: Road vehicle path cache. #7261
Conversation
Hmm, I need to test behaviour around multiple stops. |
Looks to be working fine, all stops being used. |
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.
It looks like there is some problem with potential infinite loops if the road ahead of a vehicle is destroyed. Performing the same action without this patch causes the vehicle to immediately take the long way about.
Olot Transport, 9th Jun 1970.zip
Only remaining issue is that because the pathfinder works on segments instead of tiles, it's possible to lead vehicles down completely wrong paths by adding or removing trackbits. This can be solved by also storing the tile of each path choice. |
This remaining issue is resolved by storing the tiles associated with each trackdir choice, which can then used to invalidate the path when necessary. |
c9fd850
to
7b254d7
Compare
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.
I can't think of any more ways to break this.
Modeled on the ship path cache, so not many surprises. The maximum length is in path-finder segments (effectively number of junctions) rather than tiles due to how YAPF works for RVs.
On my system with the Wentbourne save, road vehicle time dropped from 62.5ms/t to 19.75ms/t, which is pretty significant. Performance gains for a more normal number of road vehicles would of course be less.