Skip to content
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

Train prefers service in depot over station #7901

Open
astetyn opened this issue Jan 5, 2020 · 10 comments
Open

Train prefers service in depot over station #7901

astetyn opened this issue Jan 5, 2020 · 10 comments
Labels
component: pathfinder This issue is related to Pathfinder enhancement Issue would be a good enhancement; we accept Pull Requests!

Comments

@astetyn
Copy link

astetyn commented Jan 5, 2020

Version of OpenTTD

Version: 1.9.3

Expected result

Train prefers stop at station rather than going to the depot. And prefers going the right direction rather than going to the depot.

Actual result

When train is comming into the station and needs to be serviced, it goes to the depot which is behind station and completely ignores the station. This causes big issues when you have only one-way routes.
Also similar problem appears when you have crossroad and closer depot is in the wrong direction but train prefers it.

Steps to reproduce

I think fix can be done in pathfinder and make bigger priority to stop in the station (or go the right direction) rather than servicing.

@nielsmh
Copy link
Contributor

nielsmh commented Jan 5, 2020

So, if the route to the chosen depot passes through the station that is the current order, delay the automatic service until after stopping at the station? The logic seems reasonable at least.

@nielsmh nielsmh added enhancement Issue would be a good enhancement; we accept Pull Requests! component: pathfinder This issue is related to Pathfinder labels Jan 5, 2020
@astetyn
Copy link
Author

astetyn commented Jan 5, 2020

What do you mean with

delay the automatic service

?
I cant manually delay the service.

@nielsmh
Copy link
Contributor

nielsmh commented Jan 5, 2020

I assume you are talking about the automatic servicing, i.e. that a train decides it has passed its servicing interval/reliability threshold, and needs to visit a depot. Therefore it automatically searches for a path to the nearest depot. When it reaches that depot and has entered it, the train resumes its regular schedule by going to the station it was on the way to before the automatic servicing.

This is different from manual servicing (clicking the "go to nearest depot" button in the train window) and from scheduled servicing (a depot appearing on the orders list). With manual servicing, you presumably clicked the button because you want the train in a depot as soon as possible and don't want any stops on the way. With scheduled servicing, presumably the schedule is planned so the train won't need to turn back to visit the next station.

@astetyn
Copy link
Author

astetyn commented Jan 5, 2020

Yes, I understand now. I was talking about automatic servicing.
Scheduled servicing can be better in this situation, but with longer distances and many trains on the track its hard to predict the time for train when it needs to be serviced.

So, as you said,

delay the automatic service until after stopping at the station

can be solution. This can also be applied with crossroad.

@andythenorth
Copy link
Contributor

What's the signalling set up? Is this just the issue where a train won't re-route to a depot for service unless there's a PBS signal between it and the depot?

@astetyn
Copy link
Author

astetyn commented Jan 6, 2020

I don't know what is PBS but I made small examples where issue occurs. Signals are "One-way Path signal".

openttde_example
openttd_example2

@nielsmh
Copy link
Contributor

nielsmh commented Jan 6, 2020

PBS is Path-Based Signals, so the signal type you are using.

The following here are some general gameplay tips learned from experience with how things have always worked.

In your first example, the signals are placed badly, in a way that will definitely cause problems. With path signals, you should never put signals at the entry to a station, only at the exit from the platform. Instead you should place signals before the junction in front of the station, path signals use track reservations and not blocks, so other trains can pass the junction as soon as the previous has cleared the points the next needs to traverse.
If you place depots after a station it's usually also best to have the signals after the platform be two-way (i.e. regular/not-one-way path signals) so trains would be able to go back into the station from the depot.

Your second example doesn't have any reliable way of working, it would be very difficult to make the pathfinder able to reason that by taking that depot, the train would be unable to reach its destination again. Having depots on dead end branches, combined with automatic servicing, is generally a recipe for problems.

Some situations can be improved with additional checks in the pathfinder, but many will never be able to get a good solution.

@perezdidac
Copy link
Contributor

Hi everyone. I want to revive this conversation as this is IMO a real issue that could be solved.

For automatic servicing, I believe the logic should be smarter, like not just find the nearest one but instead look for the one that minimizes the path from the current location to the next destination with at least one depot along the way.

I am new to OpenTTD development but I am happy to take a try on this but need some questions:

  • Does Pathfinder optimize paths for multi-stops or focuses on resolving the shortest path for the next destination?
  • Can Pathfinder alternatives be implemented as NewGRF or they are part of the core of the game?

@TrueBrain
Copy link
Member

As a quick-fix, you can set the order of a train to go to a depot after a station; it will not do automatic service at that point, and go when it is done with the station.

@LordAro
Copy link
Member

LordAro commented Apr 12, 2021

Possibly the same issue as #8022, but with trains instead of ships

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pathfinder This issue is related to Pathfinder enhancement Issue would be a good enhancement; we accept Pull Requests!
Projects
None yet
Development

No branches or pull requests

6 participants