Page 1 of 1

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

Posted: Wed Mar 26, 2025 5:46 pm
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.

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

Posted: Wed Apr 02, 2025 12:29 am
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.

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

Posted: Thu Apr 10, 2025 1:42 am
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.