[2.0.11] Rail planner sometimes produces impossible rail paths

Things that we don't consider worth fixing at this moment.
AntiBlueQuirk
Long Handed Inserter
Long Handed Inserter
Posts: 71
Joined: Wed May 03, 2017 2:57 pm
Contact:

[2.0.11] Rail planner sometimes produces impossible rail paths

Post by AntiBlueQuirk »

I've noticed that sometimes the rail planner, at least in ghost mode (holding shift) will sometimes produce impossible rail paths, and I've found a particularly bad example.

I'd never want to build the following path anyway, but I'm pretty sure the rail planner shouldn't be suggesting paths that can't actually be built. If you do try to place it, the first half of the ghosts place fine, but the rest just fail to appear where they would overlap with the ramp ghost that now exists.
Screenshot 2024-10-27 151351.png
Screenshot 2024-10-27 151351.png (1.11 MiB) Viewed 640 times
I've attached a minimal save that reproduces the issue in the screenshot. Simply start the rail planner at the right ramp, and while holding shift point it toward the outgoing track on the top side right lane.

I feel like I've noticed this a few other times too, with the rail planner suggesting a path, and then placing it only to find that some of the pieces didn't appear. I figured it was user error, and that was usually corrected by moving supports around, but it might be related. I don't have an example of that, and I might be misremembering anyway.
Attachments
rail planner bug.zip
(1.51 MiB) Downloaded 11 times
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3078
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.11] Rail planner sometimes produces impossible rail paths

Post by boskid »

I know. That is a won't fix.

If i would want to handle those cases nicely, then the rail planner performance would hit the floor. Its primarily caused by the simplifications of the path finding algorithm that assumes that one part of a solution cannot affect other parts of the solution (Optimal substructure) which ramps do not obey. It was either what we have or no planner for elevated rails at all, and because we really wanted to have elevated rails, a decision was made that we will accept those rare unbuildable solution assuming that a player will see solution is invalid and decide not to built it.

(Ref: 120827)
AntiBlueQuirk
Long Handed Inserter
Long Handed Inserter
Posts: 71
Joined: Wed May 03, 2017 2:57 pm
Contact:

Re: [2.0.11] Rail planner sometimes produces impossible rail paths

Post by AntiBlueQuirk »

I had a feeling it might be something like that. Pathfinding is a hard problem. It does only seem to happen when the rail planner is getting really desperate anyway. I'm pretty sure the path I'm trying to solve there doesn't have a good solution. (I've been tweaking this intersection for quite a while.)
AntiBlueQuirk
Long Handed Inserter
Long Handed Inserter
Posts: 71
Joined: Wed May 03, 2017 2:57 pm
Contact:

Re: [2.0.11] Rail planner sometimes produces impossible rail paths

Post by AntiBlueQuirk »

I have an idea. Checking self collision for solutions while pathfinding is not possible for performance reasons, but would it be possible to check the final proposed solution for self collisions? Like, just turn the ghosts red where they would fail to place? That would keep the game from misleading the player about the path being valid, but you'd only need to check collision on one solution instead of every possible one.
untech
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sat Nov 02, 2024 4:05 pm
Contact:

Re: [2.0.11] Rail planner sometimes produces impossible rail paths

Post by untech »

Maybe some popup message will be better than a silent fail? This way, it would look like a deliberate behavior, not a bug.

(Coming from 120827)
Post Reply

Return to “Won't fix.”