mr_fancy_pants wrote: Thu Nov 21, 2019 1:35 am
I'm not sure I understand the question. Factorio already has a pathfinder it can use to reach the waypoints along the way to the final destination, there's no reason it can't use the same pathfinder for the waypoints instead of the final destination.
If you're asking what's the best way to generate the waypoints, that's another question. Taking advantage of the fact that the rail network itself is fairly static, they could be (lazily) generated each time the network changes (adding/removing rails/signals/stations) by running the current pathfinder (ignoring other trains) and picking the rail segment every $n segments away as a waypoint until the destination is reached.
My understanding is that trains need to rerun the pathfinder fairly often (mainly due to other trains that get in the way). If that's true, then any remaining portion of the path that was generated from the previous run but not yet travelled can be considered wasted effort. This wasted effort portion will be larger and larger as train routes get longer and longer, so the waypoints idea is a way to mitigate some of this wasted effort. Even if trains seldom rerun the pathfinder, this should smooth out the rather sharp spikes in UPS that can currently be observed with trains on long routes.
This got me thinking. If you have 10 trains, going from [copper unload] to [copper load], and you have 20-25 [copper load]. Everytime you add a rail, you will ask the game to generate waypoint for 10*25 path right ?
I don't understand how generating waypoint
automagically (sic)

would be less costly than just running the algorithm to the end. Since for even the 1rst waypoint , you need to have the full path calculated, otherwise you might draw a waypoint that leads to a dead end. ( even if you don't end up using it, i wouldn't consider the obsolete path wasted effort ).
for longer trips trains plot a path to an intermediate point that's closer to their destination and then replot when they get (close to) there instead of plotting out the entire path from the get go.
This is like in RTS; units act like that , they start moving even if the destination is out of reach towards a generated waypoint, because else it would give information about defense/blocking units/buildings. There are different behavior when they " realise " they can't reach the end, sometimes go back, sometimes try to go around the obstacle in one direction, circle around, stay as close as possible ... depending on context.
But here a train on track can't adapt. If some waypoint leads to dead-end, the train will need manual intervention. This is avoided when the full path is checked before the trains is allowed to move. Which makes me feel like adding waypoint is something you ask the game to do after the regular pathfinding.
Now if you MANUALLY place the waypoint, it changes everything, the path that is checked before the train starts moving is only a small portion instead of a massive tree with 120232 junctions that leads to 1234324545634 path to reach your destination , ( which is the annoying 60-40-60 UPS behavior ) the pathfinder will have to find a way between like 6 junctions, which can be 256 possibilities ( all made up numbers )and do the same at the next waypoint; this will "cut" the long routes, making UPS smoother.
I'm not sure my reasoning is correct, also i don't know much magic and pathfinding is using some so maybe ! ( biters pathfinding :
https://factorio.com/blog/post/fff-317 )
To try and retrofit such network foor trains i would try to combine 4 cells into 1 by getting rid of the middle cross, or even 6, 8 into 1 when it's away from heavy traffic while keeping the same robotport/power tile-coverage.
Also for such tight grid, in cities it's not uncommon to have them one-way only and alternating, one horizontal lane goes to the left, the next one to the right, etc. This would reduce the complexity of path for the algorithm while maintaining easy access to everywhere. It can be done with or without removing the middle cross on some part. Still without changing the spacing roboport/power. Still a pain given the size of your base i know.
Manual waypoints in such conditions i would use them at the entrance of the base [Entrance Iron 1] [Entrance Iron 2] and so on, before the stacker, and in chokepoint, roughly North, Easth, North East etc... , on each side of track ( Left and Right ), just to cut the long routes , as your mining station have individual name, you'd know that [copper 42] is [North east], the schedule would look like this :[ Copper 42] [North East 1R] [ Copper 1 entrance] [Copper 1 drop ] [ North East 1L]
Using station without waiting conditions and several waypoints, would
possibly allow you to keep every single tracks and signal, while spreading the load over time with few efforts. ( I'd test that first for the low effort , but i'd keep my expectations low ). You got a good test map for sure
