Page 1 of 1

[patch] Scheduling + Patch

Posted: 22 Apr 2021 02:27
by lemmy101
Hey all! Playing OpenTTD with a friend for a week or so now and got really wound up by the really fiddly timetabling and it leading to bunched up vehicles unless manual ordering of the vehicles based on their timetable start date, so decided to make a few changes to combat it. Note this combines keoz' Timetabling waiting time in depots - viewtopic.php?t=70969 with blessings from keoz. Will post the github for my patch in a separate thread once I update it with other changes.

What this patch does?

This video sums up the features: https://www.youtube.com/watch?v=Wu9RgESyvSE

It gives a much simpler method of timetabling without trying to orchestrate all the vehicles to the right position in the queue, it does this via special behaviour when starting them at a depot. To quote Todd Howard: 'It just works'.

It also adds some useful buttons to change the travel times on all timetabled orders. Want to pad out all travel times a couple of days? Just input the number once. Got 60 mph vehicles now instead of 30 mph vehicles? set all the travel times to 50% with one change.

Image

Road vehicle changes:

* More permissive overtaking for normal wheeled road vehicles, particularly allowing for vehicles overtaking through stations and passing multiple vehicles. Some people may not like this I don't know but it just felt like road vehicles got stuck behind eachother way more often than they would IRL and their extra agility didn't seem sufficient to tempt you away from high capacity trams.

Time tabling and scheduling:

* Added keoz' Timetabling waiting time in depots - viewtopic.php?t=70969
* When a timetable is shared between a group of vehicles, if a depot is first on the orders with a wait time assigned, they will go there and wait for their timetable to start. They will also be ordered on the schedule purely by vehicle number, so #1 will be first to set off and so on.
* Added button to change percentage of all travel times. Set 200 to double all travel times in timetable, 50 to half.
* Added button to add specific number of days or ticks to all travel times.

The depot depositing the vehicles onto the time tabled route, in order, makes time tables a ton easier to handle for all vehicle types. In addition, the easier overtaking at bus stations and lorry stations means that pretty much scheduling just works a ton better, especially for wheeled road vehicles, and never leads to jams due to misordered vehicles. It no longer feels like a chore to make timetables.

Note that for best results, you should set the ctrl start date on vehicle #1 or the lowest number vehicle, or otherwise it'll give earlier dates than the one you set to lower number vehicles and that may start them before the current date and cause the very problems this is intended to fix.

Tested, but there may be unforeseen issues, do let me know!

Re: [patch] Scheduling + Patch

Posted: 22 Apr 2021 12:08
by 2TallTyler
This looks really useful. I think your improvement to starting vehicles out of depots, combined with keoz's "wait in depots" patch, would be a good addition to vanilla OpenTTD, with a few code style things fixed. :wink: I suspect the new buttons would be rejected in lieu of proposed auto-separation instead, and don't know enough about vehicle overtaking to know how robust your code would be — but in any case that would be a separate pull request than depot improvements.

I'm unclear how license works for patches, but keoz's patch is in JGR's Patchpack. I imagine you could send keoz a private message for truly bulletproof permission to use their code.

Re: [patch] Scheduling + Patch

Posted: 22 Apr 2021 13:30
by jfs
As for licensing, since the game is GPL v2, any patch to it is also GPL v2, and that means anyone can use it for any purpose whatsoever, as long as they keep proper attribution and ensure the license is retained on the code. Even then, it's nice asking, especially since the original author might offer to help you too ;)

Re: [patch] Scheduling + Patch

Posted: 22 Apr 2021 14:16
by lemmy101
2TallTyler wrote: 22 Apr 2021 12:08 This looks really useful. I think your improvement to starting vehicles out of depots, combined with keoz's "wait in depots" patch, would be a good addition to vanilla OpenTTD, with a few code style things fixed. :wink: I suspect the new buttons would be rejected in lieu of proposed auto-separation instead, and don't know enough about vehicle overtaking to know how robust your code would be — but in any case that would be a separate pull request than depot improvements.

I'm unclear how license works for patches, but keoz's patch is in JGR's Patchpack. I imagine you could send keoz a private message for truly bulletproof permission to use their code.
Also @ jfs: Have pmed keoz, was probably a good idea to message them in advance I was over eager and excited to share I guess!

re: adding to vanilla, I guess its best it floats in patchville for a while make sure its robust and the behaviour is perhaps clearer telegraphed, but of course I'd be super excited for that possibility should it be popular. I feel the overtaking is probably not something that would be accepted due to the fact that I'm effectively removing intended behaviour that's been purposefully added. It's by no means necessary for the core depot timetable feature though. re: 'auto-separation' I have no idea what this is :D

EDIT: they replied and its all cool.

Re: [patch] Scheduling + Patch

Posted: 22 Apr 2021 15:32
by jfs
There's nothing wrong with submitting it as a draft pull request already now, if it's reasonably feature complete and can offer a useful proof of concept.

Re: [patch] Scheduling + Patch

Posted: 23 Apr 2021 03:55
by lemmy101
jfs wrote: 22 Apr 2021 15:32 There's nothing wrong with submitting it as a draft pull request already now, if it's reasonably feature complete and can offer a useful proof of concept.
Cool I did that, which also made me get used to how the hell github works! Thanks!

Re: [patch] Scheduling + Patch

Posted: 23 Apr 2021 03:58
by lemmy101
Oh damn just looked up auto-separation, I think that may be a more desirable 'make things easy' fix than this one, I wonder if its possible for both to cohabitate.

Re: [patch] Scheduling + Patch

Posted: 23 Apr 2021 19:04
by JGR
lemmy101 wrote: 23 Apr 2021 03:58 Oh damn just looked up auto-separation, I think that may be a more desirable 'make things easy' fix than this one, I wonder if its possible for both to cohabitate.
Your implementation looks broadly similar to the scheduled dispatch feature in my branch. (I say this just from looking at the diff and video, I've not tried it).
I don't allow scheduled dispatch and auto-separation to both be on at the same time for a given timetable/set of vehicles with shared orders in my branch.
Timetable automation (which populates the timetable similarly to autofill), works fine with either though.

Re: [patch] Scheduling + Patch

Posted: 23 Apr 2021 20:32
by lemmy101
JGR wrote: 23 Apr 2021 19:04
lemmy101 wrote: 23 Apr 2021 03:58 Oh damn just looked up auto-separation, I think that may be a more desirable 'make things easy' fix than this one, I wonder if its possible for both to cohabitate.
Your implementation looks broadly similar to the scheduled dispatch feature in my branch. (I say this just from looking at the diff and video, I've not tried it).
I don't allow scheduled dispatch and auto-separation to both be on at the same time for a given timetable/set of vehicles with shared orders in my branch.
Timetable automation (which populates the timetable similarly to autofill), works fine with either though.
Ah neat that's good to know! Really loved the look of your patch pack btw, had a play but not had a chance to MP it yet but am sure that time will come! :D apparently there are features I missed about in it too since this is news to me despite looking through the changelist.