(A way to) Make trains check collision masks of rail segments when pathfinding

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Osmo
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

(A way to) Make trains check collision masks of rail segments when pathfinding

Post by Osmo »

Currently trains do collide with rails if they share a collision mask, however they ignore it when pathfinding, resulting in trains trying to go over rails, colliding and destroying such rails and getting stuck. If there was a way to make trains consider the collision mask of the rail segments and try to find a different path if current path contains rails the train collides with, this would allow for more complex train behaviours that aren't feasible otherwise.
For example, this would allow mods to make high-speed trains that can only travel on high-speed rails, in the same network with regular trains that can travel on both types of rails. Currently, high speed trains could attempt going over regular rails resulting in getting stuck.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15879
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: (A way to) Make trains check collision masks of rail segments when pathfinding

Post by Rseding91 »

That... is interesting. It makes me wonder if I can change them to *not* check collision against rails and see how it impacts performance in train heavy saves.

Depending on how that goes, it might go the opposite of your request and simply disable that collision checking completely.
If you want to get ahold of me I'm almost always on Discord.
Osmo
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

Re: (A way to) Make trains check collision masks of rail segments when pathfinding

Post by Osmo »

Rseding91 wrote: Wed Apr 02, 2025 12:29 am Depending on how that goes, it might go the opposite of your request and simply disable that collision checking completely.
That is a good idea if it saves UPS, however the two ideas aren't mutually exclusive, as if they will check collision when pathfinding they won't have to do it when actually moving anyway. I understand it might be worse for for UPS overall, but you probably know better than me if that's the case.
Post Reply

Return to “Modding interface requests”