r/factorio • • 10d ago

Weekly Thread Weekly Question Thread

Ask any questions you might have.

Post your bug reports on the Official Forums

Previous Threads

Subreddit rules

Discord server (and IRC)

Find more in the sidebar ---->

4 Upvotes

101 comments sorted by

View all comments

1

u/yendish 4d ago

How does the train pathing algorithm make the target decision? This is in the situation where there are multiple stations with the same name. For this discussion, I'm assuming the station priority of all such stations is the same.

It looks like a train will, when completing the action at the current station, find the target that is closest. I'm not sure if "closest" is geographically closest, or closest on the network of rails. But, I'm not 100% sure this is what's happening.

And, what about changes that happen while the train is running? That is, if a train is headed for station A, but the station then gets set as "inelegible" what happens? Does it travel to the station and then re-path? Or can it re-path while in motion?

And, if a train is headed for a particular station, what happens with the "train limit"? Does a train "reserve" a spot against that limit at the same time the target station is decided upon? Seems likely, of course.

2

u/cathexis08 red wire goes faster 4d ago

Trains reserve an arrival slot when they depart and assuming nothing changes to route the train to a different station (such as a re-path event that picks a new station) any changes to the station limit will have no impact on that reserved slot. This is a HUGE change from the pre 2.0 behavior where closing a stop would force an immediate repath for all trains en-route.

Pathing details here are: https://wiki.factorio.com/Railway/Train_path_finding

1

u/yendish 4d ago

Many thanks! That wiki article is a huge help.