JGRennison / OpenTTD-patches

OpenTTD - http://www.openttd.org/ - with additional patches
Other
569 stars 128 forks source link

Suggestion: Add game setting to decide what happens when a vehicle is sent to depot. #126

Open James103 opened 4 years ago

James103 commented 4 years ago

Version of OpenTTD

796a878

Expected result

There should be a game setting for deciding what happens when a vehicle is sent to depot. "When a vehicle is manually ordered to go to depot, ..." A) "Go to the nearest depot" - Uses vanilla OpenTTD rules to go to the nearest reachable depot. B) "Stop on the next depot order" - The vehicle keeps running through the schedule until it stops at a depot (because of a go to depot order or automatic servicing), in which case the train stops. C) "Stop on the next depot order and ignore timetable". Same as option B but the vehicle also ignores any timetabling applied to its orders (wait times and travel times).

Actual result

There is no game setting for deciding what happens when a vehicle is sent to depot. Vanilla behavior (option A) is always used.

Steps to reproduce

Send a train to depot. Observe that it goes to the nearest depot.

Evidence

M4J has said the following on his Discord server: image

JGRennison commented 4 years ago

I had a look at JokerPP and the behaviour seems useful, through the UI does not match up with what the vehicle is doing, which seems very odd. I will take a look into it.

If you can provide a savegame showing the unexpected scheduled dispatch behaviour, I can look into it. That said, in the vast majority of cases just using timetable automation and auto-separation is sufficient, unless you are trying to do clock-face timetabling.

M4JGaming commented 4 years ago

Just wondering if there is an update on the progress for the route-finding to depots. Right now Scheduled Dispatch is not working as intended so I would like to send all trains to the depot so I can find out why it's not working.

Scheduled Dispatch seems to make train timetables clear. By that I mean the arrival and departure times disappear and the vehicle waits at stations for a random amount of time, causing trains to bunch up even when they are spaced far apart.

This is the link to the latest save file available on my website (https://drive.google.com/drive/folders/1bPRzTh-9z3ym4dLVMmMCwqn5bv99tB2S?usp=sharing) and here is the link to the NewGRF folder I use: https://drive.google.com/drive/folders/1nwK7lgP_CfQvNp6JpT7Sy39pzgC_1hji?usp=sharing

Thanks in advance for taking a look into this

JGRennison commented 4 years ago

Thanks. There is a lot of stuff in that savegame, which area or which vehicles should I be looking at?

The general concept of scheduled dispatch is that it is all about clock face timetabling when the vehicle leaves the first station in the order list. If you're not doing clock face timetabling then you probably don't need to use scheduled dispatch. For preventing trains from bunching, you're probably better off using auto-separation instead.

I haven't forgotten about the issue of an additional mode for requesting vehicles go to/service at depots. I will see what I can do about that and will let you know.

James103 commented 4 years ago
  1. Is there any way to both have Scheduled Dispatch and auto-seperation active at the same time without either of them breaking?
  2. Can you please consider adding a flag that when set, locks the timetable of the vehicle's orders and prevents them from being changed or cleared by Scheduled Dispatch and/or Auto Seperation?
JGRennison commented 4 years ago
  1. No, they are fundamentally both adjusting the same thing.
  2. The whole purpose of scheduled dispatch and auto separation is to adjust the timetable start time. If that was disabled then neither feature would do anything at all. In the case of scheduled dispatch the start time is selected manually and applied at the first station, in the case of auto-separation the start time is automatically adjusted to achieve separation of vehicles.
M4JGaming commented 4 years ago

If I remember correctly the game loads at the airport station. Each vehicle there has had its timetable wiped by either auto-separation or Scheduled Dispatch. It seems as though as soon as there's a delay a vehicle, timetable gets cleared, which then causes all the vehicles behind to bunch up.

I would go back to just using auto-separation but in truth this whole network was built around the idea of realism, and encouraging people to join in with their own rail franchises and schedules. Having Scheduled Dispatch would go a long way towards making that a possibility, but right now it feels like it's missing something that I can't quite put my finger on if that makes sense.

I've tried as best as I can to set up timetables so the trains are dispatched from the depot at the time I want them to be (by setting the scheduled dispatch time to roughly an hour beforehand) and when that works it does exactly what I want it to. The only issue is when vehicles bunch up, as there's currently no way to unbunch them without further messing up the other vehicles on the same tracks.

JGRennison commented 4 years ago

I'm having a look at group 9axx // GSC - BAC.

Auto-separation will not work in this case as the order list has conditional orders. Scheduled dispatch will only take place on the first station, which as I understand it is skipped over in the non-servicing case. Without knowing how many times the non-servicing loop will execute I don't really see how the timetabling is intended to work?

Your dispatch schedule appears to be unevenly distributed across your duration. It'd probably be simper to have a shorter dispatch duration such that there are fewer dispatch slots required (simplest case is having 1). What the duration should be and how many trains you need is difficult to calculate because your timetable (with respect to leaving the first station) is of non-deterministic length.

I'm not sure what ticks per minute you're using, but 5610 seems to give plausible looking times?

M4JGaming commented 4 years ago

The best examples are in the "Gardcity Great Western" groups. One service ends up blocking the entire route, which can cause huge problems.

I've removed conditional orders from most of the schedules now but when they were in place it was meant to loop the vehicle if its reliability was higher than 20%. This was to replicate real life services where trains run the same route back and forth all day. I'm not sure exactly how many times each vehicle would loop but it tends to average between 2 and 5. If it could be possible to add that function into the game (calculating if a vehicle would loop and including that in the dispatch schedule) then that would be awesome.

For some of my schedules I tried to replicate peak and off-peak scheduling. It might be easier in future to create duplicate services for this to simplify the dispatching but again I was mostly experimenting with this. It would be cool to have this working though as I like the idea of increasing the frequency during rush hour on some of my services. Shortening the duration wouldn't really fix this as it's the morning and evening peaks that need extra services.

My ticks per minute is 1480 (or the nearest number to that as I'm away from my desk so can't remember exactly) but I'll change it to 5610 to see if that helps. I'd like to get the game running as close to real-time as possible if that's something that can be done?

Thanks for the advice though, I'll try it all out and see what works best for me.

James103 commented 4 years ago

@JGRennison Why did you choose 5610 ticks/minute (93.5 ticks/second) as a "realistic" time scale? Why not 2000 ticks/minute (33.33 ticks/second) or 1480 ticks/minute (24.67 ticks/second)?

JGRennison commented 4 years ago

5610 is just the number that I deduced from your savegame which made the timetables for the group I mentioned previously make sense. The first two orders have manually set wait times of 112,200 and 56,100 ticks, which would correspond to 20 and 10 minutes. The dispatch schedule appears to have been set to a 112,200 period which would then also correspond to 20 minutes.

Don't feel the need to change anything if you've already timetabled using a different number.

Currently neither auto separation nor scheduled dispatch do any sophisticated analysis of the timetable, they primarily look at how long it is in the obvious linear way. The common use case is an automatically filled or fully automated linear timetable.

In the general case it is difficult to make predictions about conditional orders as they are only evaluated when the vehicle reaches that point in the order list. This problem also occurs with cargo routing for much the same reason.

Is the current restriction that scheduled dispatch applies only to the first station much of a problem?

I will have a ponder about the timetabling issues/features. The slight caveat is that I still need to be cognisant that a large majority of the player base already find timetables and the timetable window UI confusing/difficult. I am keen to try not to make the learning curve any steeper than it already is for the simple cases.

M4JGaming commented 4 years ago

I might change the ticks per minute anyway just to test things out. From what you've said it'll make working out times a lot easier. I tend to have trains wait in the depot for 60 minutes as it used to be the buffer wait in case the train was late. I guess with this I don't actually need that anymore.

I didn't really think about how conditional orders are processed. That makes sense though, I can see why it's done that way.

I wouldn't necessarily say it's an issue, but I did think it would work more like the timetable system in Cities in Motion 2. In that game vehicles are dispatched from the depot so that they arrive at the first stop at the designated time in the schedule. I ave no idea how it works out the journey time in order to do that but I figured since OpenTTD can show each stage of a timetable then it might be possible to have the train arrive at the terminus at a selected time instead of just leaving the depot. If that's not possible though then I'm ok with that, I can work around it.

The only thing I would say I really need right now is the path finding to depots. That way if my trains do get clogged I can just send them for servicing to 'reset' that service. It would also be handy to be able to set station wait times to 0.5 seconds rather than the current minimum of 1 minute. Just to speed things up a bit.

I did have a question though. Say my wait time at the depot is 60 minutes, does that 60 minutes start at the time set in Scheduled Dispatch or can it be made to end at the time set in Scheduled Dispatch?

Gadg8eer commented 10 months ago

Any chance routing through back-to-back depots might still be possible and reasonable?