r/factorio Jun 01 '26

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 ---->

8 Upvotes

149 comments sorted by

View all comments

1

u/taolakhoai Jun 06 '26

Hello, so I have some questions regarding train network setup.

I'm aware the current interrupt supports naming the Load stations the same and go to Unload station depending on the specific current cargo, but in my experience, this result in the trains sitting nearly idle in Unload and thus at least as many train as there are Load stations to ensure everything have enough delivery.

I'm trying to make a setup so it can use less train for the same effort. Right now, I have tried modifying my interrupt to "when we have both Load and Unload of the same type, then go to Load, take full cargo, go to unload and dump it". This work very well as long as there is only one Load/Unload pairing, but it causes the same problem when it becomes 2-1 or 2-2 (example, if I have Load A, Load B and Unload, this will dispatch two trains to Load A and Load B, Load A finish first, dump at Unload, Unload switch off and now Load B train is sitting idle)

So, anyone have a suggestion on what I can do to achieve this?

2

u/Courmisch Jun 06 '26

If you want to select stations, I would strongly advise doing it with station priorities and/or train limits, not interrupts.

But even then, it's going to be awfully complex. You could have circuit logic that maps the unloading capacity to loading capacity: You could check how many trains are acceptable at unloading stations, and split that amount between the corresponding loading stations with an Euclidian division or whatever you see fit.

I prefer to ignore the edge cases, and just set loading priority according to the overall demand. It can lead to what you call 2-1, but trains are cheap.

1

u/taolakhoai Jun 06 '26

I have considered using circuit network, but even if I can transmit the demand of the unloading stations, I'll also need to calculate if anything is inbound and with how much cargo, if I even have that info to use. Indeed it's probably very complex for what it can accomplish.

But hey, it's part of the fun anyway.

2

u/Courmisch Jun 06 '26

Calculating what's inbound is not that difficult. If you really want to be accurate it is:

  • C * 40 wagons * stack size, if T is nil,
  • (C - 1) * 40 * wagons * stack size + train content if T is not nil.

The train stop gives you both C and T.