Trying to solve train pathing problem

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
sollus
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Jan 03, 2022 1:34 am
Contact:

Trying to solve train pathing problem

Post by sollus »

I have a grid setup where - out of multiple trains awaiting for same destination to free up - trains from further(much futher) away are being prioritized over those which are closer. I am trying to understand the reason why this happens. I do not think its down to path costs

hope someone can help with this - if more info needed let me know.

https://www.reddit.com/r/factorio/comme ... ath_costs/

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 1669
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Trying to solve train pathing problem

Post by boskid »

In general i was not considering strong integration between enable/disable of train stop and train stop limits, lets say i am considering the "enable/disable" to be an early workaround when the train stop limits were not yet implemented. This has some effects related to train repathing order.

There is one tiny heuristic related to train repathing order which works when a count of reservations on a train stop changes or when a limit on a train stop changes: in that case i have a list of all trains that want to arrive to given train stop so i can sort them by their striaght-line distance so a train which is the closest one will repath first and most likely will acquire the reservation making it work as the "closest train first".

In case when a train stop is enabled while it has a limit, technically there are no trains yet that want to arrive here but they are just waiting at previous schedule record. I would have to have some extra checks to find all the trains that would want to go to given train stop after the train stop was enabled by circuit condition. Because this logic is not implemented, when a train stop is enabled, trains will repath in their natural order (train ID order) so a train which is far away may repath first, take the reservation and prevent any trains that are closer from obtaining the reservation.

Standard solution is to not disable train stops but use decider combinator to set L=0 when no new trains are expected and L=1 when one train is expected.

sollus
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Jan 03, 2022 1:34 am
Contact:

Re: Trying to solve train pathing problem

Post by sollus »

Thank you this is most useful in understanding the problem, appreciate the quick reply.

Now I have to update 1.2k train stations.

Any chance of modifying the upgrade planner so it can do a pattern replace ie when entities in 5x5 layout match defined blueprint - replace it with this blueprint instead? ;)

Post Reply

Return to “Gameplay Help”