Train traffic jams

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Post Reply
User avatar
L. Spooner Inc
Engineer
Engineer
Posts: 47
Joined: 22 Jul 2019 08:13

Train traffic jams

Post by L. Spooner Inc »

As my skills at designing rail networks increases, I'm finding I'm getting increasingly frustrated with the default rail AI. I've been using one-way dual rail systems (one train in each direction) and getting really, really bad traffic jams. Trains seem to happily put themselves into positions where they block their own path forward, especially when trying to pull into or our of trainyards. A variation occurs when dual trains put themselves into a position where they block each other, then, on high-traffic systems, create a traffic jam which literally cannot be fixed, at all, ever. Once 30 or 40 trains are now jammed up, untangling them all become impossible because when you turn pause off to get a train at the back into a railyard to free others, another train comes and jams itself in. Eventually the entire rail network becomes locked up and I'm forced to abandon the game because nothing can be moved. Presumably the entire world burns and leaves a rusting network of immobilized trains as a monument to brain-dead artificial intelligence.

What am I and/or the default train AI doing wrong?

User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5446
Joined: 13 Sep 2004 13:21
Location: The Moon
Contact:

Re: Train traffic jams

Post by PikkaBird »

I'm going to say it's you. But it's impossible to diagnose what you might be doing wrong without a savegame or screenshots.

User avatar
jfs
Chief Executive
Chief Executive
Posts: 652
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Train traffic jams

Post by jfs »

Trains getting into deadlock is 100% a problem with how you designed your network and how you placed signals.

Post some screenshots of junctions and stations giving you trouble.

LaChupacabra
Engineer
Engineer
Posts: 32
Joined: 08 Nov 2019 23:54

Re: Train traffic jams

Post by LaChupacabra »

I would like to see the save of this game.
L. Spooner Inc wrote:
08 Jan 2020 21:22
them all become impossible
I really like playing "mission impossible" :twisted:
I am sorry for may English. I know is bed.

User avatar
odisseus
Engineer
Engineer
Posts: 73
Joined: 01 Nov 2017 21:19

Re: Train traffic jams

Post by odisseus »

Some examples of junctions and stations in the wiki contain signalling errors. Maybe not exactly errors, but the signals are placed in a way that can cause deadlocks under some conditions.

These stations and junctions will work all right when there are just a few trains; but, as the train density increases, deadlock becomes more and more likely, and at some point it is guaranteed to happen.

Contrary to Locomotion, the pathfinder in OpenTTD is not smart enough to avoid such situations. If a train needs to pass through a signal block that contains a junction, the train will enter that block even if the next block is occupied. If the train cannot leave the junction quickly, other directions become blocked too.

However, building deadlock-proof networks is surprisingly easy once you understand how path signals work.

A different kind of deadlock can happen if you use a station for both loading and unloading cargo. To avoid it, just use separate stations for loading and unloading.
Last edited by odisseus on 11 Jan 2020 18:55, edited 1 time in total.

mak
Engineer
Engineer
Posts: 84
Joined: 30 Sep 2015 13:16

Re: Train traffic jams

Post by mak »

The simplest way, because that is how I am, simple.

Use 'path signals'.
Any signal before a junction should be as close as possible to the junction.
Any signal after a junction should be at least the distance of the length of the longest train on the system.

Example train length of ten, distance between junction and first signal after junction 10 squares.
Then it is impossible for a train to block a junction. EDIT: unless it breaksdown.

User avatar
L. Spooner Inc
Engineer
Engineer
Posts: 47
Joined: 22 Jul 2019 08:13

Re: Train traffic jams

Post by L. Spooner Inc »

Okay, I've attached my current game. As you can see I start out with good intentions and then, as traffic increases, start throwing more rail on to try to break up the traffic jams. In particular on this map the most troublesome areas are Wruntwood Central and Bindburg Bay Valley/Sulow Woods. You can see a self-blocking traffic jam starting at Leabridge Docks. Yes, I know my rail network isn't pretty. Don't judge me!
Attachments
L. Spooner Transport, Jun 4th, 2000.sav
(568.55 KiB) Downloaded 18 times

mak
Engineer
Engineer
Posts: 84
Joined: 30 Sep 2015 13:16

Re: Train traffic jams

Post by mak »

First observation, go to Settings--Vehicles---Routing and make Forbid trains 90 turns, green not Red

Then remove all signal after the junctions (as mentioned before) at Wruntfield also reduce the Depots to one.

There may be more, adding more track to try and reduce blockages does not always work, my plan is KISS, Keep It Simple Stupid. :D

Good luck

User avatar
jfs
Chief Executive
Chief Executive
Posts: 652
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Train traffic jams

Post by jfs »

Here's some observations and suggestions to make things flow better.
Attachments
ottd1.png
ottd1.png (84.34 KiB) Viewed 233 times
ottd2.png
(380.34 KiB) Not downloaded yet
ottd3.png
(1.21 MiB) Not downloaded yet

LaChupacabra
Engineer
Engineer
Posts: 32
Joined: 08 Nov 2019 23:54

Re: Train traffic jams

Post by LaChupacabra »

Pathfinder actually has some bug - it sends trains on routes which forming loops shorter than the train itself, which means that they are not able to overcome them and they block themselves. What's more, it looks like he was doing it for no reason.
I don't know if it can be easily solved. It seems complicated to me. Certainly, however, this bug is much more likely to occur when 90 turns are on * (red option color). When they are turned off * (green option color), the probability that trains will block in this way is much lower.

There are three saves here
On the first one the train will follow an absurd route and it will block itself on a small loop.
Pathfinder bug - (L.Spooner), block themselves.sav
(575.25 KiB) Downloaded 7 times
On the second, the situation is identical, but the train will travel normal route.
Pathfinder bug - (L.Spooner), normal route.sav
(572.18 KiB) Downloaded 3 times
On the third - to make it more interesting - the train will wait in the depot until the correct route slows down.
Pathfinder bug - (L.Spooner), waiting for route.sav
(572.18 KiB) Downloaded 3 times
I am sorry for may English. I know is bed.

LaChupacabra
Engineer
Engineer
Posts: 32
Joined: 08 Nov 2019 23:54

Re: Train traffic jams

Post by LaChupacabra »

And here another, clearer case, with forbidden 90° turns.
Pathfinder bug - loop, 2061-08-15.sav
(21.89 KiB) Downloaded 7 times

As for what you could do / not do to make the traffic smoother and trains not block each other, I would have a few comments:
0. Enable* the option forbidding trains to perform 90° turns.
1. Where you give full load, trains waiting to enter the station block the route of other trains - there is no place where they could stop without blocking traffic. There are several solutions. The most effective are associated with the use of depot(s).
2. You allow trains to service whenever and wherever they want. If you want traffic to run smoothly, every servicing should be planned. You do not need to designate depots in orders - you can force the service to build routes accordingly.
3. You don't use shared orders - this is a very basic mistake. If you would like to change orders for a group of vehicles you will have to do it for each vehicle separately. With sharing, by changing the orders for one train, you change them for the whole group.
4. You don't use "Go non-stop" orders - this is also a very basic mistake, which can cause a huge mess if cargodist is enabled.
5. Unloading and loading or loading of different goods takes place on the same platforms, which can very quickly lead to blockage or, at best, to reduce production.
6. You build routes with sharp turns that slow down traffic.
7. If you care about keep single-level intersections that you build, it will be difficult to significantly increase the capacity of the line.

Regarding some remarks*...
Turn setting - quasilogic.PNG
Turn setting - quasilogic.PNG (11.85 KiB) Viewed 166 times
* This is one of the most illogical settings in the game. How can you turn off turning on (green color)? Turning it on should mean allowing and the green color, turning it off: forbiding and the red color, otherwise it will be confusing.
Turn setting - non-misleading v2.png
Turn setting - non-misleading v2.png (13.39 KiB) Viewed 154 times
I am sorry for may English. I know is bed.

User avatar
L. Spooner Inc
Engineer
Engineer
Posts: 47
Joined: 22 Jul 2019 08:13

Re: Train traffic jams

Post by L. Spooner Inc »

Thank you for all your help, everyone. I'm going to adopt most of your suggestions, if only to see the difference it makes. A lot of the unnecessary track and depots you see are the result of my increasing frustration, adding them to break up traffic jams. Sticking a depot on is the fastest and easiest way to get a train off the tracks, and then they start proliferating like mushrooms as congestion gets worse and worse. I've been using sharp turns just because I find them aesthetically more pleasing, but I guess curves are more realistic anyway. The biggest change for my style of play will be breaking up stations from universal use to specialized use. That's going to take some getting used to, but I guess that's part of the fun.

Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: No registered users and 1 guest