Rail Signal Planner


[QoL] Automatically place rail signals on rails and intersections.

Utilities
1 year, 2 months ago
0.17 - 1.1
20.2K
Logistics Trains

g Performance Opportunities

4 years ago

Awesome mod! Wanting to use it on a large megabase, running 12-24 trains, but when I try to use tool on one of the outposts, the response time to the tool is measured in minutes... Any thoughts on being able to speed up the mod a bit?

Thanks for your work!

4 years ago

Also, dang... Make sure your trains aren't running when you do this! My signals were destroyed before placed, and... well... Just glad they were copper plate trains and not science trains!

4 years ago

It took minutes just for a single outpost? Can I have a picture of that rail system (or a savefile to the base)?
I'm curious where the bottleneck lies. Right now I can't really think of any significant improvements, I thought the algorithm was a O(n) algorithm; twice the rails takes twice the time. But I can be wrong in that.
Does it take just as long when setting it to smaller trains? Helps me pinpoint the problem a bit more.

It was never really intended to be used on the whole rails in one go. But obviously I can't stop people from doing that, and it does work perfectly fine.

And yes, since it marks some signals for deconstruction you do have the risk of trains crashing into each other.

4 years ago

I'll get you more - the base is... Huge... I also found a stack overflow at some point... That's coming...

4 years ago

The mod Rail Signal Planner caused a non-recoverable error.
Please report this error to the mod author.

Error while running event RailSignalPlanner::on_player_selected_area (ID 49)
RailSignalPlanner/scripts/utility.lua:3: stack overflow
stack traceback:
RailSignalPlanner/scripts/utility.lua:3: in function 'contains'
RailSignalPlanner/scripts/create_signal_chain.lua:36: in function 'link_signals'
RailSignalPlanner/scripts/create_signal_chain.lua:61: in function 'connect_rail'
RailSignalPlanner/scripts/create_signal_chain.lua:78: in function 'connect_rail'
RailSignalPlanner/scripts/create_signal_chain.lua:78: in function 'connect_rail'
RailSignalPlanner/scripts/create_signal_chain.lua:78: in function 'connect_rail'
RailSignalPlanner/scripts/create_signal_chain.lua:78: in function 'connect_rail'
RailSignalPlanner/scripts/create_signal_chain.lua:78: in function 'connect_rail'
RailSignalPlanner/scripts/create_signal_chain.lua:78: in function 'connect_rail'
RailSignalPlanner/scripts/create_signal_chain.lua:78: in function 'connect_rail'
...
RailSignalPlanner/scripts/create_signal_chain.lua:90: in function 'connect_rail'
RailSignalPlanner/scripts/create_signal_chain.lua:90: in function 'connect_rail'
RailSignalPlanner/scripts/create_signal_chain.lua:90: in function 'connect_rail'
RailSignalPlanner/scripts/create_signal_chain.lua:90: in function 'connect_rail'
RailSignalPlanner/scripts/create_signal_chain.lua:90: in function 'connect_rail'
RailSignalPlanner/scripts/create_signal_chain.lua:90: in function 'connect_rail'
RailSignalPlanner/scripts/create_signal_chain.lua:78: in function 'connect_rail'
RailSignalPlanner/scripts/create_signal_chain.lua:107: in function 'init_signals'
RailSignalPlanner/scripts/create_signal_chain.lua:136: in function 'build_graph'
RailSignalPlanner/control.lua:25: in function 'on_player_selected_area'
RailSignalPlanner/control.lua:38: in function <RailSignalPlanner/control.lua:37>

4 years ago

Achieved by trying to signal 316k rails that contained 13k signals...
Save file on TransferNow (146MB). If you want a different site / method, I'm happy to go that route.
https://transfernow.net/ddl/TSingeFactorioSaveGame
Any tips on how to break things up and do smaller chunks? The signals at the edges of a selection can sometimes be non-ideal...

4 years ago

Right.. and each rail has 4 possible places a signal can be, creating a list with a length of about 1 million.

Best is to just signal intersection by intersection.
The stack overflow is interesting. Within that function I can probably get away with not doing it recursively, but not sure elsewhere.

Simplest fix for me would be just to not allow people to use it on 10000 tracks or more or so.

Thanks for the savefile, I'll have a look at it when I got some time

4 years ago
(updated 4 years ago)

So, doing a chunk by chunk leaves ambiguity at the edges. Not sure if it's possible, but an option to allow you to decide whether the "edges" of the selection should be signaled (or not) would be helpful. In my case, my factory is somewhat modular. I'd like to signal a module at a time, but the signals between modules are always incorrect. It puts in Rail Signals when I want Chain Signals (because the next junction is just too close)...

Each of these modules has between 30k and 50k rails. Using a rail bus of 8 rails in each direction...

You'll see I'm currently trying to drain the factory of trains so that I can do the rail upgrade. (Too many crashes otherwise).

4 years ago

71k rails is taking over 3 hours.

Again, if there's something that can be done, great... At this point, just providing you with data points.

New response