Train pathfinding not updating

Bugs that are actually features.
Post Reply
GhostPirate
Burner Inserter
Burner Inserter
Posts: 18
Joined: Fri Dec 28, 2018 4:55 pm
Contact:

Train pathfinding not updating

Post by GhostPirate »

Apologies if this has been posted, I've searched but there are quite a few posts on trains, and I couldn't find anything quite like this.

Blueprint: https://pastebin.com/ms2gsKEZ

I believe I have identified a train pathfinding bug:
- A train is in a smelting array, but it is empty. It cannot leave due to the next block not being free. Other stations in the smelting array are free.
20190729224134_1.jpg
20190729224134_1.jpg (476.46 KiB) Viewed 1259 times
- A train is in the mining array, and it is full. It is trying to path to a smelting station.
20190729224142_1.jpg
20190729224142_1.jpg (711.48 KiB) Viewed 1259 times
Expected behavior:
- Train full of ore will correctly path to an open smelting station.

Actual behavior:
- Train does not path to an open station, instead preferring to sit and wait for the train to leave the first smelting station.
20190729224209_1.jpg
20190729224209_1.jpg (486.95 KiB) Viewed 1259 times
I believe the bug lies in the pathfinding code that relies on time that a train has spent stopped at a signal:
https://wiki.factorio.com/Railway/Train_path_finding wrote:When the path includes a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.


When you place a rail signal somewhere behind the station, such that it is pre-occupied by the train, then everything works as intended.
20190729224311_1.jpg
20190729224311_1.jpg (753.02 KiB) Viewed 1259 times
Attachments
Train Problems.zip
(3.09 MiB) Downloaded 58 times
factorio-current - copper mine.log
(5.01 KiB) Downloaded 66 times

Loewchen
Global Moderator
Global Moderator
Posts: 8308
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: Train pathfinding not updating

Post by Loewchen »

This is working correctly, you need to make all stations equally attractive or build more compact setups to prevent that behaviour. NaB.

GhostPirate
Burner Inserter
Burner Inserter
Posts: 18
Joined: Fri Dec 28, 2018 4:55 pm
Contact:

Re: Train pathfinding not updating

Post by GhostPirate »

I'm pretty sure there is a bug here. I've simplified the train network considerably to demonstrate the behavior.

Blueprint: https://pastebin.com/PngghZ3t

1. A train is waiting at the "Ore Load" station. It wants to go to an Ore Unload station. There are three available: Two are nearby, and one is further away.
20190730233053_1.jpg
20190730233053_1.jpg (348.32 KiB) Viewed 1206 times
2. The two nearby "Ore Unload" stations are occupied. The train trying to leave the "Ore Load" station is frozen, and will never move.
20190730233119_1.jpg
20190730233119_1.jpg (555.72 KiB) Viewed 1206 times
3a. Now delete the disconnected "Ore Load" station. Now the train moves.
20190730233133_1.jpg
20190730233133_1.jpg (614.04 KiB) Viewed 1206 times
3b. Re-place that station, and instead connect the broken curve. The train will path to that station, despite only being 2 tiles closer.
20190730233140_1.jpg
20190730233140_1.jpg (658.84 KiB) Viewed 1206 times
Save attached.
Attachments
Train Problems Problem Exists.zip
(3.01 MiB) Downloaded 102 times

Post Reply

Return to “Not a bug”