Dynamic train schedule

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

AntiBlueQuirk
Long Handed Inserter
Long Handed Inserter
Posts: 71
Joined: Wed May 03, 2017 2:57 pm
Contact:

Re: Dynamic train schedule

Post by AntiBlueQuirk »

It's a little ugly, but I made a mod for this with the new API. :)

https://mods.factorio.com/mod/smart-waypoints
boggis2
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri May 05, 2017 10:14 pm
Contact:

Train ui/logic 0.17

Post by boggis2 »

I love the new train ui and how train stops are listed, but if i have a player transport train the stop list tends to get quite long, it doesn't help that add new wait condition and await circuit signal takes up 2 slots, so i wish i would be able to select in the train to not show it at all in the list.

Conditional train stops, i would love to set up a train stop in the train that uses circuit logic to decide where the train goes next. for instance if i give the the train signal Iron Ore 5 it will go to the station i have programed the train to go to when it received that signal instead of turning the train stops on and off.
Tekky
Smart Inserter
Smart Inserter
Posts: 1040
Joined: Sun Jul 31, 2016 10:53 am
Contact:

Re: Train ui/logic 0.17

Post by Tekky »

boggis2 wrote: Sun Mar 24, 2019 12:45 am Conditional train stops
This has already been suggested many times, most recently in the following thread:

viewtopic.php?f=6&t=64362 Dynamic train schedule
EDIT: This link now points to the current thread, because the threads have now been merged.

That thread also contains links to older threads.

As I have already stated in the thread mentioned above, I agree with the suggestion.
Last edited by Tekky on Tue Mar 26, 2019 12:04 am, edited 1 time in total.
Koub
Global Moderator
Global Moderator
Posts: 7784
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Dynamic train schedule

Post by Koub »

[Koub] Merged into older topic with similar suggestion.
Koub - Please consider English is not my native language.
FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2768
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Dynamic train schedule

Post by FuryoftheStars »

Something like this would be nice to see implemented.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
zinefer
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sun Jun 16, 2019 9:20 pm
Contact:

Low fuel condition for trains

Post by zinefer »

TL;DR
Add a low fuel condition (or let me specify items and amounts of fuel conditions) for the scheduler.

What ?
Allow me to specify an item in the train schedule that allows me to set a stop for a low fuel condition.

Why ?
I love modular rail based setups and I want to have all trains go to a central location for refueling and I think this would be a clean solution. There are other solutions to this problem (such as turning a station on and off for all trains every x minutes) but I really feel there should be a more efficient solution. I feel these concerns are well served by the scheduler as I could have very fine, per route control for refueling.
Tekky
Smart Inserter
Smart Inserter
Posts: 1040
Joined: Sun Jul 31, 2016 10:53 am
Contact:

Re: Low fuel condition for trains

Post by Tekky »

What you are basically asking for are conditional train orders. This has already been discussed in numerous threads, for example this one:

viewtopic.php?f=6&t=64362 Dynamic train schedule
EDIT: Meanwhile, the threads have been merged. Therefore, my link above now points to the current thread.

That threads contains links to further threads.
Last edited by Tekky on Mon Jun 17, 2019 5:47 pm, edited 1 time in total.
Koub
Global Moderator
Global Moderator
Posts: 7784
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Low fuel condition for trains

Post by Koub »

[Koub] Merged into the older, more general topic.
Koub - Please consider English is not my native language.
Roxor128
Fast Inserter
Fast Inserter
Posts: 168
Joined: Sun Oct 02, 2016 9:48 am
Contact:

Re: Dynamic train schedule

Post by Roxor128 »

For a newbie-friendly way of skipping stations, I'd suggest just adding a "Skip If" section to the train schedule editor which can use all the same conditions as the "Wait Until" section. I would expect the Skip If section would be evaluated when the train meets the Wait Until condition for the previous station in the schedule.

I know we can approximate this by enabling and disabling stations with the circuit network, but that really only works if you have a particular group of trains that all visit a common set of stops. It's not going to work for keeping trains from visiting the refuelling station when they don't need it, for instance.

Uses for a "Skip If" section:

"Skip If Fuel > 25%" on a refuelling station.
"Skip If Cargo Empty" on stations that need something delivered.
"Skip If Cargo Full" on mines.
Rumsfield
Manual Inserter
Manual Inserter
Posts: 4
Joined: Wed Nov 13, 2019 2:11 am
Contact:

Re: Dynamic train schedule

Post by Rumsfield »

I started to build my first attempt at a rail cell based megabase, and I've come to the conclusion that adding this kind of skip condition per-station in the train schedule would make automating trains a whole lot easier.

The case I have is shown below, where I have a cell for dropping off iron ore (_Sink Iron Ore), a cell for stacking trains (_Stack3) and an external iron deposit for filling up on iron ore (Iron Field 2). I'd like for an arbitrary number of trains to be programmed with the same schedule, and wait in the stack (_Stack3) until any station named _Sink Iron Ore becomes enabled and available. Now, if multiple trains are waiting for an available _Sink Iron Ore, they will all depart the stack and race for the opening. When the station becomes occupied, and there are no other open _Sink Iron Ore stations, they will continue to the Iron Field 2 station to fill up on ore when the train is already full. I'd like for the train to know that it is already full, and have that as a condition to skip the Iron Field 2 station and return back to the stack instead to wait for the next available _Sink Iron Ore station.

Image

Here is what the current train schedule looks like. And below that, I made a mock-up of what the skip conditions could look like, directly under the station name and slightly indented less.

Image

In this mock-up, the train would check the skip condition before pathing to the Iron Field 2 station. If its cargo was already full, it would skip the station and try to find another _Sink Iron Ore, or just return to the stack and wait there.
Image

This is a feature that I believe would not alter train mechanics if players chose not to use it, but would greatly improve the automate-ability of train schedules.
draslin
Burner Inserter
Burner Inserter
Posts: 18
Joined: Thu Nov 14, 2019 2:27 am
Contact:

Re: Dynamic train schedule

Post by draslin »

You know as much as I'd like to see conditional scheduling, I can't imagine how complex it would be to implement in a truly programmatic way. I'd settle for something simpler. The ability to group stations in the GUI and a Condition that waits for the next station or group to be enabled before moving to the next station/group station entry in the schedule.

The group enabled state would handled it's members via an and/or toggle If the group is set to OR, any enabled station marks the group as enabled. Set it to AND and all stations have to be enabled for the group to show enabled. Barring a toggle, I'd prefer OR to AND behavior.

That would give me a lot of control without (I'd like to think) adding a lot of coding for conditions specific only to the train gui or somehow setting up messaging between stations or even more remotely figuring out how to correlate a given station name with a particular condition. This is about where I can go rather than where I should go. So not quite the same thing as a dynamic train schedule, or at least, just one half of it.

I rig my stations to shut them selves off via vanilla circuits if there is enough product stored locally to meet local demand for unloading stations, and for loading stations they turn on when there is enough product cached locally for a full train load. The main frustration I have, is that I also have fueling stations that never shut off, and a home station where the journey starts by waiting for the train to be full or empty first, so I end up looping when all the intermediary stations are disabled.

If I could group all the self regulating stations into a group, and have a condition option for waiting for the next stop (or group of stops) then I'd have quite a lot of control over what a train does next, by controlling whether or not the destination stations are enabled AND how I group them.
mrvn
Smart Inserter
Smart Inserter
Posts: 5860
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Dynamic train schedule

Post by mrvn »

Tekky wrote: Thu Jan 10, 2019 1:05 pm I agree that train entry/skipping conditions would be an important feature.

However, OpenTTD style conditional jump orders may be better, since they allow you to jump to any order in the train's schedule, thereby allowing you to skip several orders at once, instead of only one order per entry/skip condition.
Bugger wrote: Thu Jan 10, 2019 12:07 pm Next anticipation: "the decision should be made at the station and not in the train". I read this several times in the older threads and I think it just doesn't make sense. I can develop further on this in the next posts if someone asks, but I believe the argument is invalid.
I agree that there certainly are situations for when the condition for entering a station should be determined by a train condition and not by a station condition. One such example would be a refueling station.
You run into problems there with stations that are unreachable. A double headed train can only turn around at a station. If mid travel it decides to skip the station and go somewhere else that requires the train to turn around then it is stuck.

For refueling set the skip condition large enough so that the train can always reach the next station and then go refuel.
mrvn
Smart Inserter
Smart Inserter
Posts: 5860
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Dynamic train schedule

Post by mrvn »

Rumsfield wrote: Wed Nov 13, 2019 4:19 am I started to build my first attempt at a rail cell based megabase, and I've come to the conclusion that adding this kind of skip condition per-station in the train schedule would make automating trains a whole lot easier.

The case I have is shown below, where I have a cell for dropping off iron ore (_Sink Iron Ore), a cell for stacking trains (_Stack3) and an external iron deposit for filling up on iron ore (Iron Field 2). I'd like for an arbitrary number of trains to be programmed with the same schedule, and wait in the stack (_Stack3) until any station named _Sink Iron Ore becomes enabled and available. Now, if multiple trains are waiting for an available _Sink Iron Ore, they will all depart the stack and race for the opening. When the station becomes occupied, and there are no other open _Sink Iron Ore stations, they will continue to the Iron Field 2 station to fill up on ore when the train is already full. I'd like for the train to know that it is already full, and have that as a condition to skip the Iron Field 2 station and return back to the stack instead to wait for the next available _Sink Iron Ore station.

Image

Here is what the current train schedule looks like. And below that, I made a mock-up of what the skip conditions could look like, directly under the station name and slightly indented less.

Image

In this mock-up, the train would check the skip condition before pathing to the Iron Field 2 station. If its cargo was already full, it would skip the station and try to find another _Sink Iron Ore, or just return to the stack and wait there.
Image

This is a feature that I believe would not alter train mechanics if players chose not to use it, but would greatly improve the automate-ability of train schedules.
From there it would be only one small step further to a fully programmable schedule. In the "Skip condition" the first entry could be the number of entries to skip showing for example for Iron Field 2: "+2: _Sink Iron Ore". And then allow multiple skip conditions. Maybe call it "conditional Destination".

Note: +2 denotes that it jumps 2 entries down. The name of the station is added for readability. Since a station can appear multiple times in the schedule the name isn't unique enough to be used. The field could have a "+" and "-" button to modify the target.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Dynamic train schedule

Post by ssilk »

I feel like I need to say something about this suggestion:

I think this is a good suggestion, and I would like to have it in the game, but I don’t think it will be implemented. :) (*)

And I think as developer I would try to implement it in a way that is free of literals. This means: “skip next 2 conditions”, the literal is 2. This is like “goto” in programming. Look Google what this means. Instead I would implement it independently from train stations, by adding something like a “Labels” and “conditions” to the train schedules.

Which means it would looke more like this:

Train station 1:
— leave condition
Condition:
— some condition that can include variables from the previous or the next station or conditions in the train.
— target label name if true ( or false)
Trains station 2:
— leave condition
Label:
— label name (autosuggested name by default)
Train station 3:
....

So the change to the current train scheduler is, that it cannot only add stations to the schedule, but also conditions and labels. And the conditions can refer to three entities: the train, the previous station and the next station. The conditions are then not different to those of the schedule (and, or). And they are executed directly before leaving a station (like in the OP).



(*) Reasons:
- there are already some mods that enable dynamic train schedules, and they are completely different to each other.
- I think it adds a lot complexity to the trains, that is not needed in most cases, especially for beginners
- Even if implemented there will be many, that would like to have more features. Or less (e.g. I want just a simple way to add a refuel station if needed).
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
mrvn
Smart Inserter
Smart Inserter
Posts: 5860
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Dynamic train schedule

Post by mrvn »

ssilk wrote: Sat Nov 16, 2019 5:29 am I feel like I need to say something about this suggestion:

I think this is a good suggestion, and I would like to have it in the game, but I don’t think it will be implemented. :) (*)

And I think as developer I would try to implement it in a way that is free of literals. This means: “skip next 2 conditions”, the literal is 2. This is like “goto” in programming. Look Google what this means. Instead I would implement it independently from train stations, by adding something like a “Labels” and “conditions” to the train schedules.

Which means it would looke more like this:

Train station 1:
— leave condition
Condition:
— some condition that can include variables from the previous or the next station or conditions in the train.
— target label name if true ( or false)
Trains station 2:
— leave condition
Label:
— label name (autosuggested name by default)
Train station 3:
....

So the change to the current train scheduler is, that it cannot only add stations to the schedule, but also conditions and labels. And the conditions can refer to three entities: the train, the previous station and the next station. The conditions are then not different to those of the schedule (and, or). And they are executed directly before leaving a station (like in the OP).



(*) Reasons:
- there are already some mods that enable dynamic train schedules, and they are completely different to each other.
- I think it adds a lot complexity to the trains, that is not needed in most cases, especially for beginners
- Even if implemented there will be many, that would like to have more features. Or less (e.g. I want just a simple way to add a refuel station if needed).
It's a GRAPHICAL user interface. So instead of printing "+2" for the goto it could draw an arrow. Just needs some fancy graph drawing stuff to make overlapping gotos look good. But the tech tree already has that, sort of. I'm not convinced labels would be good. Just adds more information in there to confuse the user. But either way, as long as the functionality is there I don't really care how it looks.
User avatar
Qeeet
Inserter
Inserter
Posts: 24
Joined: Mon Jun 10, 2019 11:24 pm
Contact:

Ignore condition for train stops and check fuel

Post by Qeeet »

Can we have a possibility to ignore some train stops if a condition is met? For example, if train has fuel count >1 => ignore a refueling station.
Or if train cargo is full => ignore a next station.
My base is divided into two: oil related stuff and everything else. Oil base produces heavy oil, gas and rocket fuel to deliver to the main base.
I was thinking it would be great to have there a refueling stop, but there is no sense in having each single train to drive through a refueling stop every cycle.
As of now there is no way to read train's fuel count/content.

It would be great to have these in the game.

I am pretty sure it can be implemented easily:
  1. if train has 2 or more stops added to schedule, then there appear an option to add ignore the next station condition
  2. whether to ignore or not the next stop is calculated just after leaving conditions are satisfied on a current stop and before moving to the next one
  3. there should be at least one stop on a schedule which cannot be ignored
And also please add "Fuel item count" condition :)
or "Minimal fuel amount across locomotives"

I've just imagined a situation, where a base suffers temporal fuel shortage, and a train with one or none of fuel items is about to leave a station to a long voyage.
Attachments
factorio_suggestion_ignore_condition.jpg
factorio_suggestion_ignore_condition.jpg (252.7 KiB) Viewed 4796 times
Last edited by Qeeet on Thu May 14, 2020 7:45 am, edited 2 times in total.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Ignore condition for train stops and check fuel

Post by ssilk »

I was near to merging this into
viewtopic.php?f=6&t=64362 Dynamic train schedule

But then I saw you made 2 suggestions. Cannnot discussed well, see viewtopic.php?f=6&t=3394
and
viewtopic.php?f=6&t=47316
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
Qeeet
Inserter
Inserter
Posts: 24
Joined: Mon Jun 10, 2019 11:24 pm
Contact:

Re: Ignore condition for train stops and check fuel

Post by Qeeet »

ssilk wrote: Thu May 14, 2020 5:02 am I was near to merging this into
viewtopic.php?f=6&t=64362 Dynamic train schedule

But then I saw you made 2 suggestions. Cannnot discussed well, see viewtopic.php?f=6&t=3394
and
viewtopic.php?f=6&t=47316
Thank you for pointing to me that first topic. I did search it, but used another key words.

I also have read those two threads before creating new one.

I believe to be able to "program" trains is essential for automation in the base game
User avatar
Qeeet
Inserter
Inserter
Posts: 24
Joined: Mon Jun 10, 2019 11:24 pm
Contact:

Re: Ignore condition for train stops and check fuel

Post by Qeeet »

ssilk wrote: Thu May 14, 2020 5:02 am
I think you can merge those, because on the page 2, there is a suggestion about low fuel condition
User avatar
Qeeet
Inserter
Inserter
Posts: 24
Joined: Mon Jun 10, 2019 11:24 pm
Contact:

Re: Dynamic train schedule

Post by Qeeet »

Rumsfield wrote: Wed Nov 13, 2019 4:19 am In this mock-up, the train would check the skip condition before pathing to the Iron Field 2 station. If its cargo was already full, it would skip the station and try to find another _Sink Iron Ore, or just return to the stack and wait there.
Image

This is a feature that I believe would not alter train mechanics if players chose not to use it, but would greatly improve the automate-ability of train schedules.
+1 to that. I like that mockup a lot. And I believe adding skip condition would remove a lot of train limitations
Post Reply

Return to “Ideas and Suggestions”