[patch] Scheduling + Patch

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
lemmy101
Engineer
Engineer
Posts: 15
Joined: 22 Apr 2021 02:20

[patch] Scheduling + Patch

Post 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!
Attachments
scheduling_plus_1_1.zip
(8.17 KiB) Downloaded 12 times
Last edited by lemmy101 on 23 Apr 2021 02:25, edited 1 time in total.
User avatar
2TallTyler
Transport Coordinator
Transport Coordinator
Posts: 306
Joined: 11 Aug 2019 18:15
Location: Massachusetts, USA
Contact:

Re: [patch] Scheduling + Patch

Post 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.
User avatar
jfs
Tycoon
Tycoon
Posts: 1334
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: [patch] Scheduling + Patch

Post 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 ;)
lemmy101
Engineer
Engineer
Posts: 15
Joined: 22 Apr 2021 02:20

Re: [patch] Scheduling + Patch

Post 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.
Last edited by lemmy101 on 23 Apr 2021 02:26, edited 2 times in total.
User avatar
jfs
Tycoon
Tycoon
Posts: 1334
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: [patch] Scheduling + Patch

Post 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.
lemmy101
Engineer
Engineer
Posts: 15
Joined: 22 Apr 2021 02:20

Re: [patch] Scheduling + Patch

Post 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!
lemmy101
Engineer
Engineer
Posts: 15
Joined: 22 Apr 2021 02:20

Re: [patch] Scheduling + Patch

Post 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.
User avatar
JGR
Tycoon
Tycoon
Posts: 2279
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: [patch] Scheduling + Patch

Post 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.
Ex TTDPatch Coder
Patch Pack, Github
lemmy101
Engineer
Engineer
Posts: 15
Joined: 22 Apr 2021 02:20

Re: [patch] Scheduling + Patch

Post 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.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 9 guests