AJS Invisible Stations and Bloodnok's New Platforms - Loading Problems Workaround

SnC Platforms have station.gs which includes GenericPassengerStation.gs they are Boodnoks creations. I'll leave deciphering up to those who's coding is not as out of date and rusty as mine. station.gs copied below if it helps
Code:
include "GenericPassengerStation.gs"
  

class Station isclass GenericPassengerStation {

  // Controls where the train stops

  bool TriggerSupportsMassStoppedLoad(Vehicle vehicle, string triggerName) {
  
    Interface.Log("TriggerSupportsMassStoppedLoad called with triggerName " + triggerName);
    bool vehicleToTrain = vehicle.GetDirectionRelativeToTrain();
    int lengthOfTrain = vehicle.GetMyTrain().GetVehicles().size();

    // BEWARE! GROSS HACK ALERT: Hardcoded to match my naming scheme for triggers...
    int platformnumber = Str.ToInt(triggerName[1,2]);
    int triggerNumber = Str.ToInt(triggerName[8,10]);

    // AI case, control the stopping point

    // BEWARE! GROSS HACK ALERT: Assumes that the triggers are laid in rising
    // numerical order along the direction of the track

    int direction = vehicle.GetRelationToTrack(me, "track_" + platformnumber);
    if (!vehicleToTrain) {
      direction = -direction;
    }

    // catchall at the "end" of the platform
    if ((direction == Vehicle.DIRECTION_FORWARD and triggerNumber > 5) or
        (direction == Vehicle.DIRECTION_BACKWARD and triggerNumber < 2)) {
      return true;
    }

    // stop AI trains at the station building end of the platforms
    // car length,    direction,    platform #,    stop point
    //        <3        forward            1            >2
    //        <3        backward        2            <5
    //        <4        forward            2            >4
    //        <4        backward        1            <3
    //        <6        forward            1            >3
    //        <6        backward        2            <4
    //        <8        forward            1            >4
    //        <8        backward        2            <3

    
    if(lengthOfTrain < 3 and ((direction == Vehicle.DIRECTION_FORWARD and platformnumber == 1 and triggerNumber > 2) or
                              (direction == Vehicle.DIRECTION_BACKWARD and platformnumber == 2 and triggerNumber < 5))) {
      return true;
    }

    if(lengthOfTrain < 4 and ((direction == Vehicle.DIRECTION_FORWARD and platformnumber == 2 and triggerNumber > 4) or
                              (direction == Vehicle.DIRECTION_BACKWARD and platformnumber == 1 and triggerNumber < 3))) {
      return true;
    }

    if(lengthOfTrain < 6 and ((direction == Vehicle.DIRECTION_FORWARD and platformnumber == 1 and triggerNumber > 3) or
                              (direction == Vehicle.DIRECTION_BACKWARD and platformnumber == 2 and triggerNumber < 4))) {
      return true;
    }
    
    if(lengthOfTrain < 8 and ((direction == Vehicle.DIRECTION_FORWARD and platformnumber == 1 and triggerNumber > 4) or
                              (direction == Vehicle.DIRECTION_BACKWARD and platformnumber == 2 and triggerNumber < 3))) {
      return true;
    }

    // manual case - the train has been stopped anywhere along the platform

    if (vehicle.GetMyTrain().IsStopped()) {
      Interface.Log("Train is stopped");
      return true;
    }

    return false;
  }


  // controls which side the doors open on
  // BEWARE! GROSS HACK ALERT: assumes track laid with platform on left side
  // this will be true for all my stations, as my 3rd rail track requires that too...

  void GetTrackAndSide(Vehicle vehicle, string triggerName, TrackLoadInfo retInfo) {

    // BEWARE! GROSS HACK ALERT: Hardcoded to match my naming scheme for triggers...
    int platformnumber = Str.ToInt(triggerName[1,2]);

    retInfo.trackName = "track_" + platformnumber;
    retInfo.trainLeftSide = (vehicle.GetRelationToTrack(me, retInfo.trackName) != Vehicle.DIRECTION_BACKWARD) == vehicle.GetDirectionRelativeToTrain();
    retInfo.platformIndex = platformnumber - 1;
  }

  public void Init(void)
  {
    inherited();

    Interface.Log("Init called");

    // number of platforms?
    InitPassengerStation(2);

    Interface.Log("Calling StationMain...");
    
    StationMain();
  }



  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();
    int i;
    for (i = 1; i <= 2; i++) {

      destNames[destNames.size()] = stringTable.GetString("platform") + " " + i;
      destTracks[destTracks.size()] = "track_" + i;

    }
  }
    
};
 
Hi Shane
Settle station is gs and opens in sourcedit ok.
Do you want anything emailing? PM me with your email address if you do

Regards

Ken

PS Malc is a lot quicker on the draw, he's younger.
 
Last edited:
Another test.

Not using brummfondel, just the built-in Call At, Load and Unload with completely different passenger enabled rolling stock both steam era and modern electric in consists.

The problem is still there therefore I think that this eliminates the possibility that the rolling stock is the primary cause. Yes the enginespec and line speed could be a factor in some cases but not them all.

Scottish
 
Interesting results there - it still points to script issues somewhere along the line, and I still feel it's likely to be stemming from one or more of the scripts in the <trainz install folder>/scripts folder.

Shane
 
As a result of the helpful and valuable information given by those who have posted in this thread, particularly p-dehnert, bloodnok, kengreen, shaneturner and others, I have carried out days of testing on AJS invisible stations in TS12. This is a short summary of what I have found.

It looks to me that, as some have said, that the speed of the consist when entering the station zone is the most critical thing determining whether the station works normally or not. If measures are taken to make sure that the speed is slow enough, the station triggers catch the train and operate the full cycle. I have found that you cannot rely solely on AI to slow it sufficiently. Track speed signs (visible or invisible) or using the invisible variable speed signal in the session (this sets the speed based on the priority assigned to the consist 1, 2 or 3) need to be used to be completely sure that the station will work correctly.

In all of the tests I had the loading waiting time in the station properties options set to 20 seconds. Both single and double platform versions of the stations were included in the tests.

Peter said that the max-decel in some of the enginespecs needs to be increased because Trainz treats this differently in later versions. He is also correct but sometimes this was not enough on its own to be sure the station triggers operated correctly.

The foolproof method appears to be to slow the consist by speed signs of one type or another.

An interesting situation is where you may want one consist to stop at a station but another one to pass right through at speed without stopping. Track speed signs will slow all trains but the variable speed signal in the session will allow say all priority 1 to pass through at a higher speed while limiting say priority 2 to the slower speed to stop at the station.

There might be other rules available which could do a similar job but I do not know of them at the moment.

I am playing about with changing speed to see if I can indentify the optimum values for the different consists. I know 10mph always works. I think 15mph is still OK but need more testing. I wonder what will happen at 20mph because I think this will fail.

There may be some script interface anomolies which are operating in the background which are influencing things, and Shane has taken this up with N3V.

However I am posting the results of my tests to help others who have been experiencing these problems with these AJS stations.

Since other creators passenger enabled stations and platforms are often using the same core scripts with the creator's primary script on top, I believe that the same principle of controlling the speed of approach with speed signs will probably work with most of them. I also think that although my tests were carried out in TS12, the same method will probably work in TS2010 and TS2009SP4.

Scottish
 
I can confirm that I have now received a reply from N3V on this issue.

The response I had from them (in the form of Kris Deagle) is that it's been passed on to the development team who will investigate.

Shane
 
When using variable speed triggers, it would also be useful to include the "Priorityz" command to switch between high and low priority status for services that stop at some stations but not others.
 
Thanks Scottbe8. This is a very useful rule to use with variable speed triggers. I did not know about this one.

Scottish
 
It's worth noting that there are two potential different problems here.

Firstly: A train enters, but fails to stop in a station.

Secondly: A train stops, but fails to open doors of some carriages while loading.

The one I have had reported to me directly is the second one. However, assuming we're discussing the first in this thread:

This requires two small failures at the same time in order to cause it:

* A trigger message is missed
* The station script (the creator's part) can't cope with the missed message

Missing a trigger message could happen if the train travels further than the trigger diameter (i.e.twice trigger radius) within one update cycle. If a train moves more than 10m in one frame, and you get some bad luck with the positioning, it could completely jump a 5m radius trigger. If you are starting to see intermittent failures at ~20mph, this would indicate an update took more than a second at the point of failure. Note that this doesn't have to be continuous -- one unlucky stutter while running at a low but not terrible framerate may be sufficient.

This would also explain why:

* Some people just don't see it (they are all running at significantly higher FPS)
* The problem does not appear in testing (which is generally done on a blank map with only the relevant assets placed, so also high FPS)
* For those that do see it, increasing the trigger radius is perceived to help
* For those that do see it, slowing down the train is perceived to help

If this hypothesis is true, then:

* As a map creator, the best thing you could do to work around this is to optimise your map. If it starts running at a higher FPS with less jitters, you'll have a lot less problems.

* There is also specific script change that can be made to the creator station script to alleviate this too. The creator's part of the station script waits for a specific trigger to be hit by a specific vehicle before allowing a mass stopped load. It would be a good idea to ensure that if the specific trigger case was missed, that any following check (whether that's the same vehicle but a trigger further down the platform, or a vehicle later in the train to hit the target trigger) will also allow a stop, should the first message have been missed.

My stations already include a couple of 'catch-all' cases, but I'll have a further look to see if I can improve this any for the next release. I obviously can't speak for other creators scripts though.
 
I have had the same problems as reported here. There is an asset...

Update max speed and priority,<kuid2:645812:100106:5> by oknotsen
that changes speed depending on consist priority.

Being one to add conflict to the traffic patterns, I run Amtrak as Priority 1
along with manifest freights. RDC units that stop at every small outpost are
run as Priority 2 and drag freights at Priority 3.

If you get a number of these different consists running at the same time,
it can lead to lots of interesting conflicts.

Allowing Amtrack to breeze thru small stations at track speed while slowing
the RDC units for a stop works as advertised.

At this point I don't have lots of experience with the asset, but I sure have
lots of opportunity to see if it solves the problem. I use quite a number of the
troubled stations on the railroad I spend way too much time changing in one
way or another.

Be interested if others have any success with this method.

-AL
 
Thank you Bloodnok for looking into this in detail.

From my testing over a couple of weeks, not only do I understand the concept of what you are saying but I also believe that I have witnessed this happening. There are the two problems as you have said, firstly not stopping or pausing then driving off without loading, and secondly doors not opening. The first one is more important but it would be better if both could be solved.

My initial trials before I started changing things, showed that in TS12 both AJS stations and your new platforms showed the same characteristic problems. When I started changing things like trigger radii, max-decel or putting speed signs of 10mph at the immediate approaches to the platforms, I have concentrated my trials on the AJS items since they seemed to have more misses than your platforms.

I have had a gut feeling that somehow the time taken by the computer or software to process the instructions played a part in the likelyhood of a miss. Your explanation gives a technical reason why this could be happening. I think that misses are more frequent in TS12 than in TRS2010.

It also ties in with another anomoly I had found. I have been using a number of different fully detailed maps on my trials and was finding that on certain stations on particular maps I was having to reduce the speed on entering some stations down to 5mph instead of the 10mph which usually worked. If there was processing delays because of high detail in these areas, as you say the important trigger could have been missed. Thus reducing the speed of approach even further would give more time for the trigger to catch the train.

On another less detailed map the stations caught the train when entering at ~20mph, which also ties in with your information.

Most people do not have super-computers so it would be great if a way could be found to have the scripts carry out multiple checks for the consist entering the station and increase the likelyhood of the consist being properly caught by the station and the full cycle undertaken. I note that you have extra checks already in your platform script and this would explain why your platforms had less misses than the AJS ones.

I also appreciate that you are trying to make any revisions more robust and strengthen the chance that the consist can be caught, even if the map is highly detailed or the hardware is lower spec.

Thanks again for your input, and in the meantime I will use more speed signs to slow the train down.

Scottish
 
Most people do not have super-computers

... and even if they did, the kind of maps that exhibit these problems would still likely suffer.

As a map creator, you can do things to Trainz that can ruin performance in ways that throwing hardware at it simply won't fix.

Increasing performance is a case of carefully examining the objects in the scene, and improving or replacing the worst offenders. There is often a disproportionate load placed on the system by either a fence or grass spline, that changed for a more efficient / modern asset, will make a dramatic efficiency improvement. Fences are an easy target -- replace these with a trainz-build 2.9 fence spline (there are several types available built-in and on the DLS), and things will get a lot better very quickly.

Grass splines are a harder problem to solve. I haven't personally found one I like with both suitable appearance to be worthwhile using, and suitably efficiency for large scale use, so I try to concentrate on using them sparingly, where they can give the most benefit.

Use the stats readout that TS2010/TS12 provides (you can turn this on in the options menu) to find out what assets to look at removing / replacing / improving in your own maps.

it would be great if a way could be found to have the scripts carry out multiple checks for the consist entering the station and increase the likelyhood of the consist being properly caught by the station and the full cycle undertaken. I note that you have extra checks already in your platform script and this would explain why your platforms had less misses than the AJS ones.

I'll see what I can do with this. I'm pretty sure I can make an improvement to any train with at least 2 vehicles. Hopefully I can do so without adding significant processing load, too...
 
The cars not opening is a fault that affects only those cars whose orientations do not match the direction of train movement. This affects all stations, not just AJS and Bloodnok.
 
I wonder if that's what's been happening on mine? Here is an image that shows one of the train stopping problems. Notice where it is, the speed,and the current command icon.


Uploaded with ImageShack.us

Shane

EDIT: Looks like the speed is reading incorrectly as well, as it was actually doing 0MPH.
 
Last edited:
EDIT: Looks like the speed is reading incorrectly as well, as it was actually doing 0MPH.

If the speed indication in the HUD isn't updating, then you've lost some important script processes in your session. Did you get any script crash bugs earlier on? You have bigger problems in this session than where your trains are, or aren't stopping...
 
Back
Top