Page 1 of 1

Let us restrict the number of trains a train stop can accept

Posted: Mon Feb 06, 2017 8:31 pm
by GrayMage
Hi.

I've been playing this great game for a while now, and in my last game I've tried to implement an on-demand resource supply system.
The idea is really simple: all loading train stops share the name of resource it provides ("Iron", "Copper", "Oil", etc). Trains are waiting at circuit-controlled semaphore in some sort of a stacker and they leave it only if the factory needs resources. Once a resource drops bellow certain amount, the semaphore turns green, and the train chooses one of the resource providing train stops (which opens it's entrance semaphore only when it has enough resource stored in it's chests), goes there, picks up the resource, comes back to unloading station and finally goes to train stacker.
The problem: when stacker opens it's semaphore, all waiting trains go to the same loading station even if that station can supply only one train (which is common for oil outposts).
Possible solution: let us restrict the number of trains a train stop can accept. I'd like to send a signal to train stop which would say it to accept only specified amount of trains. If train stop is not connected to circuit network it can accept unlimited number of trains (default behavior). Otherwise train stop is visible to the specified number of trains (which can already be enroute to this train stop) and is not (disabled) for all other trains.

Thanks :-)

Re: Let us restrict the number of trains a train stop can accept

Posted: Mon Feb 06, 2017 8:32 pm
by GrayMage
I've actually implemented this train stop behavior using the pdb file, which comes along with factorio executable and made this video..

I could share the source code of my DLL implementing this behavior but I need explicit permission from devs to do so.

Re: Let us restrict the number of trains a train stop can accept

Posted: Mon Feb 06, 2017 11:20 pm
by ssilk

Re: Let us restrict the number of trains a train stop can accept

Posted: Tue Feb 07, 2017 4:24 pm
by metacreamy
Logistic Train Network is nice mod but it sticks us with predefined logistic and schedules.
Its just turn trains in some kind of high capacity drones.
While with proposed solution and logic network we could create greater variety of way to ruin everything deliver goods.
For example using Logistic Train Network is hard to organize warehouse avoiding direct delivery from deposit and almost impossible to prevent empty trains going between exchanging stations.

It would be cool to have such mod allowing to restrict number of trains simultaneously going to station by sending logic signal but unfortunately afaik mod api doesn't capable to that kind of things.
I hope 0.15 train stop disabling will work this way ;)

Re: Let us restrict the number of trains a train stop can accept

Posted: Tue Feb 07, 2017 5:44 pm
by ssilk
metacreamy wrote:Logistic Train Network is nice mod but it sticks us with predefined logistic and schedules.
And this suggestion does not? Or what? ;)

Well, I think you are wrong here.

Right target is viewforum.php?f=28 Modding interface requests
or the already mentioned thread about Logistic Train Network Mod.

Re: Let us restrict the number of trains a train stop can accept

Posted: Tue Feb 07, 2017 8:20 pm
by Rseding91
GrayMage wrote:I've actually implemented this train stop behavior using the pdb file, which comes along with factorio executable and made this video..

I could share the source code of my DLL implementing this behavior but I need explicit permission from devs to do so.
I'd be interested in seeing what ever code you've managed to create :)

Re: Let us restrict the number of trains a train stop can accept

Posted: Wed Feb 08, 2017 11:21 pm
by GrayMage
Rseding91 wrote:I'd be interested in seeing what ever code you've managed to create :)
So can I treat those words as explicit permission to post my code on Github? ;)

Re: Let us restrict the number of trains a train stop can accept

Posted: Wed Feb 08, 2017 11:30 pm
by posila
GrayMage wrote:So can I treat those words as explicit permission to post my code on Github? ;)
Yes, you can :)

Re: Let us restrict the number of trains a train stop can accept

Posted: Sun Feb 12, 2017 11:05 pm
by GrayMage
Uhh... I finally managed to post the source code on GitHub. Here. Test maps included. Hope you guys will have a look at what I've done and consider implementing this in future release. :P

Re: Let us restrict the number of trains a train stop can accept

Posted: Sun Feb 12, 2017 11:37 pm
by posila
Twinsen said he already did it in 0.15, but I haven't checked

Re: Let us restrict the number of trains a train stop can accept

Posted: Sun Feb 12, 2017 11:39 pm
by GrayMage
Yay! Can't wait. Thank you. :D

Re: Let us restrict the number of trains a train stop can accept

Posted: Sat Jul 27, 2019 10:58 pm
by waduk
Are these feature is still on the line ?
I really wish this feature.
Recently i've been playing with Concurrent Train Restriction mod,
https://mods.factorio.com/mod/Concurren ... estriction
And i can't help but amazed how simple yet powerful this train restriction feature are, this really should be in vanilla.

It solves many "problem" with various train mod, in some part of of it, all of them still requiring us to naming train stop with unique identifier (Coal1, Coal2, Iron1, Iron2, etc)

But this mod, is working EXACTLY just as the original suggestion, it doesn't need a unique identifier.
All train stop that have same purpose can share a same name.
And it's so very simple to setup, can even dynamically adjust number of train (based on supplied signal)

The only problem with this mod, well, the author rarely active, so it crash often under certain circumstances.

Re: Let us restrict the number of trains a train stop can accept

Posted: Mon Jul 29, 2019 3:55 pm
by Darinth
Huh. Another thread with this idea, though this one has an interesting detail that it looks like this was a feature that was supposed to be in 0.15. I wonder what happened. o.O

Re: Let us restrict the number of trains a train stop can accept

Posted: Mon Nov 27, 2023 2:32 pm
by Bilka
This was added in 1.1.