Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: AI traffic - how screwy can you get?

  1. #1
    Join Date
    Nov 1999
    Location
    Stevens Point, Wisconsin, USA.
    Posts
    14,705

    Default AI traffic - how screwy can you get?

    Coming from other train simulators Trainz AI traffic might seem like a steep learning curve, but that's because it's so versatile you can do things that would make other trainsims go into complete meltdown. Trainz AI follows commands and reacts to signals, since it thinks for itself on the fly instead of following a prescripted path it can be a little disconcerting when you tell it to go from A to D and it takes a wild ride through X Y Z to get there. Tell it A B C D and it will follow a more reasonable path.

    My bible for AI traffic creation;

    http://trains.0catch.com/tutorial.html

    Don't let the title fool you, successful AI traffic creation starts with signal configuration and understanding how to set up and name trackmarks for the AI to follow, so to do real complicated stuff you need to understand how it all works together.

    My latest crazy project is a route bigger than Phil Skene's IntenCity but smaller and less complex than his Port Ogden & Northern, but with the same kind of short run "peddler frieght" theme for switching (shunting) fanatics. How screwy can I get, here's the basic diagram;



    Three different spawning portals, the one from the coal mine (black arrows) spawns every 20 minutes, follows the west freight route to the west city, dumps the load and hauls the empties back to the east portal. Both east and west portals have passenger and 40 car freight trains spawning in random order every 10 minutes. The eastbound passenger and freight follow the same route, shown with green arrows. The westbound passenger turns left at the mountains and goes through the south city (pink arrows) and the westbound freight goes to the right up the North Pass (blue arrows).

    The result is an unpredictable pattern in the center, depending on if it's a freight or passenger the westbound takes a different route, and when they all come together at "The Strangler" it can get rather intense.

    Setting this up took quite a while, testing and debugging is still ongoing.



    This is one of the tricks I use to reduce all those "Signal Passed At Danger, Emergency Braking Completed, Restarting Schedule in 2 minutes" that you see sometimes with 2 way traffic. Place a trackmark just before the signal guarding the single track shared section, give it a name with an S (for Stop) to differentiate it from the others. So when I'm adding driver commands in the schedule library it would be something like Drive Via Trackmark E 01, Drive Via Trackmark E 02, Drive TO Trackmark E 03 S, Wait For 5 seconds, Drive Via Trackmark E 04, and so on. The drive to instead of drive via makes him stop at the trackmark instead of running through it at track speed, and the Wait For 5 seconds results in a full stop with minimum delay. That way if an opposing train is coming from the other direction and suddenly trips the signal in front of him red, he's just beginning to accelerate from a full stop and will be going slow enough to avoid the SPAD in most cases.



    When testing sessions have all the HUD windows open and click your own driver character picture to bring up the side menu with the other drivers. Clicking on any of the drivers in the side window will "jump" you to that train so you can ride along and see how he (or she) is following the commands. In the F7 window click the Announcements to open that window, note here Tasha said she was waiting for clearance - actually she was flipping switches to find the combination that would give her a path to the next trackmark in her command list. Placing a dwarf signal on the crossover and restarting, she had no problems finding it the second time.



    Next train following was a freight which takes the other path. Meet you on the other side!



    This would choke other trainsims, but again the Drive To followed by the Wait 5 seconds command lessens the potential for them to run red signals, and they're intelligent enough to sort out who goes first and who goes next if the signals are configured correctly.

    Video here, just for fun;

    https://www.youtube.com/watch?v=XcJiaXPhXHU

  2. #2
    Join Date
    Mar 2007
    Location
    Mobile, Al
    Posts
    393

    Default

    Wow! Now that's AI traffic.

    As always thanks for sharing.

  3. #3
    Join Date
    Aug 2012
    Location
    Minneapolis, MN, USA
    Posts
    108

    Default

    This route will be released, I hope?

  4. #4
    Join Date
    Nov 1999
    Location
    Stevens Point, Wisconsin, USA.
    Posts
    14,705

    Default

    "Wow! Now that's AI traffic" Getting an idea why I was always griping about the other game now?

    "This route will be released, I hope?"

    Eventually, got a ways to go before it's ready. A test this morning revealed one of those "should never happen" oddities - two trains meeting face to face in a single track tunnel. An FAq that goes back to the days of MSTS;

    FAQ: How do I set up AI traffic?
    A: It depends on how the signals in the route are configured.
    FAQ: Okay wise guy, so how do I configure signals in a route?
    A: It depends on how you intend to set up the AI traffic!

    If you're making a multitrack high speed passenger route and are only going to run trains every 30 minutes with a rigid schedule and no potential for conflicting paths, you really don't need signals at all. For two way single track with passing sidings or double track with a lot of single track choke points you'll need a lot, especially if you intend to run two way traffic with the player dodging in and out of the mainline.

    This morning's bug was caused by one quirk of Trainz AI traffic - Crazey Jones always seeks the path with the fastest track speed. That 0catch tutorial mentions the direction the "ribbons" are originally laid, but tests show that has no actual effect - the AI prefers the line with the fastest speed, so on doubletrack with right hand running it will pick the wrong side left track whenever it can, simply because it has less signals facing it.



    Here's the problem, looking toward the direction this AI is coming from, a long valley with a long stretch of double track leading to a single track tunnel. The AI going the direction the camera is facing sets the switch for his track, then sets the next switch (Junction 388) for the right hand track. The opposing train is supposed to drive to trackmark E 06 S, and the most logical way to get there is on the track that it's on. If he does, then he can't move when his 5 second wait expires simply because the switch will be set the wrong way and his signal will stay red until the first train clears and releases control of the junction.

    But he didn't go that way, he decided the fastest way to E 06 S was to run past it on the wrong track, throw the switch behind, then back up to it. Since the first train had the switch set for that track and there was no signal to stop the opposing train running on the wrong track, they met in the tunnel.



    So to fix that, place an AI routing direction marker (same as the track direction marker in the old tutorial except it doesn't cause false aspects in the signals) and possibly a dwarf signal for the possibility that the player might need to use the wrong track (direction markers don't affect the player at all).

    That fixes that bug, now the opposing AI starts on the correct track and stays on it, only one set of switches at a time can be lined for the tunnel, no more head on collisions. Back to testing, find the next bug. And plant some trees in that valley.

  5. #5
    Join Date
    Aug 2012
    Location
    Minneapolis, MN, USA
    Posts
    108

    Default

    And if I had this route, I would somehow manage to mess all the AIs up like I did with CM3, and then try to figure out why I'm having problems.

  6. #6
    Join Date
    Apr 2003
    Location
    .
    Posts
    1,637

    Default And bigger than Ben-Hur?

    " ... a route bigger than Phil Skene's IntenCity ... ."

    Well, Jim, that aint all that hard! IntenCity is basically just a loop on a handful of baseboards. For those unfamiliar with the route it began as an experiment in a Player train interacting with AI trainz that circulate both ways round the loop. This is the route before it was all tarted up with scenery:

    https://www.youtube.com/watch?v=wv3iEH0CPak

    And this is part of the fully scenic version:

    https://www.youtube.com/watch?v=KYcD4uQ34rg

    Now, James, I'm assuming that the Player will be expected to navigate a path through the chaos of all the AI? If you are expecting a Player to do this, will you be using Signal Link to avoid a Mexican Standoff between Player and AI at the single track section?

    Phil

  7. #7
    Join Date
    Nov 1999
    Location
    Stevens Point, Wisconsin, USA.
    Posts
    14,705

    Default

    No, oddly enough I found it's not really needed - check the map when approaching single track, got an AI coming, stop and wait, "After YOU, my dear Alphonse!" Good thing we don't have AI drivers named Alphonse & Gaston, that WOULD cause stalemates!

    Boyerm, you will get better with practice - Phil and I had several years of experience beating the MSTS AI into submission before Trainz, so we had a head start knowing how signals work and how to test and troubleshoot. Read that http://trains.0catch.com/tutorial.html how-to from start to finish, 99% of it is simple to understand and works very well.

  8. #8
    Join Date
    Nov 1999
    Location
    Stevens Point, Wisconsin, USA.
    Posts
    14,705

    Default

    And of course it's a hobby, not a job, so when you get tired of signals and AI and testing and debugging, work on scenery for a while.

    1.jpg

    2.jpg

  9. #9
    Join Date
    Aug 2012
    Location
    Minneapolis, MN, USA
    Posts
    108

    Default

    Which is why I don't build a lot of routes. I, personally, HATE doing scenery because I stink at it.

  10. #10
    Join Date
    Nov 1999
    Location
    Stevens Point, Wisconsin, USA.
    Posts
    14,705

    Default

    Funny, I don't smell anything. Everybody stinks at it when they start, you get better with practice. I cheated, since I was making scenery modifications starting with Flightsim long before MSTS came out, so I had some previous experience when I first opened the MSTS route editor. And it is art, therefore a matter of personal preference. Some people are happy creating highly detailed "vignettes" or dioramas, spending a year to make once square mile with a single track passing a farmhouse, adding things like an animated pump in the yard and realistic fleas jumping on the cows' backs. Others spend 5 years building Proviso yard with all 500 tracks exactly positioned and oriented and mathematically correct down to 1 millimeter, that's what floats their boat. Me, I like running trains, the trains are the main focus of what I'm looking at, so I have static scenery trains in yards and lots of loose consists and AI trains - all the buildings and trees are mere background scenery for the trains to me. You gotta build what YOU like, not what you think will be popular, if you're building to please yourself it's impossible to fail.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
-->