Page 1 of 1

Add item to define train pathfinding penalty for a railway / Set rail signal penalty from circuit network

Posted: Fri Feb 19, 2016 12:57 am
by o6dukeleto
The item added could be another type signal, or a sign that goes beside the rail track. Possibly a "slow" sign which indicates to the train pathfinding that this track should have a penalty when being evaluated.

The new item could be clickable and a "penalty" could be entered by the user.

This would be a fairly simple way to affect the existing train pathfinding as it already dynamically calculates penalties for some things (https://forums.factorio.com/forum/vie ... lty#p63247)

This new item could also be ignored if the complexity is not required, similar to signals and chain signals.

This would allow users to do such things as:

Example 1: A siding to a mainline that trains will never path through, just add the new item with a very large penalty. (The example siding may/may not have a station with trains that stop frequently/infrequently.)

Example 2: A central unloading hub with 3 parallel stations with the same name. Normally the trains will prioritize the shortest path which may not be the path closest to your factory, but with judicial use of penalties you could make it prioritize the path closest to your factory. (possibly so your robots have shorter paths?)

There are probably more examples as well and this new item would allow us to affect train pathfinding -- if we wanted it.

BTW, I created this suggestion based upon some great feedback on another suggestion I made (https://forums.factorio.com/forum/vie ... =6&t=20037) I feel that this suggestion is probably simpler and allows for more options in affecting train pathfinding, the new item could also be ignored if the complexity is not required -- therefore adding complexity only for those who want it.

Re: Add item to define train pathfinding penalty for a railway

Posted: Sat Apr 02, 2016 1:07 pm
by Khaylain
I support this. A track control Signal with a variable pathfinding penalty, able to be placed like a Train Signal or Train Chain Signal.
Maybe it needs the condition that for it to work it needs a Train Signal or Train Chain Signal in front and behind it. Would be really useful for a turnaround station for loading iron/copper/coal which you don't want trains NOT inbound to the station to use. This would make the other trains take a longer route to another turnaround, and may help avoid some deadlocks/slowdown.

Re: Add item to define train pathfinding penalty for a railway

Posted: Sat Apr 02, 2016 11:08 pm
by ssilk
Meanwhile there is a list: viewtopic.php?f=80&t=21899 Control Train Pathfinder (Passthru stations, Add Penalty)

Re: Add item to define train pathfinding penalty for a railway

Posted: Sun Apr 03, 2016 3:14 am
by Khaylain
That list is exactly where I found the link to this. As far as I have understood the premise of this forum it was better to use the single-item/-idea threads rather than the list-threads.

Re: Add item to define train pathfinding penalty for a railway

Posted: Sun Apr 03, 2016 11:06 am
by ssilk
Yes, you did nothing wrong. :)

I mentioned it no only for you, but for others, that want to answer to your post and didn't make a search. :)

Train pathfinding penalty signal

Posted: Thu Feb 11, 2021 10:48 pm
by blazespinnaker
Ok, last suggestion for awhile. They will all probably never get implemented, but maybe at least we could get mod apis in the area.

It'd be cool to have a signal which can be used to set a pathfinding penalty on a segment of rail, powered by a combinator. Really help with managing throughput.

Right now I'm just dotting rails with train stops, but it doesn't look very esthetic.

Yes, it's possible to restructure the rails, but getting throughput with dense traffic is tricky and adding soft penalties is surprisingly effective and simplifying.

Re: Add item to define train pathfinding penalty for a railway

Posted: Fri Feb 12, 2021 6:08 am
by ssilk
merged with older topic

Re: Train pathfinding penalty signal

Posted: Fri Feb 12, 2021 4:25 pm
by ptx0
blazespinnaker wrote:
Thu Feb 11, 2021 10:48 pm
Ok, last suggestion for awhile. They will all probably never get implemented, but maybe at least we could get mod apis in the area.

It'd be cool to have a signal which can be used to set a pathfinding penalty on a segment of rail, powered by a combinator. Really help with managing throughput.

Right now I'm just dotting rails with train stops, but it doesn't look very esthetic.

Yes, it's possible to restructure the rails, but getting throughput with dense traffic is tricky and adding soft penalties is surprisingly effective and simplifying.
close the signal with circuit. that's a hefty penalty.

Re: Add item to define train pathfinding penalty for a railway

Posted: Sat Feb 13, 2021 9:18 am
by ssilk
I think the point of this is, that you can define “preferred” paths/stops. Or “main lines”. Or - seen from the other side - you can avoid paths, and stops.

Seen from game-play: with one sign you can ruin your whole train-routing or fix it. I personally like it, big fan of this, but the fact that you can break things with it, is a problem, because I think most players are not able to see, what would happen, if you add penalty at this point.

So I think: this needs a feature, where the player can simulate, how trains are going.

What does such an simulator do? I don’t know exactly, but I have a vague idea: The simulator just takes all existing trains and their routes, and simulates, how much traffic is going over which rail. Many traffic: rails are red, low traffic: rails are green. I don’t want to go deeper into that here, because it is essentially an own suggestion.

Re: Add item to define train pathfinding penalty for a railway

Posted: Sat Feb 13, 2021 10:30 am
by blazespinnaker
I actually retract this feature request on my part. It was a function of my frustration on managing throughput on short trains. I'm starting to realize now that huge overhauls to the train pathing in Factorio are going to be required to make heavy traffic work.

So, I basically think I'm going about this all wrong, and am going to look at longer trains. As I think more, play with designs, and do some reading IRL on trains, I see the obvious benefits, and very long trains work perfectly well in Factorio. Critically, they obviate any complex pathing mechanisms that Factorio certainly doesn't support today.

Re: Add item to define train pathfinding penalty for a railway

Posted: Sun Feb 14, 2021 8:02 am
by ssilk
Can’t understand that. :) I have worlds with over 300 trains on the way, and they work perfect. (And if not, I know what to change. :D )

Edit the next two paragraphs accidentally (don’t ask :roll: ):

That’s heavy traffic: if you have tracks with a steady stream of 20 trains per minute, crossing with another track of 20 trains per minute.

That is of course quite labil. It could be, that 21 trains/min is one too much and it deadlocks within minutes with over 100 trains.
So I would appreciate this feature a lot, especially when I can add the penalty over circuits, like in viewtopic.php?f=80&t=21899 Control Train Pathfinder (Passthru stations, Add Penalty, Control Refueling) and the good parts of viewtopic.php?f=6&t=90836 Train Filter Signs

It would enable me to route the trains on heavy traffic around the problem. Or enable me, that in this case the trains come only from one direction, but if it’s free, they can use both directions. And so on.

Because the router does a good job, routing trains around heavy traffic, but I need it very good.

Set rail signal penalty from circuit network

Posted: Thu Oct 06, 2022 7:24 pm
by mrtux
TL;DR
Allow the signal penalty used in train path finding to be set from a condition (amount of X) on a circuit connection.

What ?
It is already possible to switch a signal to red from the circuit network. I would like to be able to also set the penalty this red signal incurs on train path finding.

An additional (tier-2 update) could be to generally set the signal's penalty, so that there can also be less preferred paths along green signals, allowing for even more fine-tuning.

This could look similar to the way a train limit is set on stations via circuit network.
Why ?
I got this idea from a situation where I needed a much higher penalty for a red signal. When I searched for solutions I found multiple threads of people wanting more control to fine-tune priority systems etc.

In the spirit of Factorio this is a very basic and simple feature that allows much more complex builds.

Implementation considerations
I agree that setting static priorities is not very accessible, as these are not visible and might confuse new players. (Saw some discussions about those for train stations.)

However, doing this via the circuit network is visible (there is a cable connected) and people who do this already go down that rabbit hole, so it is less confusing for the newbies. The player chose to put the red wire, so it's on them. :mrgreen:

The path finding would need to get the penalty from the signal instead of just the "red" state. (Ofc thinking this without knowing anything about the implementation.)

Re: Add item to define train pathfinding penalty for a railway / Set rail signal penalty from circuit network

Posted: Wed Oct 12, 2022 5:59 am
by ssilk
merged with older thread

You can do this currently by adding stations and switches to force some kind of path through (unused, only there for adding penalty) stations.

See also
viewtopic.php?f=80&t=21899 Control Train Pathfinder (Passthru stations, Add Penalty, Control Refueling)
— which is an overview topic — and
viewtopic.php?f=6&t=85260 Modify train pathfinding penalty/heuristic of stations

I point also to the very similar idea from
viewtopic.php?f=6&t=90836 Train Filter Signs
which is in its core identical, but has added logic for trains (changes during discussion!)

Mods:
https://mods.factorio.com/mod/trainpath-tweaker2 (change penalty values)