How to make train routes that support multiple speeds?

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

Post Reply
User avatar
kkidslogin
Engineer
Engineer
Posts: 23
Joined: 01 Feb 2024 21:02
Location: Tal'dorese Empire

How to make train routes that support multiple speeds?

Post by kkidslogin »

As a person who's played OpenTTD for a long time (citation needed) and who has always been interested in real-life train routes (citation needed), I'd like to make more realistic train routes. I understand some things aren't possible as things stand, given unrealistically fast cargo decay rates, unrealistically fast calendar speed, and unrealistically high industry production (All of these should hopefully be able to be fixed in 1.14.0 though with NotDayLength).

Therefore, specifically, I'm looking for a way to support multiple train speeds on the same rails without clogging up the network with trains constantly stopping and starting. I understand I could use waypoints, or use a rail-type GRF, but that feels cheap. I also know that I'd need more than two rails, or two rails with lots of sidings, to allow fast trains to pass slow ones, but two questions remain: firstly, would I have to turn up the pathfinder penalty for other vehicles (and, if so, by how much? I usually play with most trains length 7)? Secondly, does YAPF even recalculate enough along the route for it to dodge a slow train that suddenly merges onto the line?

I am playing with NARS, so I have plenty of different train speeds to choose from at any one time.

Dang I was really excited to finally use superscript tags for my citation needed's... oh well.
Certified forum helper ©. Also active in the Scratch forums, where I have over 2300 posts as of the last count.

Played OpenTTD since 1.4.4 8)
mauried
Traffic Manager
Traffic Manager
Posts: 148
Joined: 07 Sep 2010 11:35

Re: How to make train routes that support multiple speeds?

Post by mauried »

If you are playing using JGRs patch, you can implement some of the features you need, using the signal routefinding restriction functionality.
For example you can steer trains onto a particular track based on some of the trains characteristics, one of them being maximum train speed.
ie if you have a passing siding you can steer the slow trains onto 1 track and the fast trains onto another, so as to allow the fast train to overtake the slow one.
There are some restrictions though, one being that the fast train must catch up and overtake the slow train in the passing siding.
Ideally for this functionality to work all the time , the slow train needs to be stopped in the passing siding to ensure the fast trains can catch up regardless of how far behind the fast train is .
Ive not found any method so far of doing this.
Another brute force solution is to timetable all your trains and run the fast trains during the day, and the slow ones at night.
Hardly ideal, but does solve the problem of the slow trains getting in the way of the fast trains.
accipiter2000
Traffic Manager
Traffic Manager
Posts: 181
Joined: 19 May 2006 08:23

Re: How to make train routes that support multiple speeds?

Post by accipiter2000 »

You can utilize dual two-lanes. Construction is quite straightforward; simply install traffic lights at intersections where double lanes cross. For specific details, you can refer to the saved archive here.

viewtopic.php?t=91029&start=40
My most satisfying game session.
viewtopic.php?p=1267789
User avatar
kkidslogin
Engineer
Engineer
Posts: 23
Joined: 01 Feb 2024 21:02
Location: Tal'dorese Empire

Re: How to make train routes that support multiple speeds?

Post by kkidslogin »

mauried wrote: 03 Feb 2024 02:54 If you are playing using JGRs patch, you can implement some of the features you need, using the signal routefinding restriction functionality.
For example you can steer trains onto a particular track based on some of the trains characteristics, one of them being maximum train speed.
ie if you have a passing siding you can steer the slow trains onto 1 track and the fast trains onto another, so as to allow the fast train to overtake the slow one.
There are some restrictions though, one being that the fast train must catch up and overtake the slow train in the passing siding.
Ideally for this functionality to work all the time , the slow train needs to be stopped in the passing siding to ensure the fast trains can catch up regardless of how far behind the fast train is .
Ive not found any method so far of doing this.
Another brute force solution is to timetable all your trains and run the fast trains during the day, and the slow ones at night.
Hardly ideal, but does solve the problem of the slow trains getting in the way of the fast trains.
Good idea, but unfortunately I'm not playing JGRPP right now :(
accipiter2000 wrote: 03 Feb 2024 23:57 You can utilize dual two-lanes. Construction is quite straightforward; simply install traffic lights at intersections where double lanes cross. For specific details, you can refer to the saved archive here.

viewtopic.php?t=91029&start=40
Thanks, much appreciated!
Certified forum helper ©. Also active in the Scratch forums, where I have over 2300 posts as of the last count.

Played OpenTTD since 1.4.4 8)
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1680
Joined: 04 Mar 2005 01:07

Re: How to make train routes that support multiple speeds?

Post by OzTrans »

mauried wrote: 03 Feb 2024 02:54... There are some restrictions though, one being that the fast train must catch up and overtake the slow train in the passing siding.
Ideally for this functionality to work all the time , the slow train needs to be stopped in the passing siding to ensure the fast trains can catch up regardless of how far behind the fast train is.
I've not found any method so far of doing this. ...
Use slots/tokens ... the slow train will then wait in the siding, until there are no fast trains approaching. Once the last fast train has passed, the slow train will continue its journey.
User avatar
eekee
Engineer
Engineer
Posts: 96
Joined: 23 Jun 2005 19:45
Location: quantum superposition

Re: How to make train routes that support multiple speeds?

Post by eekee »

mauried wrote: 03 Feb 2024 02:54 If you are playing using JGRs patch, you can implement some of the features you need, using the signal routefinding restriction functionality.
For example you can steer trains onto a particular track based on some of the trains characteristics, one of them being maximum train speed.
ie if you have a passing siding you can steer the slow trains onto 1 track and the fast trains onto another, so as to allow the fast train to overtake the slow one.
You could use waypoints in stock, though you'd have to remember to add the waypoints to every order group.
mauried wrote: 03 Feb 2024 02:54 There are some restrictions though, one being that the fast train must catch up and overtake the slow train in the passing siding.
Ideally for this functionality to work all the time , the slow train needs to be stopped in the passing siding to ensure the fast trains can catch up regardless of how far behind the fast train is .
Ive not found any method so far of doing this.
I'm sure #openttdcoop players know how to do this. Having attempted to learn how they do it, I'm also sure sure #openttdcoop players are aliens with expanded craniums. :)) But it's not really beyond human capacity, just too much for me. It's a pity their wiki is all "502 bad gateway." Some of their games involve really precise train timing. They have circuits to control trains joining the main line so that they don't block fast trains already on the main line. They have all sorts of logic, balancing and timing circuits too. Unfortunately perhaps, none of these would look realistic as they all involve faux junctions to pick up train presence from one line and communicate it to another. Some even require "logic trains" whizzing around at 2000 km/hr.

One thing I picked up from #openttdcoop is that instead of stopping the slow train, you can direct it over a bridge with an even slower speed limit. This means it'll take less time to get back up to speed.
mauried wrote: 03 Feb 2024 02:54Another brute force solution is to timetable all your trains and run the fast trains during the day, and the slow ones at night.
Hardly ideal, but does solve the problem of the slow trains getting in the way of the fast trains.
There seem to be an infinite number of uses for timetables! :)

I think you can even add speed limits to timetables. (You can in JGR.PP.) This could be an alternative to the slow bridge I mentioned above.
Extreme network builder. screenshot thread
User avatar
odisseus
Director
Director
Posts: 568
Joined: 01 Nov 2017 21:19

Re: How to make train routes that support multiple speeds?

Post by odisseus »

As a matter of fact, the Openttdcoop Wiki is working at the moment. In case it goes offline at some point in the future, there's a chance that the information will be saved at the Internet Archive.

I don't have the time to check, but IIRC the Openttdcoop team had concluded that the unmodified game has no mechanism to assign a priority depending on the train's speed. There are priority mergers which can make a sideline train wait until the mainline train passes; however, if the sideline train is actually the faster one, it will still wait.
User avatar
eekee
Engineer
Engineer
Posts: 96
Joined: 23 Jun 2005 19:45
Location: quantum superposition

Re: How to make train routes that support multiple speeds?

Post by eekee »

odisseus wrote: 25 Feb 2024 17:45 As a matter of fact, the Openttdcoop Wiki is working at the moment. In case it goes offline at some point in the future, there's a chance that the information will be saved at the Internet Archive.
Great! I saw 502 on something on their site earlier, & assumed it was the wiki without really looking. Sorry.
odisseus wrote: 25 Feb 2024 17:45 I don't have the time to check, but IIRC the Openttdcoop team had concluded that the unmodified game has no mechanism to assign a priority depending on the train's speed. There are priority mergers which can make a sideline train wait until the mainline train passes; however, if the sideline train is actually the faster one, it will still wait.
That makes sense. It'd have to rely on manually assigning the slow train to waypoints. Not very flexible, I guess, but could work if traffic's not too heavy.
Extreme network builder. screenshot thread
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: How to make train routes that support multiple speeds?

Post by Eddi »

i'm pretty sure that timetabled speed limits are a standard feature.
User avatar
kkidslogin
Engineer
Engineer
Posts: 23
Joined: 01 Feb 2024 21:02
Location: Tal'dorese Empire

Re: How to make train routes that support multiple speeds?

Post by kkidslogin »

To let y'all know, I am playing Vanilla.
eekee wrote: 25 Feb 2024 16:35
mauried wrote: 03 Feb 2024 02:54 If you are playing using JGRs patch, you can implement some of the features you need, using the signal routefinding restriction functionality.
For example you can steer trains onto a particular track based on some of the trains characteristics, one of them being maximum train speed.
ie if you have a passing siding you can steer the slow trains onto 1 track and the fast trains onto another, so as to allow the fast train to overtake the slow one.
You could use waypoints in stock, though you'd have to remember to add the waypoints to every order group.
I could, but it's an ugly and annoying solution... I'm hoping that both trains can run at their natural speed most of the time, and will try to route around each other.
Eddi wrote: 25 Feb 2024 18:10 i'm pretty sure that timetabled speed limits are a standard feature.
It is.
eekee wrote: 25 Feb 2024 18:02
odisseus wrote: 25 Feb 2024 17:45 I don't have the time to check, but IIRC the Openttdcoop team had concluded that the unmodified game has no mechanism to assign a priority depending on the train's speed. There are priority mergers which can make a sideline train wait until the mainline train passes; however, if the sideline train is actually the faster one, it will still wait.
That makes sense. It'd have to rely on manually assigning the slow train to waypoints. Not very flexible, I guess, but could work if traffic's not too heavy.
Well, it was worth a shot. I'm not too worried about junctions (my games typically have low traffic over junctions... really simple flat junctions usually work), my main goal is to get fast trains to dodge slow trains. But that doesn't seem to work :|
Certified forum helper ©. Also active in the Scratch forums, where I have over 2300 posts as of the last count.

Played OpenTTD since 1.4.4 8)
accipiter2000
Traffic Manager
Traffic Manager
Posts: 181
Joined: 19 May 2006 08:23

Re: How to make train routes that support multiple speeds?

Post by accipiter2000 »

kkidslogin wrote: 25 Feb 2024 20:31 To let y'all know, I am playing Vanilla.

Well, it was worth a shot. I'm not too worried about junctions (my games typically have low traffic over junctions... really simple flat junctions usually work), my main goal is to get fast trains to dodge slow trains. But that doesn't seem to work :|
Still haven't got it? The solution is simple.
1.gif
1.gif (2.26 MiB) Viewed 1876 times
My most satisfying game session.
viewtopic.php?p=1267789
User avatar
odisseus
Director
Director
Posts: 568
Joined: 01 Nov 2017 21:19

Re: How to make train routes that support multiple speeds?

Post by odisseus »

I'm afraid this isn't the solution to the OP's problem. What you have is just two trains moving on two parallel tracks without ever blocking one another.

What if one of the tracks is occupied, and the slow train needs to wait so that the fast train can pass it and return to the same track? In my experience, this setup doesn't work like that.
overtake.png
The electric train, approaching from the lower left corner, cannot overtake the steam train despite the speed difference.
(84.7 KiB) Not downloaded yet
P.S. For recording animations, consider using ScreenToGif.
accipiter2000
Traffic Manager
Traffic Manager
Posts: 181
Joined: 19 May 2006 08:23

Re: How to make train routes that support multiple speeds?

Post by accipiter2000 »

Your issue seems to be that the number of vehicles exceeds the capacity of the tracks. Your current dual-track setup might barely cope with normal conditions, but you're looking to address exceptional situations without adding any extra resources, correct?As for the software you recommended, does it perform effectively in such scenarios? Could you demonstrate its effectiveness by giving it a try?
My most satisfying game session.
viewtopic.php?p=1267789
User avatar
odisseus
Director
Director
Posts: 568
Joined: 01 Nov 2017 21:19

Re: How to make train routes that support multiple speeds?

Post by odisseus »

Sure, we can just build more tracks to improve throughput, but that's totally irrelevant to the OP's original question.

As for the ScreenToGif program, I already use it and I'm very satisfied. It helps me create animations such as this one.
[+] Spoiler
Image
User avatar
kkidslogin
Engineer
Engineer
Posts: 23
Joined: 01 Feb 2024 21:02
Location: Tal'dorese Empire

Re: How to make train routes that support multiple speeds?

Post by kkidslogin »

odisseus wrote: 26 Feb 2024 03:14 I'm afraid this isn't the solution to the OP's problem. What you have is just two trains moving on two parallel tracks without ever blocking one another.

What if one of the tracks is occupied, and the slow train needs to wait so that the fast train can pass it and return to the same track? In my experience, this setup doesn't work like that.

overtake.png

P.S. For recording animations, consider using ScreenToGif.
You need a dual-way path signal here. The train at the top is blocking the routing of the other two trains. And yes, usually, I find the pathfinder doesn't like to cooperate with this setup.

I'd also like to avoid having to have continual quad-tracks everywhere I go, as on most games I play, I don't even fill up two tracks.
accipiter2000 wrote: 26 Feb 2024 05:19 Your issue seems to be that the number of vehicles exceeds the capacity of the tracks. Your current dual-track setup might barely cope with normal conditions, but you're looking to address exceptional situations without adding any extra resources, correct?As for the software you recommended, does it perform effectively in such scenarios? Could you demonstrate its effectiveness by giving it a try?
Two tracks does not "barely" cope with normal scenarios. I don't know what kind of game you're playing, but you need to turn the vehicle limit up a lot sooner than I do :lol:
odisseus wrote: 26 Feb 2024 11:56 Sure, we can just build more tracks to improve throughput, but that's totally irrelevant to the OP's original question.

As for the ScreenToGif program, I already use it and I'm very satisfied. It helps me create animations such as this one.
[+] Spoiler
Image
I'm well aware of this solution, and it is irrelevant, but it's always useful to remember!

that's why I need to stop building two-way roro stations lol
Certified forum helper ©. Also active in the Scratch forums, where I have over 2300 posts as of the last count.

Played OpenTTD since 1.4.4 8)
User avatar
odisseus
Director
Director
Posts: 568
Joined: 01 Nov 2017 21:19

Re: How to make train routes that support multiple speeds?

Post by odisseus »

The reversed train is my mistake in making the screenshot — I have reversed it after putting the game on pause, with the intent to make it more clear which train is where. Only afterwards have I realised that the reversed train actually blocks both tracks.

However, before making the screenshot I have run an experiment with all trains facing the same direction. I have let the trains #3 and #1 make a few dozen loops while train #2 was stopped, and train #1 was never able to overtake train #3.

The animation in my previous post was meant just as an example of ScreenToGif output; it is indeed irrelevant to the topic being discussed.
accipiter2000
Traffic Manager
Traffic Manager
Posts: 181
Joined: 19 May 2006 08:23

Re: How to make train routes that support multiple speeds?

Post by accipiter2000 »

kkidslogin wrote: 26 Feb 2024 21:20 Two tracks does not "barely" cope with normal scenarios. I don't know what kind of game you're playing, but you need to turn the vehicle limit up a lot sooner than I do :lol:
I typically use this structure to handle monthly transportation demands of 10,000 units. I am unsure whether this would suffice for the scenario you are encountering.
10M.gif
10M.gif (2.34 MiB) Viewed 1703 times
odisseus wrote: 26 Feb 2024 03:14 P.S. For recording animations, consider using ScreenToGif.
The software you recommended works amazingly well. I really enjoy using it. Is this a free software?
My most satisfying game session.
viewtopic.php?p=1267789
User avatar
kkidslogin
Engineer
Engineer
Posts: 23
Joined: 01 Feb 2024 21:02
Location: Tal'dorese Empire

Re: How to make train routes that support multiple speeds?

Post by kkidslogin »

accipiter2000 wrote: 27 Feb 2024 01:22
kkidslogin wrote: 26 Feb 2024 21:20 Two tracks does not "barely" cope with normal scenarios. I don't know what kind of game you're playing, but you need to turn the vehicle limit up a lot sooner than I do :lol:
I typically use this structure to handle monthly transportation demands of 10,000 units. I am unsure whether this would suffice for the scenario you are encountering.
10M.gif
odisseus wrote: 26 Feb 2024 03:14 P.S. For recording animations, consider using ScreenToGif.
The software you recommended works amazingly well. I really enjoy using it. Is this a free software?
I don't really try to optimize much, so I'm usually delivering far less than 10k units, so I don't need something like this. I'll keep this in mind if I ever reach there.
Certified forum helper ©. Also active in the Scratch forums, where I have over 2300 posts as of the last count.

Played OpenTTD since 1.4.4 8)
User avatar
kkidslogin
Engineer
Engineer
Posts: 23
Joined: 01 Feb 2024 21:02
Location: Tal'dorese Empire

Re: How to make train routes that support multiple speeds?

Post by kkidslogin »

odisseus wrote: 26 Feb 2024 22:27 The reversed train is my mistake in making the screenshot — I have reversed it after putting the game on pause, with the intent to make it more clear which train is where. Only afterwards have I realised that the reversed train actually blocks both tracks.

However, before making the screenshot I have run an experiment with all trains facing the same direction. I have let the trains #3 and #1 make a few dozen loops while train #2 was stopped, and train #1 was never able to overtake train #3.

The animation in my previous post was meant just as an example of ScreenToGif output; it is indeed irrelevant to the topic being discussed.
Ah, I see. A potential solution (albeit a very spacious one) would be to use logic rails and pre-signals to "inject" the stopped train's path onto the other side so that all trains on the other side can pass over. On the specifically speed-oriented side, this could be used near high-speed-train dedicated stations to ensure the fast trains get the first slots. Of course, it doesn't take speed into account otherwise.

It could also be possible to create a "minimum speed switch" of sorts with a logic train that's the speed of differentiation: if the train on the main rail is slower, it would be stopped by the logic train's injected path and if faster, it would beat the logic train.
Certified forum helper ©. Also active in the Scratch forums, where I have over 2300 posts as of the last count.

Played OpenTTD since 1.4.4 8)
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 15 guests