Page 1 of 2

Is loop based train design totally broken?

Posted: Thu Jul 14, 2016 11:02 pm
by Miravlix
I really detest how multi-headed train design works, it's completely stupid if the train has different items in it's wagons, since if it visit two stations and tries to return home, it is facing the wrong way, so I've been focusing on the single direction train designs and I simply can't get it to behave well.

A simply setup with 4 stations for copper/stone/iron/coal and I constantly experience that some train think it's a good idea to loop into another station on it's way to it's own unloading station. This situation arises because some signal is blocked by another train and the looped stations create a path it can move down, never mind that it's a completely stupid path choice that's way longer than if it went straight on behind the other train.

That the train will take these bad detours also shows that the train is most likely doing insane pathfinding, because every single rail is a legal destination.

Maybe some right or left only system, so it wouldn't actually be a legal route for it to loop into each station, but having a train needing to loop around the entire base, if I'm unlucky with the location of the next copper mine, doesn't sound good.

Re: Is loop based train design totally broken?

Posted: Fri Jul 15, 2016 2:43 am
by bigyihsuan
I don't know what you're doing, but here's some tips:
  • Allow at least 1 train length of track before and after the station junction. This'll let a train about to leave the station a place to wait if another train is passing through the loop.
  • Place a loop after the station, following the above bullet. This will let the train to turn around right after leaving its station.
  • Make sure to use chain signals. They're very helpful with making sure that a train will always make it through the crossing points, junctions, and loops.
Loop-based systems aren't broken, you just have to spam loops anywhere you can.

Re: Is loop based train design totally broken?

Posted: Fri Jul 15, 2016 3:10 am
by DaveMcW
The correct way to do single-engine trains is to put a loop inside every station. Then a train never has to go out of its way to turn around.

I hope you are using a pair of one-way tracks everywhere, that is just smart design for any rail system.

Re: Is loop based train design totally broken?

Posted: Fri Jul 15, 2016 8:14 am
by lpw
I can just suggest reading through this post viewtopic.php?f=18&t=18621
It's kind of long but will probably answer all your problems.

Re: Is loop based train design totally broken?

Posted: Fri Jul 15, 2016 9:39 am
by Tnarg
If it helps here are my junction blueprints I use.
viewtopic.php?f=8&t=28769
Note: the blueprints fit over each other so you can make over 500 different junctions if you want.

I was thinking about making a few station blueprints but they would be dependent on the size of the trains so would be less useful to people unless the they use 1-2 trains like me.

Re: Is loop based train design totally broken?

Posted: Fri Jul 15, 2016 6:24 pm
by taiiat
it sounds like your stations are on your main rails of travel? don't do that. Stations should always be off of the main paths of travel.

one way loops with appropriately placed turning points is the 'correct' way to use Trains though, so it definitely works.
DaveMcW wrote:The correct way to do single-engine trains is to put a loop inside every station. Then a train never has to go out of its way to turn around.

I hope you are using a pair of one-way tracks everywhere, that is just smart design for any rail system.
incredibly important information.

Re: Is loop based train design totally broken?

Posted: Fri Jul 15, 2016 8:33 pm
by saturn7
Also if a train station has a loop, expect that other trains use the loop too (even if only one train goes to that station), and signal it accordingly.

That's because due to the current pathing algorithm, trains sometimes take detours, and suddenly going through another station's loop is needed.

Re: Is loop based train design totally broken?

Posted: Sat Jul 16, 2016 2:09 am
by Miravlix
saturn7 wrote:Also if a train station has a loop, expect that other trains use the loop too (even if only one train goes to that station), and signal it accordingly.

That's because due to the current pathing algorithm, trains sometimes take detours, and suddenly going through another station's loop is needed.
Only response that seems to understand the issue correctly, unfortunately it seems to say the same thing I did, that loops is broken because every path is legal because of looping.

Four stations horizontal, with *separate* T-Sections going to each, so if a train destination station is the last the 3 other stations is still *LEGAL* paths, if any signal is blocked on the vertical line. Plenty of space between each t-section for a couple of trains to park, but sometimes my trains think it's a brilliant idea to loop into a station on it's way to it's own station and that is just a disaster and make me classify it as totally broken, because I can't see a way to design around it, that doesn't involve shooting myself in the foot repeatedly with a nuke.

Too bad, loop based design is clearly better on paper (although more complicated), but won't actually hold up to it's promise due to how the train pathfind.

Re: Is loop based train design totally broken?

Posted: Sat Jul 16, 2016 2:24 am
by StoneLegion
Just based on the title then it sounds like it's working ;)

Re: Is loop based train design totally broken?

Posted: Sat Jul 16, 2016 3:27 pm
by alexzzzz
I tried double-headed trains once (187 hours of playing) and realized that their only real advantage is that train stations can be pretty compact. However, the problem with engineering trains coming back to their home depot in reverse seemed to be unsolvable. So, in the new game I decided to return to single-headed trains and loops everywhere.

My standard train station with two loading terminals, one unloading terminal for supplies and a waiting area for three incoming trains:
Standard Train Station

Re: Is loop based train design totally broken?

Posted: Sun Jul 17, 2016 7:49 am
by leffe108
So far I only have one train of each resource type in my 0.13 game. What I did with the new waiting conditions and circuit network was to:
  1. Each resource has its own platform at the main base
  2. Add chests at unload station at main base
  3. Connect buffer chests to the station using logic wires
  4. In the train schedule make the resource train not leave main base to get more resources unless the stored amount in the chests is less than eg. 500 or 1k.
This way, most of the time the trains stand waiting at their station in the main base and should they for whatever reason want to loop in a resource loading station, chances are high its empty or the train will soon depart as each resource station buffers more resources than to fill a train in chests.

How to scale this to more trains per resource I haven't figured out yet. I could have them leave the main unload station and park at some railway yard where there is more space but will need to connect it with logic cables to the main base unload area to carry over the signal on when to go and get more resources.

I don't know or think this is THE solution. Just doing it this way for fun and it may help with the problem discussed here.

Re: Is loop based train design totally broken?

Posted: Sun Jul 17, 2016 5:04 pm
by Turtle
I don't understand why you're using double-headed trains in a loop design. I think you're mixing Loop-based rail networks with single-rail networks. In a loop-based network, you should only have one direction in and one direction out for every station. Are you using single track or double track? Perhaps you should post a screenshot or your save so we can take a closer look and provide better solutions.

Re: Is loop based train design totally broken?

Posted: Mon Jul 18, 2016 3:57 am
by NameLips
As an old Transport Tycoon player, the main problem I have with the trains is that I can't make the complex junctions I'm used to because we can't use the z-axis to make tracks run over and under each other without intersecting. :P

Re: Is loop based train design totally broken?

Posted: Mon Jul 18, 2016 7:55 am
by ccik
I always use single headed trains, but i've managed to avoid most of the deadlocking issues. In my opinion, these are the 2 most important design aspects for loop-based systems:

1. Always split your stations off the main-line. First, spit off a 2-track line from the main line. Then, build your station on one side of this track, loop the exit off the station around, done. Most important: Use this junction from the main line only for one station. Every station has it's own branch line, so the only reason for trains going through these stations is the train has to stop at the station itself.

2. I always build a bypass line in all my outposts. Two reasons: If i want to do something in the outpost, i can park my train there withouth disturbing the normal traffic. Second, if a train needs to loop through a station, there is a bypass which allows travelling through the station even when a train is loading.

Re: Is loop based train design totally broken?

Posted: Mon Jul 18, 2016 6:13 pm
by hi_impact
Sounds like this problem is self inflicted. There is literally no problem with looped train networks if you signal them properly. I think you got all the help links in the thread to fix it, good luck.

most trains run double-headed in real life.

Re: Is loop based train design totally broken?

Posted: Mon Jul 18, 2016 8:57 pm
by ssilk
hi_impact wrote:most trains run double-headed in real life.
Not correct. Depends on what country or what kind of transport you are speaking from.

Re: Is loop based train design totally broken?

Posted: Mon Jul 18, 2016 10:29 pm
by siggboy
I think nobody really understands why he's annoyed. He is annoyed because the trains use the loops that he has built into the stations in order to take detours. The loops give trains with a blocked path the possibility to find a new route which is a large detour, because the train can use any station to turn back towards its original destination.

It's a limitation of the pathfinding algorithm and has nothing to do with OPs skill (or lack thereof) building a rail network.

Maybe somebody can start making suggestions of how to avoid this instead of repeating the same advice over and over again which is not really helpful in this case.

Re: Is loop based train design totally broken?

Posted: Mon Jul 18, 2016 10:36 pm
by 5thHorseman
siggboy wrote:I think nobody really understands why he's annoyed. He is annoyed because the trains use the loops that he has built into the stations in order to take detours. The loops give trains with a blocked path the possibility to find a new route which is a large detour, because the train can use any station to turn back towards its original destination.

It's a limitation of the pathfinding algorithm and has nothing to do with OPs skill (or lack thereof) building a rail network.

Maybe somebody can start making suggestions of how to avoid this instead of repeating the same advice over and over again which is not really helpful in this case.
I need to know first why a train looping through a station is a bad thing if that train doesn't stop there, isn't blocked when there, blocks no other trains on its way through, and by taking the shortcut gets to its destination faster than it would. The suggestions above help alleviate those problems, it seems, even if they don't stop the shortcutting.

To be more brief, if you eliminate all the actual (train stoppage) problems, is the train going through the station still an issue?

Re: Is loop based train design totally broken?

Posted: Mon Jul 18, 2016 10:54 pm
by MrGrim
5thHorseman wrote:I need to know first why a train looping through a station is a bad thing if ... taking the shortcut gets to its destination faster than it would.
That's the problem right there. That assumption is not actually correct. I've seen trains take wild detours that more than double their trip length for inexplicable reasons. I've learned to just live with it, but the logic for "fastest" route could definitely do with some tweaking. I run a medium train network on my map with about 18 2-4 trains. The busiest intersections might experience wait times of a few seconds at worst. I haven't had any deadlocks for a long time. If an intersection is even a little bit congested (and I mean as in give it 5 seconds and it'll be 100% clear) a train will sometimes lose its mind and travel half way in the opposite direction to take a loop in a far remote outpost rather than deal w/ that intersection.

More gratuitous loops it is, then. :D

Re: Is loop based train design totally broken?

Posted: Tue Jul 19, 2016 7:08 am
by DarkHelmet
Trains do weird things in Factorio.

Take alexzzzz's station in viewtopic.php?p=185204#p185204... I've seen trains following another train past stations like that, and the pathfinder suddenly deciding that it would be great to drive right through the station simply because it was too close to the train ahead of it.

I've modified my main saves to only allow stations to be entered and exited from a single direction to avoid that. If the train isn't going to/from the core, it can't get in or out, or detour through the station on the way past. In my bases, trains generally leave the mainline at a curve junction, turn around and can only go back the way they came.

And other times they just sit there like idiots at a bypass / alternate route fork because they want to go through the only one that's occupied. Some of that inititive that makes them go on grand detours would be great in situations like that.

Yeah, Factorio trains are weird. Particularly if there's curved or angled track involved.