Page 1 of 1
Balancing railway tracks? or fast track & slow track?
Posted: Tue Nov 03, 2015 4:20 pm
by mazetar
Is there any simple way to balance the load on a track with two lanes (or more) in the same direction, so that a faster train would be able to switch lanes back and forth to "zig-zag" past slower trains.
Re: Balancing railway tracks? or fast track & slow track?
Posted: Thu Nov 05, 2015 11:42 am
by ssilk
AFAIK not yet.
But a change seems to be simple:
A) we need a new element, like a new signal type, that avoids a path because it adds a high number of waypoints to the train path finding algorithm.
B) we need a new element, like a new track type, that prefers a path because it adds less waypoints to the path finding algorithm than a normal track.
(In my opinion A is easier and better understandable)
Re: Balancing railway tracks? or fast track & slow track?
Posted: Sat Nov 07, 2015 1:18 pm
by -root
ssilk wrote:AFAIK not yet.
Are you sure?
Basically, with a four lane track (two inbound, two outbound), so long as you have a cross over between the two lanes, trains will pick the "faster" lane. I believe the A* pathfinding accounts for trains in the way. I've asked Hanziq (resident train guy), hopefully he can illuminate the situation.
This statement is based upon observational evidence. I've seen trains over take slower trains. This might confirmation bias though
Re: Balancing railway tracks? or fast track & slow track?
Posted: Sat Nov 07, 2015 3:06 pm
by ccik
i have seen faster trains overtaking slower trains as well, but as far as i know, there is no way of controlling this behaviour. The only thing i could manage to do is to encourage it. I do this with a bigger signal spacing and crossovers at every signal.
If a fast train is getting close to a slow one, the block ahead will be blocked. The fast train will then switch to the other track, and possibly overtake it, or at least drive parallel and does not stop. Although with increased block distances, you reduce your train throughput, and this also leads to trains switching tracks very often.
Re: Balancing railway tracks? or fast track & slow track?
Posted: Sat Nov 07, 2015 11:43 pm
by -root
I heard back from Hanziq. He's the guy that looks after the trains in Factorio.
Basically, the path finding does look ahead and will avoid trains in front of it. But it can't tell if they are moving fast or slow. To answer your question, you can force a balancing of the track lines through crossovers at regular intervals.
Re: Balancing railway tracks? or fast track & slow track?
Posted: Sun Nov 08, 2015 2:06 pm
by ssilk
I thought a bit into this and it would make no sense to have these parameters included into train path calculation
(these are "suggestions", so a bit off-topic, but when I'm just on it...). I have them just from my watching about the rail traffic (and I really had built hundred of kilometers of rails now):
- of course the track-length. That is already included.
- occupied blocks (already done, it's a more or less complex calculation)
- unoccupied train stops should add a low number of points to the calculation, so that normally a train tries to avoid this path, if there are two paths with equal length.
- occupied train stops should add much more count, cause you don't know when the train leaves.
- it should also count as occupied, if there is already a train, that WANT to go to a train stop (the number of trains should be multiplied or so). I think this is very important!
- still standing trains (before signals, not stations). Cause it's unknown how long they will stand still and they take a while to accelerate.
- speed-difference of trains on my current track (including myself). The more equal the trains on a track can go, the better.
- total speed of trains on my track (the faster, the better), a bit similar to the previous, but not equal, cause it can be much better to go the slower path, if the trains all drive at the same speed.
- number of switches. The less switches the better, but it should be only a slight difference if the tracks have equal length.
I also thought about elements to modify this path-finding as described above and I think the right way is only to add elements, that add points to the path-finder. Like a special type of signal that - let's say - adds 10000 points to the path-finder. So a train will normally never go that way, only when there is no other path. The reason for this is, that it is much easier to handle than rail tracks, that prefer a path be subtraction of track-points; a signal can just be removed, but track needs to be replaced with a different. Or better: I believe it makes only sense if that tracks behaves different, like that the curves are wider. And it enables also a faster end-speed etc. so that this track is REALLY faster.
Re: Balancing railway tracks? or fast track & slow track?
Posted: Sun Nov 08, 2015 2:25 pm
by sillyfly
This thread:
https://forums.factorio.com/forum/vie ... f=6&t=7346 has a lot of valuable discussion (at least in my opinion), even though some of it is by now obsolete due to changed made to the pathfinding algorithms since (Also, most of it was before chain signals).
I fully support allowing the player to directly influence pathing weight, preferably by an entity similar to a signal which adds some amount of penalty (or takes it away) from the segment it is connected to.
Even if this is only allowed in technically, and such entities are only provided by mods, I think it could add a lot of control without making the system to hard to understand/maintain.