Rail that pathfinding sees as 100 units long instead of 1

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

delassa
Burner Inserter
Burner Inserter
Posts: 13
Joined: Mon Jun 29, 2015 6:35 pm
Contact:

Rail that pathfinding sees as 100 units long instead of 1

Post by delassa »

Basically a "dense" rail you can use that is normal except the path-finding algorithm "sees" it as 100 units long (or a variable length) instead of 1 unit.
Allows much easier control of path-finding selection of routes for trains to travel, as well as easy prevention of trains taking "short-cuts" through stations or sidings they aren't supposed to be on.

Picture example of what could be avoided

Red - Path the train currently takes.
Green - Path I would like the train to take.
Having a piece of rail to make the red path "longer" than it actually is easily remedies this sort of problem.

Image
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by ssilk »

Plug a train stop in, add signals.
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
oLaudix
Filter Inserter
Filter Inserter
Posts: 285
Joined: Sun Jun 14, 2015 3:24 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by oLaudix »

ssilk wrote:Plug a train stop in, add signals.
This is bad solution. I tried it and putting fake train stations slows the trans down as they have to stop on them. OPs idea is much more viable IMHO.

Another way would be to add yet another rail signal, that would work like train stations but wouldnt require trains to stop at it.
Image
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by ssilk »

oLaudix wrote:
ssilk wrote:Plug a train stop in, add signals.
This is bad solution. I tried it and putting fake train stations slows the trans down as they have to stop on them. OPs idea is much more viable IMHO.
A train doesn't has to stop on a trainstop. Only if you put it in the schedule. :)
But it adds points to the pathfinder, if it is on the way. Which leads a train to think, another way is maybe shorter.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
ReijMan
Burner Inserter
Burner Inserter
Posts: 19
Joined: Fri Jul 17, 2015 5:55 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by ReijMan »

Maybe the pathfinding algorithm could be tweaked by having the train factor in how much other tracks he crosses or weighs 'tracks with crossings' more than those don't in the case when distance is almost equal?
ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by ratchetfreak »

adding a more costly track will increase path finding cost for trains that need to go through them. Perhaps a constant cost going through a stop which won't affect path to the stop.

in this solution you can just cut the track that provides the looping part (in particular the bottom left part curving upwards to connect to the main line)
bobucles
Smart Inserter
Smart Inserter
Posts: 1708
Joined: Wed Jun 10, 2015 10:37 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by bobucles »

It sounds more like you're looking for a form of 1-way rail block. Trains traveling against this block would incur a pathing penalty, while trains going the way you want continue happily.
Val
Inserter
Inserter
Posts: 29
Joined: Sun Jul 19, 2015 7:59 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by Val »

A much simpler solution would be to implement waypoints, which could be added like train stops.
Or we could change the train stop so that if we set zero as the time, the train should just drive through without stopping at all.

Much more intuitive than a special piece of rail we later forget about and don't understand why the trains take a weird path. Much easier if you could see the waypoints in the list of train stops.
Last edited by Val on Fri Jul 31, 2015 2:11 pm, edited 1 time in total.
GopherAtl
Fast Inserter
Fast Inserter
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by GopherAtl »

Val wrote:A much simpler solution would be to implement waypoints, which could be added like train stops.
Or we could change the train stop so that if we set zero as the time, the train should just drive through without stopping at all.

Much more intuitive than a special piece of rail we later forget about and don't understand why the trains take a weird path. Much easier if you could see the waypoints in the list if train stops.
The suggested approach is simple to implement and integrate in almost any existing pathfinding system, which is why it's found common use in some contexts, but I agree it's not ideal from a player's perspective. Waypoints could be a solution for many cases; the ability to somehow designate track "station only" could be nice as well. Like, a special kind of signal, paired to one or more stations, that says "can't cross this unless you're headed to one of these stations."
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections
delassa
Burner Inserter
Burner Inserter
Posts: 13
Joined: Mon Jun 29, 2015 6:35 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by delassa »

a waypoint system would work just as well as my suggestion, extra train stops don't seem to be the best solution as that would also fill the list of train stops with "detour around xx" stops or such. As for not being able to remember where such rail has been placed, just making the section of rail a red color or such would make it easily visible.

As for what ssilk said, there is already a train stop it runs through taking the "shortcut" vs the other rail.

As another poster also put, adding a rail section like this is generally very simple to implement while not quite ideal from a player perspective.
User avatar
SHiRKiT
Filter Inserter
Filter Inserter
Posts: 706
Joined: Mon Jul 14, 2014 11:52 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by SHiRKiT »

I'd love to see this and other things like "high-speed tracks" that works like highways for trains, where no trains could stop on those tracks. So I could run a 4 line (2 going 2 going back) everywhere. The middle tracks would be for the train to travel long distances, and it would hop into the outside track when it's close to the station. The actual concept I developed is more complex than this, but you get the point.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by ssilk »

delassa wrote:As for what ssilk said, there is already a train stop it runs through taking the "shortcut" vs the other rail.
No, I said, that placing the train stop is like placing some special kind of signal, that adds waypoints and the train tries to find a "better" way. This is the solution I would prefer. This is a quick fix solution for now.

As I see it there are these two options:

- Having a special entity, that adds a lot of waypoints, so that the trains avoid this way and only drive it, if they really need to go to a station there.
Some kind of static signal, a special rail-type or whatever.

- Having a "waypoint" station, a train-stop, where the trains just need to pass by.
This includes, that the trains need to be (re-)programmed. Which I think it is not needed, cause of the first solution.

But I dunno.


Both can be simulated, the first by placing a train-stop (where the train will not halt) or more signals. I'm not so sure about this. The second by using the train-stop with 0 seconds waiting time (but the train will still stop). I will play around with these options.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
delassa
Burner Inserter
Burner Inserter
Posts: 13
Joined: Mon Jun 29, 2015 6:35 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by delassa »

Let me know what you come up with, I'd be interested to see what kind of temporary solutions can be used to fix the problem for the time being.

Right now the solution I use is just to separate the in/out lines so that the pathway along the "shortcut" isn't continuous which of course keeps the trains from going there.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by ssilk »

I've tested this. There is currently no way to influence the path-finder by placing signals or train-stops.
All what's known about it is here: https://forums.factorio.com/wiki/inde ... th_finding
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Marconos
Filter Inserter
Filter Inserter
Posts: 301
Joined: Mon Jun 02, 2014 10:46 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by Marconos »

I like the concept of setting "rail yard" areas separate from main lines. If we had some way to make a section as a railyard entrance then a train just doesn't route through that section unless it needs a location in that railyard.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by ssilk »

Yes. The easiest way how it could be added yet would be to have a "sign", which adds points to the pathfinder, that then tries to avoid this path.

The extension would be to have three different signs:
- A sign, that subtracts points from the pathfinder, so that he prefers this way, no matter, what's on there.
- A sign, that add points (as above).
- A sign, that adds even more points (so that you can create sub-areas).

I think the first solution is good enough, the second adds too much complexity.

I add also, that it would be in extreme cases a good idea, to have something, that shows, how the pathfinder works. I think to a debug-view and if you hover a train the path-values are drawed on each piece of track.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by ratchetfreak »

ssilk wrote:Yes. The easiest way how it could be added yet would be to have a "sign", which adds points to the pathfinder, that then tries to avoid this path.

The extension would be to have three different signs:
- A sign, that subtracts points from the pathfinder, so that he prefers this way, no matter, what's on there.
- A sign, that add points (as above).
- A sign, that adds even more points (so that you can create sub-areas).

I think the first solution is good enough, the second adds too much complexity.

I add also, that it would be in extreme cases a good idea, to have something, that shows, how the pathfinder works. I think to a debug-view and if you hover a train the path-values are drawed on each piece of track.
Except that A* path finding (which I believe trains use) doesn't quite work with negative path costs. Because the heuristic needs to underestimate the best possible path to goal at all times.

It's much simpler to create a rail/sign that has extra cost though with the danger that paths that need to go through it will waste time exploring paths that it will eventually not take.

optimizations for that are possible: for example keeping a list of stations that are known to need to pass through the sign. (or just stations within X cost)
Tinyboss
Filter Inserter
Filter Inserter
Posts: 467
Joined: Sun Nov 16, 2014 12:11 pm
Contact:

Re: Rail that pathfinding sees as 100 units long instead of 1

Post by Tinyboss »

Would simply adding a pathing penalty to every train stop fix most of this? If you're going to that stop, you don't care what the penalty is; that's your destination so you have to go there. But if you're just on your way to somewhere else, it might be faster to go around.
Post Reply

Return to “Ideas and Suggestions”