Advanced train routing

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
LiborTheOne
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Nov 04, 2017 3:20 pm
Contact:

Advanced train routing

Post by LiborTheOne » Fri Nov 10, 2017 4:45 pm

Hi.

I'm just getting into "serious" use of trains and cannot figure out solution to one problem.
Is there a way to "tell" train where to go depending on content of its cargo?
I know, that there is discussion about these conditions to be added, but I was not able to find out a workaround for now.

I'm aware of possibility to read content of train's cargo at particular station, but how can I transfer this information to let train know where to go next? Not mentioning that this way I cannot read its fuel state.
I'm no stranger to programming so any level of combinator logic is fine. But I would like to avoid logistics networks, if possible. (Just personal preference.)

If there is commonly known solution, or I'm over-complicating my train network, please let me know and forgive me starting new topic. :oops:

Thank You for all suggestions.
Long description

Jap2.0
Smart Inserter
Smart Inserter
Posts: 2043
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Advanced train routing

Post by Jap2.0 » Fri Nov 10, 2017 5:53 pm

Yes and no. You cannot skip stations on the schedule, but there are ways to get around this. Most of it revolves around you naming, for example, all iron stations something like "iron pickup". Then, there are a few things you can do:

1. Have trains go to iron pickup, wait until they are full, then go to iron unload. If you do this, trains will usually* go to the nearest empty station.
2. See above, but disable stations when they have below a certain amount of ore in chests at that station, so trains will never go to a station without enough ore. Usually* this is the nearest empty station.
3. I believe some mods let you do this or something similar

*Not always, but most of the time - it gets complicated with longer distances and stuff
There are 10 types of people: those who get this joke and those who don't.

quyxkh
Filter Inserter
Filter Inserter
Posts: 776
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: Advanced train routing

Post by quyxkh » Fri Nov 10, 2017 5:59 pm

Short answer: conditional routing is theoretically possible, but I don't know that anybody's got it working or that it'd be an improvement on simpler designs if anybody did.

Long answer: a train station is all stops with the same name, so a train will unconditionally pick the nearest enabled stop with the right name when it routes; if there's no enabled stop with the right name it'll just go on to the next station in its schedule. You _can_ manipulate path lengths with rail signals, each rail signal that's set red by circuitry adds a hefty-ish 1000-tile penalty so trains will go far to avoid stops behind wired-red signals. But it's hard to control when exactly a train chooses its destination; you could scatter "iron/copper drop" stops and cook up some interlock circuitry so trains only depart iron-pickup stops once the rail signals are set up to prioritize the stop that most needs iron, but this has two problems: first problem, if a second iron-laden train can depart before the first one arrives, you'll need yet more circuitry to identify exactly which stop is going to get picked and avoid sending the second train to the same one (unless it really needs two trainloads that fast), and second problem, trains can repath enroute if they're blocked at a (chain?) signal, so if a copper train gets blocked it'll repath according to however the signals are set up when it retries -- which could easily be for the wrong condition. Neither of these two problems is insoluble, "just" design and add the needed enroute-deliveries-bookkeeping circuitry and keep your trains on completely congestion-free routes.

It's easier to have multiple single-product pickup stops in a station where each feeds a specific multi-product drop, for instance lategame chip production wants a 14:15 iron:copper plate ratio for max efficiency and I've found it easiest to just have pickup stations with both iron and copper stops, empty delivery trains route to the iron/copper pickup station, where each stop is dedicated to a specific chip factory (via a delivery-requested circuit signal at the pickup stop and no-alternatives direct routing) and delivery from that destination is similarly dedicated. I'm reworking the layout, here's the current rather messy state with two versions. This is for max-prelaunch tech, if you want to check it out you'll probably want creative-mode source/sink chests to get it working in a test rig.
blueprint
picture of the mess
Last edited by quyxkh on Fri Nov 10, 2017 6:29 pm, edited 2 times in total.

Jap2.0
Smart Inserter
Smart Inserter
Posts: 2043
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Advanced train routing

Post by Jap2.0 » Fri Nov 10, 2017 6:06 pm

quyxkh wrote:Long answer: a train station is all stops with the same name, so a train will unconditionally pick the nearest open stop with the right name when it routes; if there's no open stop with the right name it'll just go on to the next station in its schedule.
It does not skip stations that are not open, last I checked (it will que behind the train currently in the station - this is why stackers and things work. If you're talking about disabled, stations, I have no idea if you're right.
quyxkh wrote:You can manipulate path lengths with rail signals, each rail signal that's set red by circuitry adds a hefty-ish 1000-tile penalty so trains will go far to avoid stops behind wired-red signals.
It's enabled train stations that add a 1000 tile penalty - red signals add a penalty equal to the tile length of the block.

Also, I'm not sure if you've seen, but this subforum has some cool railway stuff.
There are 10 types of people: those who get this joke and those who don't.

quyxkh
Filter Inserter
Filter Inserter
Posts: 776
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: Advanced train routing

Post by quyxkh » Fri Nov 10, 2017 6:32 pm

I fixed the "open" misword to more correctly read "enabled", thanks. Signals set red by circuitry do add a 1000-tile penalty, see viewtopic.php?f=5&t=52635 and the wiki and the published source.

Jap2.0
Smart Inserter
Smart Inserter
Posts: 2043
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Advanced train routing

Post by Jap2.0 » Fri Nov 10, 2017 9:52 pm

quyxkh wrote:I fixed the "open" misword to more correctly read "enabled", thanks. Signals set red by circuitry do add a 1000-tile penalty, see viewtopic.php?f=5&t=52635 and the wiki and the published source.
Oh, TIL. I thought it was the same with circuits and regularly. Thanks!
There are 10 types of people: those who get this joke and those who don't.

LiborTheOne
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Nov 04, 2017 3:20 pm
Contact:

Re: Advanced train routing

Post by LiborTheOne » Sat Nov 11, 2017 8:05 am

Jap2.0 wrote:1. Have trains go to iron pickup, wait until they are full, then go to iron unload. If you do this, trains will usually* go to the nearest empty station.
2. See above, but disable stations when they have below a certain amount of ore in chests at that station, so trains will never go to a station without enough ore. Usually* this is the nearest empty station.
*Not always, but most of the time - it gets complicated with longer distances and stuff
Yes, I am using this method, but it sometimes derps.
It is thou best I was able to come up with, yet. ;-)
(Probably the only practical one.)
quyxkh wrote:Short answer: conditional routing is theoretically possible, but I don't know that anybody's got it working or that it'd be an improvement on simpler designs if anybody did.
What You are proposing is to switch appropriate signals all the way from current to next desired station, if I understand You correctly. That is, of course, technically an option, but I don't think it is practically possible. ;-)
Jap2.0 wrote:Also, I'm not sure if you've seen, but this subforum has some cool railway stuff.
Yes, I saw that and there are some crazy-cool designs and ideas. But I didn't find anything on how to route train to refueling station only when it is low on fuel. ;-)

Jap2.0
Smart Inserter
Smart Inserter
Posts: 2043
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Advanced train routing

Post by Jap2.0 » Sat Nov 11, 2017 1:00 pm

LiborTheOne wrote:Yes, I saw that and there are some crazy-cool designs and ideas. But I didn't find anything on how to route train to refueling station only when it is low on fuel. ;-)
Unfortunately that's not really possible - what most people do is have a station many of their trains go to (for example iron, copper, coal, oil, and uranium unload) and fuel trains there.
There are 10 types of people: those who get this joke and those who don't.

LiborTheOne
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Nov 04, 2017 3:20 pm
Contact:

Re: Advanced train routing

Post by LiborTheOne » Sat Nov 11, 2017 3:17 pm

Jap2.0 wrote:Unfortunately that's not really possible - what most people do is have a station many of their trains go to (for example iron, copper, coal, oil, and uranium unload) and fuel trains there.
That's obvious solution. But not as elegant as dedicated Depot station, imho. ;-)

So basically answer to my original questions is NO.

If I may have a followup questions:
Is there any planned effort to add these(or similar) routing options to some distant later version?
Maybe make some bitters into railroad engineers to add consciousness to trains. You just add alien artifacts back as eggs and hatchery and training yard and few lines of code, right. ;-) :-D
Is there any planned effort to add electric trains(rails) to some distant later version?
Maybe as bonus eliminating need to place power poles all the way to outposts. You just add few copper cables to rail recipe and few lines of code, right. ;-) :-D
I know there are some mods, but why not integrate them to vanilla, as for example fluid wagon was.

Jap2.0
Smart Inserter
Smart Inserter
Posts: 2043
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Advanced train routing

Post by Jap2.0 » Sat Nov 11, 2017 4:29 pm

LiborTheOne wrote:
Jap2.0 wrote:Unfortunately that's not really possible - what most people do is have a station many of their trains go to (for example iron, copper, coal, oil, and uranium unload) and fuel trains there.
That's obvious solution. But not as elegant as dedicated Depot station, imho. ;-)

So basically answer to my original questions is NO.

If I may have a followup questions:
Is there any planned effort to add these(or similar) routing options to some distant later version?
Maybe make some bitters into railroad engineers to add consciousness to trains. You just add alien artifacts back as eggs and hatchery and training yard and few lines of code, right. ;-) :-D
Is there any planned effort to add electric trains(rails) to some distant later version?
Maybe as bonus eliminating need to place power poles all the way to outposts. You just add few copper cables to rail recipe and few lines of code, right. ;-) :-D
I know there are some mods, but why not integrate them to vanilla, as for example fluid wagon was.
I don't think there are any plans at the moment, but they would be welcome additions. From what I've heard there are a few reasons for that - the developers are attempting to polish everything up for 1.0, if we add too many things like this it may be too complicated for new players, adding everything takes time, many ideas can easily be accomplished another way or would take away some of the pussle element of the game, etc.
There are 10 types of people: those who get this joke and those who don't.

quyxkh
Filter Inserter
Filter Inserter
Posts: 776
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: Advanced train routing

Post by quyxkh » Sat Nov 11, 2017 5:11 pm

LiborTheOne wrote:Maybe as bonus eliminating need to place power poles all the way to outposts.
This is wandering a bit OT but you already don't need to do that. Efficiency modules and solar panels make a great team.

Zavian
Smart Inserter
Smart Inserter
Posts: 1458
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: Advanced train routing

Post by Zavian » Sun Nov 12, 2017 2:48 am

I think that Logistics Train Network will do what the OP wants. I've never tried it myself. I simply use one or more trains to each dropoff station.
viewtopic.php?f=214&t=51072

Post Reply

Return to “Gameplay Help”

Who is online

Users browsing this forum: No registered users