Number of switches an AI train will throw?


Coconut God
Wonder if anyone has investigated this - set up a double to single to double track configuration with opposing traffic, the northbound AI will stop at the last signal guarding the single track section, experimentally flipping switches until it finds a path to the next trackmark and a clear or approach signal. When two opposing trains arrive at opposite ends simultaneously they'll sometimes fight for control of both switches for a while, but eventually the standoff ends.

Main problem is when the single track section has one or more switches coming off of it - placing intermediate signals doesn't work very well, because then you get a situation where neither train has a stop indication, both enter the single track section from opposite ends and meet in the middle with a stalemate at the last red signal. I've found that 2 or 3 switches are okay, an AI train approaching from either end will play around with several switches set the wrong way until the correct path is found. Phil Skene had a "shut the door behind you" philosophy for the player, after passing a switch that you had to throw you should throw it back the way it was so the AI doesn't get lost or confused, but I found that wasn't actually necessary in TRS2009 and later.

This latest experiment has a single track section only one baseboard long, but it's an industrial district with 10 spurs coming off the single track mainline, and even with all 10 switches set for the main the AI will not throw the 11th switch back to double track. So I suspect I'm gonna need to fool around with trigger multiple signals and place some intermediate trackmarks and/or signals in the single track section.

So, question is - how does the AI find the path? How far in distance, or number of switches between signals, or distance or switches between trackmarks? Anyone know what the logic actually is?

I made the above quickly to describe it better.

J3 on sample B is for a small industry.

On sample A an AI will (provided that the sidings are clear) upon approaching from the left side of the screen take control of J1 & J2. as it clears them, it releases the points for the next train. It does not require signals & Track direction markers to work(they'll benefit the AI if installed but are not strictly necessary for basic functions).

Sample B requires at minimum the control of the J1 & J2 points as well as the usage of some sort of "token" to function properly otherwise the AI will upon approaching from the left, will take control of J1 & J3. Only when the train approaches or immediately upon passing J3 will the train attempt to control J2. The path Rule & Command as well as the Token management command from the PLL can work together well in this scenario.

Use the Path rule the lock the points J1 & J2 for the appropriate direction(J3 does not need to be locked regardless of whether or not you (or the appropriate AI driver) need to stop and switch the industry or not). Then use an Autodrive past (Junction/trigger/Trackmark) command to navigate the train through the controlled section(Do not use the normal Navigate/Drive To/Via to do this - they won't work with the path rule!) then resume normal AI commands. The Token command is used to provide a single point of contention for the AI drivers and can be swapped with any suitable AI driver Command.

This permits a train to stop in section either to switch an industry/industries / perform station stops / any other reason a train would need to stop on a single track line without breaking control over permission to enter a single track section. This also permits proper prototypical signalling to be setup on the line.

This method has to my knowledge no limitations on how many points can be on single track section and should work fine(provided you can setup the path rule properly) without further ado.

Sample C can be treated as a loop version(rather than a stub siding) of sample B.

In regards to the length between signals, I think someone has stated its 32km.

I hope this helps.

Hee-hee, thanks, but I suspect I'll need to hire a team of rocket scientists to program that, so it will be a while before I can report back on it.

Built into 2010;

Path Rule,<kuid2:71155:60006:1>

And the usual KUID2 replacement drama with a half a dozen updates which content mangler can't find, then

Path Library,<kuid2:71155:60008:3>
Path Command,<kuid2:71155:60007:4>

are listed as dependencies for the path rule and each other, with the missing dependency icon for all three. Assuming I get that untangled;

I might be able to decipher all that eventually. For now I suspect a simpler solution will be trigger multiple signals at each end, with a bunch of dwarf signals on the single track section.


That's the module I'm using, near as I can tell the actual control seems to be about 3 switches ahead of the AI train, although I haven't experimented with spacer signals yet.

After fooling around with trigger multiple signals for a while I gave up for now and decided to doubletrack that section. Found out something important in the process though;


On the left is the original placement of trackmark YW o3 which worked fine until the player messed with it - I switched some cars into the spur coming off of junction 726 and left that switch thrown for the curve. The AI train (moving bottom to top on the right side main) sets all the switches needed for the instruction "drive via trackmark YW o3" then after passing YW o3 loads the next instruction to drive via trackmark YW o4. Too late, he's too close to switch 726, so he heads into the spur.

On the right is the new placement of trackmark YW o3, beyond junction 3122. Total of six switches between YW o2 and YW o3, so far no problem with that number.

Ruler scale is another issue, got that "signal overlap" message on one of the double head dwarf signals so I added the ruler to get an idea of how far apart was far enough. I heard 25 meters someplace, but that's only 82 feet and these had to be further apart than that to get rid of the message.
I found that if a speedboard is to high a train will cruise right on past a trigger, and lock a switch, as AI driver has passed a signal passed at danger (SPAD) ... or that a long train on a gradient attempts to stop, but the momentum of the heavy consist causes the AI train to slide right on through the trigger, locking the switch ... especially with 1 mile long consists, on a steep downhill gradient ... my solution was to sandwich 40 AI Brake between 2 boxcars, hooked on the tail end of the train, giving it enough added braking power to stop any train, preventing slide through AI trainz
Last edited:
Your YW o3 being to close to junction would not be a problem if you reduced the radius of the switch 726. Default radius of a switch is about 20m so your train was within that area when it got its next set of instructions and could not change the switch. As for the signals they also have a radius but the 25m you mention is for one signal. Place a second signal you add the two together to make a gap of about 45m so the two signals don't overlap (default for most assets are 20m radius).