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: 84
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: 5601
Joined: 13 Sep 2004 13:21
Location: The Moon

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
Tycoon
Tycoon
Posts: 1750
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
Route Supervisor
Route Supervisor
Posts: 385
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
Director
Director
Posts: 552
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
Traffic Manager
Traffic Manager
Posts: 205
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: 84
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 79 times
mak
Traffic Manager
Traffic Manager
Posts: 205
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
Tycoon
Tycoon
Posts: 1750
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 3852 times
ottd2.png
(380.34 KiB) Not downloaded yet
ottd3.png
(1.21 MiB) Not downloaded yet
LaChupacabra
Route Supervisor
Route Supervisor
Posts: 385
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 61 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 45 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 69 times
I am sorry for may English. I know is bed.
LaChupacabra
Route Supervisor
Route Supervisor
Posts: 385
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 73 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 3785 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 3773 times
I am sorry for may English. I know is bed.
User avatar
L. Spooner Inc
Engineer
Engineer
Posts: 84
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.
User avatar
L. Spooner Inc
Engineer
Engineer
Posts: 84
Joined: 22 Jul 2019 08:13

Re: Train traffic jams

Post by L. Spooner Inc »

Alright, so I just had a screaming temper tantrum and put my fist through the wall. I am clearly not getting this. I've gone through all the suggestions, started a new game, and everything was running much smoother until the tracks reached a certain level of nose-to-nose congestion, at which point the entire system from map edge to map edge came to a total halt, and my attempt to throw new track up on the fly resulted in flaming wrecks everywhere. And now I have to patch a hole in the wall.

As near as I can tell, my problem seems to come from scaling things up. As long as there's some slack in the system things work fine. As I add more trains, all it takes is a single blockage anywhere, and everything, everywhere becomes completely and permanently blocked with no way to fix it since I use one-way track and you can't add new track underneath trains. The thing which is frustrating me is I can tell there's something fundamental I'm not understanding. Is it that I'm throwing too many trains onto too little track? It's irritating to build new rail beside existing lines, as you have to dismantle all your interchanges to do it, and because you can't add fresh rail underneath trains, you need to send everything to a depot and lose six months of income and risk borderline resources poofing out of existence.

I don't mind challenge, but I get angry when it feels like I'm fighting the game instead of the challenges within the game. Am I just stupid?
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Train traffic jams

Post by jfs »

Usually a blockage starts somewhere, either a station where a train is unable to enter because the station is full and no trains are leaving, or because of a deadlock in a junction.

A station full with no trains leaving will most often be if a primary industry shut down (so no goods is arriving on the station), or if a station is full of trains trying to pick up a secondary cargo and no trains can enter to deliver the required primary cargo. (For example, an oil refinery with a single station, all tracks occupied by trains trying to pick up goods, so no oil is getting delivered and no goods produced.)
The solution to this is having separate drop-off and pick-up stations, and making sure trains going to one can't (easily) be blocked by trains wanting to go to the other. A good way to ensure that is to not have too many trains. If trains are queuing up in front of a station where they want to pick up cargo, you have too many trains compared to the production level.

Deadlocks in junctions occur if signals are placed such that trains stopping in front of the signals can block switches other trains might need to pass.
The golden rule of path signals is to only place signals where a train would be able to wait without blocking trains going in other directions.

Anyway, when your network gets blocked, the thing to do is examine your stations and junctions, and look for causes.
(And if the game is frustrating you, my best suggestions would be to first pause, save, and take a walk outside. :mrgreen: )
User avatar
odisseus
Director
Director
Posts: 552
Joined: 01 Nov 2017 21:19

Re: Train traffic jams

Post by odisseus »

Every rail network has an upper limit of trains it can accommodate. If you try to launch more trains, the whole network will be affected. The average train speed will decrease, as the trains will spend more time waiting for free path and then accelerating from a halt. Sometimes a new train might be unable lo leave the depot at all, and in the worst cases deadlocks may occur.

It is possible to design a deadlock-proof network by following a set of simple rules, but still adding trains past the limit will decrease the total throughput of the network. The only way to progress from that point is raising the limit by redesigning your network; designing with future expansion in mind is one of the game's challenges.
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: No registered users and 7 guests