AI - Obeys Lights or Blocks?

boleyd

Well-known member
Do AI trains obey the status of the signal lights or do they only respond to signal block occupancy?
 
When signals are not placed: AI Tranz in "Drive" also will follow closely behind another train in front of it, leaving a buffer zone between consists.
 
I found based on engine files the trains AI react differently....
now 2010 im finding signaling where the trains wont brake til they reach a trackmark which I usually leave a good distance before a signal and pffft train keeps rolling through that also im still testing which engine files actually work well in 2010 signaling worked perfectly in 2006 (f7 default engine file)

2010 signaling i guessing more designed for the guys that put signals all over the place every 10 ft with 10mph posts I dont know to many suggestions not enough real answers theyre yet....
 
AI trains obey signals. If the signal is green they will travel at line speed. If the signal is yellow they will travel at half line speed and if the signal is red they should stop at the signal although they do "spad" now and again. In that event the train comes to a stand and does not restart for 2 minutes.
In my experience if you want an AI train to stop at a specific location you should place the track marker about half a locomtive length ahead of the location.I have not known an AI train not to brake until it reaches the track marker unless you give it a "drive via" command and that is the only instruction.
 
SPAD

I'm on 2009 TC3, and there are several locations on the Settle & Carlisle route (AURAN "supplied" - built in content) where trains predictably SPAD. Having watched this happen closely, with different track mark placings, speed restrictions etc. I've reached the point where the loco slows to about 6 mph, about 100ft (30m) from a red signal when, mystery of mystery, it accelerates past the signal. Then the SPAD rule kicks in.

This is a repeatable event!!

All I can think of at the moment is that the following signals are quite close together, and perhaps, with the loco so close to the signal, AI forgets which signal it is supposed to be looking at.

I've not seen any mention of this (accelerating) behavior on any thread yet. Been looking on and off for months!! Maybe I 'm unlucky?
 
A few comments directed at various posts:

If you want a train to stop at a trackmark use 'Navigate To' not 'Navigate Via'. In the first instance the train will stop within the tm radius every time. With 'Nav Via' it will overshoot (even sometimes o/shoot and back up), I assume because the AI is expecting another command to follow.

Don't place a 'Navigate via' tm within braking distance of a signal which might be red. The AI will not brake till it is past the 'Navigate via' TM. Use 'Navigate To', but accept that the train will at least slow considerably (and might stop) even if the signal ahead is green.

If you are SPADing a lot add the line -autopilotsignaldistance #### to Trainzoptions where #### is the required distance (in meters) for a train to start to slow for a red. Default is (IIRC) 500m, 1000 or 1500 will give better results, specially on high-speed lines.

I don't generally 'block signal' in Trainz, I prefer to keep the signals as sparse as possible (less to go wrong!) but on high speed lines I place a 'block' signal about 1/2 mile in advance of the interlocking signal. If the i'lock is red the 'advance' is yellow. Combined with a long autopilotsignaldistance that gets as near bombproof as I can get it. Another advantage of the 'advance' is that the previous interlocking sig is now green, not yellow...

Andy ;)
 
Last edited:
Steve C.
What signal and where?
I have noticed this in the drivers messages on a session I made in SnC, I have not been too bothered as it has not caused a problem (yet) but would like to check it out. Ta. :wave:
 
Funny thing, I'm currently playing with AI traffic and the Trigger Multiple Signals rule for a 4 track / 4 track crossing;

http://www.youtube.com/watch?v=P0OG1nW7eaA

That worked so well I got fancy with the traffic patterns;



Light blue and orange are 4 tracks, yellow is 3, red is a 2 track belt line.

Original pattern was Thatcher-Clinton and Clinton-Thatcher on the light blue line, freight on the outer tracks and scoots on the inner tracks. Then I added two way passenger trains Grand-Cicero and Cicero-Grand, still worked okay. Rather than add more portals and set up two way freight traffic on the yellow/orange lines, then another for the red line, I had the freights spawning at Thatcher (C&NW Galena Line) diverge to the yellow line (BNSF Racetrack) at Western, then turn north on the red line (Belt Railway of Chicago) to the orange (Milwaukee) line back to Western, then back onto the blue (C&NW) to Clinton. Freights spawned at Clinton follow the same pattern in the opposite direction to Thatcher. I left out the parallel Lake Street Elevated, which spawns one train every five minutes just east of Thatcher and goes downtown around the Loop and returns.

So. That was fascinating to watch, tedious to set up, since the Trainz AI is intelligent but psychotic - if there's a crossover ANYWHERE an AI train will take it merely because it's available, instead of following the most direct route to the next navigation point. So that required 35 trackmarks in each direction to stop the blasted things from taking the scenic route, and that might have been the problem. Start out at 25FPS or so, after an hour of running I'm down to 5 or 6FPS. :'( The way it was set up, commuters from Thatcher and Clinton every 10 minutes, freights from both directions every 15 minutes, passenger trains from Grand and Cicero every 20 minutes, one L train every five. Total spawn per hour, 12 Ls, 12 scoots, 8 freight, 6 passenger, 38 spawns per hour from assorted portals. I don't think that's the problem so much, I suspect the killer is the number of trains actively running at one time combined with the total number of instructions each one has left to execute. That's merely a SWAG based on some preliminary tests, no real data yet.

Well, nice yakking with everyone, gotta get back to work and see if I can blow up the laboratory.

FIRE IN THE HOLE! :cool:
 
Design??

With multiple concurrent trains in a multi-signal setting I wonder how this is really handled. One way might be to examine routing and signal instructions based upon time slices. Start at zero and plan the routes, stops and speeds as well as the switch settings for the initial time slice. Then with the results at hand, do the next slice. If done this way the question is how far does the program plan ahead? The number of events remains reasonable since each time slice is independent and only related to the info provided by the prior slice's plan.

Probably not designed that way but maybe someone can describe how it does work and some mysteries solved as well as pitfalls avoided.
 
No, you're thinking of the other game, where every movement and meet has to be rigidly timed, all the paths and schedules are decided in advance by the editor and cast in stone before the scenario starts. Try to deviate from the path and you'll find any switch leading to a crossing with an AI train's path locked, fail to be exactly where the AI "dispatcher" (not really worthy of the name) expects you to be at any given time, and the AI trains go into creeping mode because they're too retarded to adapt to any changes.

The AI in Trainz is just the opposite - Navigate Via trackmark 1, 2, 3, 4, Navigate To portal Destination West Galena Freight, whatever instruction it hasn't executed yet it will look for the path to that marker and go there however. As I said my experience is that it's intelligent but psychotic, if the shortest path from trackmark 1 to trackmark 2 is on the south main, it will go ahead and cross over to the north main if it happens to find a crossover, then blow past trackmark 2 to the next crossover and cross back to the south main and back up 10 miles to trackmark 2. :hehe: Setting up the trackmarks to prevent it from taking the scenic route is the longest part of debugging, especially when 17 trains take the logical path and #18 decides to take the scenic route. Meanwhile #19 follows the logical path and gets into a standoff with #18 backing down the wrong way.

The decisions are all made "on the fly" while it's running, it passes trackmark 1 and starts looking for trackmark 2, if trackmark 3 isn't on a connected track it won't even notice until it passes trackmark 2 that there's no way to get to 3. Running on a 4 track mainline it sees a red signal ahead and stops, starts trying to throw switches if there are any ahead to make the signal turn green. Hit CTRL H at a maze of puzzle switches and you can see the switches being tried in various combinations until it finds one that clears a path to the next signal. Train ahead is stopped at a station, if there's a crossover before that it will run around the stopped train if it can find an alternate path.

None of the Big Three trainsims have any kind of actual AI dispatcher making decisions in realtime. The other two are designed to have every movement pre-scripted, and altho MSTS does a better job of reacting to unexpected events than That Other Game Which I Can't Mention Without Throwing The Fans Into A Hissy Fit, the trains still have no actual artificial intelligence. The AI trains in MSTS merely follow an invisible path which advances according to the SignalNumberClearAhead value in the signal script for that route - the PATH sees signals and reacts to them by advancing or stopping, the AI train merely stops at the end of the path, and starts moving again when the path advances.

Trainz is different, each "driver" is independently attempting to follow the next instruction in the list however he (or she) can. Consequently they do see and react to signals, as noted the reactions can be screwy with markers and signals not set up correctly. Also if the signal is permissive they will blow thru a red one, so you gotta watch where you use permissive signals.
 
The fact that there is some real-time examination of the current condition in Trainz seems like the best way to go. As you said the resulting decisions may be a bit screwy but at least it is trying.

problem is that the role of the AI dispatcher and the customer dispatcher are not clear. The latter needs to "tune the track" with directional arrows and then use delays and track-marks to avoid conflict. In the meantime the Trainz AI thingy is secretly watching and making its own plans!:cool:
 
Only game in town for me. She's ugly as sin and half crazy, but you can't fix stupid and she does have brains. Takes a while to figure it all out, but essentially I look at the intended path, and everywhere there's a facing point switch the AI might decide to cross over, I place the next sequential track marker beyond that. I number them in order from starting portal to end portal, so when I set up the portal I can just add "Navigate Via" then Eastbound Galena Freight 1, Eastbound Galena Freight 2, Eastbound Galena Freight 3, and so on. Helps if you're the one who made the route, I haven't even looked into placing new markers in a session layer on someone else's route, altho I understand that's possible.

One thing to be aware of is portal schedule - session starts at 10:00 that's Time Zero for the portals. Portal A is set to spawn a new train every 10 minutes, portal B every 15, portal C every 20. So 10:10 portal A spawns #1, 10:15 portal B spawns #1, 10:20 portal C spawns #1 and portal A spawns #2. 10:30 portal A spawns #3, portal B spawns #2, and so on.

Save the game and resume session later, whatever time you saved the session is the new Time Zero for the AI. So for example if you saved at 11:07, portal A will spawn at 11:17, 11:27, 11:37, portal B will spawn at 11:22, 11:37, 11:52, portal C spawns at 11:27, 11:47, 12:07 and so on. Haven't seen that cause any problems yet, but I generally save on the hour to avoid confusion.
 
Steve C.
What signal and where?
I have noticed this in the drivers messages on a session I made in SnC, I have not been too bothered as it has not caused a problem (yet) but would like to check it out. Ta. :wave:
Hi there Deano5
2 particular signals are LR10, leaving Carlisle on the S&C (3rd signal from Carlisle) and KN7, at exit to platform 6, Skipton station. I've since noticed both signals say "line ahead is unsignalled", so I've added a couple of invisible signals, which seems to be the answer, but it is early days yet!
 
Hi there Sniper 297.
One thing I've gradually become convinced of is that if AI at any point has to try find a way around an "obstruction" - real or imagined (!), then, a bit like a hen with too many chicks, it can lose the plot. Not totally, but something will go wrong, and you won't notice till maybe 5 minutes later and get one of those "what the hell" moments. Like a train running backwards, with no clue as where to go next. Or coming out of a portal with no driver instructions.
So, I try to not give my AI too much to do. Not an easy ask, though...
 
No, it's not, especially when you try to stop it from doing something really screwy;

http://www.youtube.com/watch?v=xJb_8UywoRA

My theory is it's looking for the least restrictive path, IOW no red or yellow signals, or the longest distance to the next red or yellow. That would explain why after I removed all the facing crossovers, that schizoid L train stopped, backed up thru a trailing crossover, then went forward again on the wrong track. Seen that in another test route with a commuter, red or yellow signal half a mile ahead, I'm gonna take the other track since I don't see any reds or yellows within five miles on it - primarily because it's mostly signaled for one way operation the other direction! :eek: How far and how fast can I go before the next restriction, I suspect that's Crazey Jones the AI engineer's logic.
 
Have you tried putting direction markers in to stop trains going the wrong way down a line?

It does not work! They still do it.

I am wondering if every direction marker needs an invisible signal before it; the signal will always be at red, as the marker ppints the wrong way, and Iget the feeling the trains pay more attention to signals than markers.
 
Back
Top