Route Building Parameters

Aim - this pages describes some of the special features that are available in Open Rails, and how to set them up within Open Rails.

If you wish to provide any feedback on this page, please use the contact page. It would be great to have some feedback as this helps to ensure the accuracy of the information and models.

Index

Introduction

Pickup Points for Loads and Refueling

Turntable Animation

Car Spawners

Tree Clearing

Tunnel Resistance Parameters

Track SuperElevation

Route Sounds

Key Open Rails Parameters for Route Building

Useful References


Introduction

To enhance its realism and performance a number of new features and functions have been added to Open Rails. The features described on this page are those elements that are implemented or activated as part of the route design or specification. In some instances the features will also require parameters to be set in the ENG or WAG files to ensure full functionality of the feature or function.

The following features are described here:

  • Creating Operational Turntables
  • Clearing Trees from tracks
  • Tunnel Resistance Parameters
  • Track SuperElevation

To implement these features additional information needs to be inserted into various files as described in the relevant section. However making changes directly to these files may be overrriden by MSTS when editing the route in MSTS Routre Editor (RE), or alternatively it may cause instability issues with MSTS, so a method to include the information has been devised that doesn't require the direct editing of these two files directly. Instead an 'include' file is created with the data to be read by Open Rails. These files are created and stored in a sub-folder placed directly under the root folder of the route.

The structure of these files for each feature will be described in more detail below, and a working example of these files can be found in the Coals to Newcastle test route.

top


Pickup Points for Loads and Refueling

Open Rails currently supports the following pickup points for loading/unloading and refueling:

  • Null (Type = 0)
  • Freight - Grain (Type = 1)
  • Freight - Coal (Type = 2)
  • Freight - Gravel (Type = 3)
  • Freight - Sand (Type = 4)
  • Fuel - Water (Type = 5)
  • Fuel - Coal (Type = 6)
  • Fuel - Diesel (Type = 7)
  • Fuel - Wood (Type = 8) (NB - This is not an option in MSTS)
  • Fuel - Sand (Type = 9) (NB - This is not an option in MSTS)
  • Freight - General (Type = 10) (NB - This is not an option in MSTS)
  • Freight - Livestock (Type = 11) (NB - This is not an option in MSTS)
  • Freight - Fuel (Type = 12) (NB - This is not an option in MSTS)
  • Freight - Milk (Type = 13) (NB - This is not an option in MSTS)
  • Special - Mail (Type = 14) (NB - This is not an option in MSTS)

Pickup points can be animated so that they move into position to fill the wagon or locomotive.

To implement a pickup point use the RE to insert a pickup point, if the load type is not one of the standard load types, then the W file can be edit with a text editor, or alternatively a standard default point can be inserted, and then overwritten with an INC file as described in the section below.

Changing Pickup Point Type

The pickup point's type is defined in world files using the parameter PickupType ( 6 1 ), where the first number in the brackets relates to the type number as defined in the list above. This number can either be edited using the MSTS Route Editor, or alternatively using a text editor in the relvant world file.

Changing Pickup Point Load or Unload

To distinguish between a loading or unloading point it is necessary to set the Fill Rate value as positive for a loading point, and negative for an unloading point. This number can either be edited using the MSTS Route Editor, or alternatively using a text editor in the relvant world file. For example, the second number in the PickupCapacity ( 200000 2000 ) parameter is the fill rate, by setting it to a negative value, the "pickup point" will be recognised as an unloading point. For example, PickupCapacity ( 200000 -2000 ).

INCLUDE File to Overwrite Default MSTS code

As some of the above load types are not defined in MSTS, when using MSTS RE it is not possible to select any of the load types with a value greater then 7, instead they need to be manually edited in the W file. There is also a risk when editing the file in MSTS that they could default to a different load type, so it is suggested that an INCLUDE file is used to overwrite the relevant code in the W file.

SIMISA@@@@@@@@@@JINX0w0t______

Tr_Worldfile (

Pickup (
    UiD ( 70 )
    SpeedRange ( 0 2 )       Comment ( Freight - Fuel Loading Point )
    PickupType ( 12 0 )
    PickupAnimData ( 3 0 )
    PickupCapacity ( 1e+006 5000 )
)

Code Notes:

  • UiD ( x ) - must match the pickup point that is being overwritten by this code segment.
  • SpeedRange ( x y ) - sets the speed range for the train when using the pickup point. x = minimum speed, y = maximum speed. Units m/s.
  • PickupType ( x y ) - sets the pickup type. x = load type, a number from the above table. y = "never runs out", 0 = capacity specified in dialog box, 1 = infinite
  • PickupCapacity ( x y ) - sets the capacity of the pickup point. x = capacity in lbs per quantity. y = fill rate in lbs/s. (+ve for loading point, -ve for unlaoding point).

These types of code segments are included in a file named the same as the file in which they will replace the default code in, ie w+xxxxxx+yyyyyyy.w. These files are grouped within the OpenRails folder within the W folder. Mulitple pickup point code segments can be included in each W file thus defined. For a demonstration refer to w+001497+010303.w in the OpenRails folder within the W folder of the CTN Test Route.

If the W is edited in MSTS RE, check that the UiD identification numbers still match the code segments described above.

top


Turntable Animation

Introduction

Open Rails supports animation of turntables under two different scenarios:

  • TSection - If a turntable is defined within the TSECTION file, such as the default turntable a1t27mturntable.s found within MSTS, then it can be automated to rotate.
  • Static - If a turntable has been created as a static object only, then it maybe possible to convert it to an animated one. In this scenario it is effectively converted to a trackpiece that can be imported into a route.

The steps to implement an animated turnatble are as described below. Both the TSection and Static model follow a similar set of basic steps, except where indicated:

  • Step 1 - Modify the turntable S file to support animation
  • Step 2 - In the case of the static scenario, TSection elements will need to be incorporated into it the route. The TSection type turntable should already be defined
  • Step 3 - Place the turntable in the relevant location with the Route Editor tool. For the static turntable scenario, this will modify the W file to change the turntable from a static object to a track object.
  • Step 4 - Create a turntables.dat file to provide details on the location of operational turntables within the route.
  • Step 5 - Add sound effects to the turntable as appropriate.

A working example, using the default MSTS 27m turntable and a static 60ft model, has been provided in the Coals to Newcastle Test route. The working turntables can be found on tile 1493, 10308. The following description uses these as the basis for describing the setup of the two different types of turntables.

Step 1 - Turntable S File Animation

The turntable S file must contain an appropriate hierarchy structure separating the turntable bridge (part that rotates) from the turntable base (part that remains stationary). Shape Viewer can be used to confirm this hierarchy structure. For example, in the following screenshot from Shape Viewer, 'Deck' represent the model parts that will rotate when the turntable is animate, whilst 'Foundations' are all the remaining parts that are stationary.

Turntable hierarchy

To animate the turntable, uncompress the shape file, and insert the following code into the S file prior to the last parenthesis (or bracket) in the file. Note the use of the 'Deck' name as part of the anim_node, and the need to ensure that all parenthesis are included.


animations ( 1
    animation ( 3599 30
       anim_nodes ( 2
          anim_node Foundations (
             controllers ( 0 )
          )
          anim_node Deck (
             controllers ( 1
                tcb_rot ( 5
                  slerp_rot ( 0 0 0 0 1 )
                  slerp_rot ( 900 0 0.7071068 0 0.7071067 )
                  slerp_rot ( 1800 0 1 0 -1.629207E-07 )
                  slerp_rot ( 2700 0 -0.7071066 0 0.7071069 )
                  slerp_rot ( 3600 0 0 0 1 )
             )
           )
         )
       )
     )
  )

Once the modifications are complete, then the S file should be inserted into Global\Shapes folder so that OR can access it.

More Info

Note the animation code must be modelled such that it causes the turntable to rotate in a counter clockwise direction.

Step 2 - Create TSection Entries

As the turntables are effectively tracksections, they will need to be already defined in the TSection file (in the case of existing turntables), or alternatively able to be imported into the trackdatabase at runtime of Open Rails (in the case of static turntables). For our example the 27m turntable is already defined in the TSection file, so we can skip this step for it. However the 60ft one is not defined in the TSection, so it will need to have the relevant SectionIdx entries generated for it. The following code section demonstrates the type of entries required for the tsection.dat file that needs to be included in the Open Rails sub-folder.

include ( "../../../Global/tsection.dat" )
_INFO ( Track section and shape addition for turntable BBS-NSWGR-60ft-TT-open2_animate.s )
   TrackSections ( 40000
_SKIP ( Track section for turntable BBS-NSWGR-60ft-TT-open2_animate.s )
      TrackSection ( 37298
       SectionSize ( 1.5 18.6 )
   )
   )
   TrackShapes ( 40000
_INFO(TrackShape for turntable BBS-NSWGR-60ft-TT-open2_animate.s)
      TrackShape ( 37298
      FileName ( BBS-NSWGR-60ft-TT-open2_animate.s )
      NumPaths ( 3 )
      SectionIdx ( 1 0 1.35 -9.300 0 37298 )
      SectionIdx ( 1 -9.300 1.35 0 90 37298 )
      SectionIdx ( 1 6.576, 1.35, -6.576 -45 37298 )
   )
   )

Code Notes:

  • The first line must be blank
  • The second line has an include statement to indicate which file that this information needs to be added to.

  • TrackSections - is the number of track pieces defined in the TSection file. Typically this will not need to modified.
  • TrackSection - is the reference number that we will allocate to our track piece (turntable). This will be used in the W file as reference. Note this number should be unique, and not one that is already in use.
  • SectionSize - describes the gauge and length of the section that we are defining. Note MSTS default gauge is 1.5.
  • TrackShape - the same number as the trackshape number.
  • FileName - the name of the S file. Note that as this is a track section now, it must be located in the Global shapes folder.
  • NumPaths - the number of possible paths on the shape.
  • SectionIdx - ( n x y z d s1 s2 ... sn) : each SectionIdx describes a path within this TrackShape. n is the number of s-values to expect. x, y, z is where the path starts relative to the shapes origin. d is the initial direction of the path with 0 being straight on, minus values to the left and plus values to the right. s* is a reference to a TrackSection, the path is built by adding these TrackSections to each other in the order stated.

To ensure correct operation of the turntable, the SectionIdx entries need to be referenced to the object reference point. The diagram below demonstrates the referencing of the key points as used in the 60ft turntable. The Object reference point is in this case in the centre of the object. The turntable has three paths defined, as shown by the blue lines.

SectionIDX Co-ordinates

Drawing notes:

A tool to determine the relevant entries for the SectionIDX values is available for use. Simply enter the diameter of the turntable and the degree steps between the track sections to get the correct entries. Whilst this tool may generate multiple paths, depending upon the separation degrees choosen, any number of paths can be defined in the SectionIDX entries.

In the case of our turntable, in the tool, choose a value of 18.6 (approx 60m) for the diameter, and, as we want at least one path at 45 degrees, an Angle setting of 45 deg. It may be necessary to adjust the diameter value slightly as this will determine where the entry and exit tracks will attach to the turntable.

Description of paths used in the 60 ft turntable:

For a static turntables, to use MSTS RE, it will be necessary to temporarily insert the TSection information defined above into the main MSTS TSection file. This will allow selection and editing as a track piece, and will also ensure that it is correctly defined in the W file. When viewed in Route Editor, it should show relevant blue poles for track connections. Note if you wish to change the TSection settings for your turntable, always delete it from the route first before using the RE to insert it int the route. Failure to do this may cause issues with the track database, and result in opening faults.

Once you have defined your TSection entries, then use the information to create the tsection.dat file for distribution with OR routes.

Step 3 - Turntable Installation and World File Adjustment

By this stage you should be able to insert the animated turntable into the correct location in the world file using the Route Editor tool.

Once the turntable is correctly placed, it will usually appear as a TrackObject in the relevant world file, as shown below. Some of this information will be required to define the turntable location as described in the next step.

TrackObj (
    UiD ( 124 )
    SectionIdx ( 37298 )
    Elevation ( 0 )
    CollideFlags ( 23 )
    FileName ( BBS-NSWGR-60ft-TT-open2_animate.s )
    StaticFlags ( 00200180 )
    Position ( 172.979 -0.35 418.047 )
    QDirection ( 0 -0.422616 0 0.906309 )
    VDbId ( 4294967294 )
)

If the turntable is already defined in the TSection file, then placing the turntable in the route will merely be a case of using MSTS RE (OR route editor) to place the turntable and track around it.

Step 4 - Turntable Location

A special file called turntables.dat is defined within the Open Rails folder in the Route folder. This file has the following code structure:
2
Turntable(
WFile ( "w+001493+010308.w" )
UiD ( 86 )
XOffset ( 0 )
YOffset ( -1.92177 )
ZOffset ( 13.4 )
TrackShapeIndex ( 253 )
Animation ( "TRACKPIECE" )
Diameter ( 27 )
)
Turntable(
WFile ( "w+001493+010308.w" )
UiD ( 124 )
XOffset ( 0 )
YOffset ( 1.35 )
ZOffset ( 0 )
TrackShapeIndex ( 37298 )
Animation ( "Deck" )
Diameter ( 18.6 )
)

Code Notes:

  • The first line must be blank
  • The second line contains a number indicating the number of operational turntables in the route, and hence included in this file.
  • Wfile - the name of the W (world) file in which the turntable is located.
  • UID - the UID of the object within the W (world) file. If there is more then one operational turnatble on a tile, then this number will differentiate between them.
  • XOffset, YOffset, ZOffset - are the offsets of the center of rotation of the turntable with respect to the zero of the turntable shape. These may need to be adjusted by trial and error, in particular the height (Y) offset may require adjusting to match track heights.
  • TrackShapeIndex - the number of the SectionIdx from the W (world) file, which should correspond to a Trackshape number in the TSection file. In the case of the defualt MSTS 27m turntable, it was already defined within the TSection file, wheras the static turntable doesn't have a TSection entry.
  • Animation - the name of the moving parts from the hierarchy structure of the S file.
  • Diameter - the diameter of the turntable in metres.

Step 5 - Turntable Sounds

To add sounds to the turntable, add the following statement to the route TRK file in the Open Rails sub-folder.

Comment ( Adds sounds for turntables )
   ORTSDefaultTurntableSMS ( turntable.sms )
Turntable Operation

To test your turntable, run your train over it. If it is working correctly then messages should appear indicating the the train is moving onto the turntable. If you don't get these messages, then check your settings above.

Once you are successfully on the turntable, then ensure that the locomotive is in neutral, throttle is off, and speed is zero. Then press the Alt-C key to rotate in a clockwise direction, or Ctrl-C to rotate in an anticlockwise direction.

The above steps must be repeated for every route where you want to have operational turntables


Car Spawners

Multiple car spawners can now be used in Open Rails so that different traffic patterns can be used on different road sections.

The use of multiple car spawners is demonstrated in the Coals to Newcastle test route on tile 1493, 10307.

The steps to implement multiple carspawners are as described below:

Step 1 - Insert Car Spawners into Route

Using a n appropriate editing tool insert car spawners at the locations required. For the time being these will use the car spawner lists defined by default in the carspawn.dat in the root Route folder.

Step 2 - Create Additional Car Spawner Lists

In this step we create the additional non-default lists of cars that we wish to use in our Route. These lists use the code format shown below and should be in saved in a file called, carspawn.dat, stored in the OpenRails folder under the root Route folder.

SIMISA@@@@@@@@@@JINX0v1t______

2
CarSpawnerList(
   ListName ( "List1" )
      1
      CarSpawnerItem( "Jp1Car01.s" 4 )
)
CarSpawnerList(
   ListName ( "List2" )
      1
      CarSpawnerItem( "OL_Flatbed_Drums.s" 6 )
)

Code Notes:

  • The third line contains a number indicating the number of different carspawner lists used in the route, and hence included in this file.

  • ListName - is the name of the carspawner list.
  • The sixth line contains a number indicating the number of different vehicles defined in the carspawner list.
  • CarSpawnerList - defines each vehicle used in the list. The first item is the shape file of the vehicle, and the number indicates the spacing between the vehicles.

Step 3 - Create References to Additional Car Spawner Lists

In this step we create the references to the additional non-default lists of cars that we wish to use in our Route. These lists use the code format shown below and should be in saved in a file called, w+001493+010307.w, stored in the OpenRails folder under the World folder in the Route.

SIMISA@@@@@@@@@@JINX0w0t______

Tr_Worldfile (
    CarSpawner (
       UiD ( 32 )
       ORTSListName ( "List1" )
    )
    CarSpawner (
       UiD ( 31 )
       ORTSListName ( "List1" )
    )
    CarSpawner (
       UiD ( 30 )
       ORTSListName ( "List2" )
    )
    CarSpawner (
       UiD ( 29 )
       ORTSListName ( "List2" )
    )
)

Code Notes:

  • UID - is the number of the carspawner code that appears in the relevant W file.
  • ORTSListName - defines which additional carspawner list defined above should be used for this carspawner.

More Info

After setting up the additional car spawners, it is possible that any further changes or editing of the W files by a Route Editor tool might change the UID, and thus stop the operation of the car spawners. After making any changes to a W file in the editor, check that the UID numbers in the carspawners still align.


Tree Clearing

Typically within OR to create a forest, large numbers of trees are configured into a FOREST region. Sometimes trees within a FOREST region can inadvertantly be placed on the track or the road, with the result that the player train or road vehicles appears to run into them or through them. To overcome this issue a feature has been created to place trees a defined distance away from the tracks and roads.

This feature is implemented by inserting the following statement into the the route TRK file by using an INC file. The INC file should be named after the route, for example, using the CTN Test route, the file is au_ctn_test_route.trk used. The file is then located in a sub-folder uner the root Route folder, called OpenRails. Note: For the INC file to be read correctly there should be no "blank" lines after the final parenthesis in the main TRK file of the route.

The use of tree clearing is demonstrated in the Coals to Newcastle test route on tiles 1494, 10309 and 1493, 10309.

Comment ( Information to clear trees off tracks )
   ORTSUserPreferenceForestClearDistance ( 5.0m )
   ORTSUserPreferenceRemoveForestTreesFromRoads ( 5.0m )

Note: For the ORTSUserPreferenceRemoveForestTreesFromRoads parameter to work, it necessary to have the ORTSUserPreferenceForestClearDistance defined as well.

top


Tunnel Resistance Parameters

To override the basic 'standard' default tunnel design parameters within a particular route, include the following code into the route TRK file by using an INC file. The INC file should be named after the route, for example, using the CTN Test route, the file is au_ctn_test_route.trk used. The file is then located in a sub-folder uner the root Route folder, called OpenRails. Note: For the INC file to be read correctly there should be no "blank" lines after the final parenthesis in the main TRK file of the route.

To see an example implementation refer to the test route.


Comment ( Information to overwrite default data for tunnel designs )
ORTSSingleTunnelArea ( 26.84m^2 )
ORTSSingleTunnelPerimeter ( 20.724m )
ORTSDoubleTunnelArea ( 49.536m^2 )
ORTSDoubleTunnelPerimeter ( 28.497m )

Code Notes:

top


Track SuperElevation

The following code is inserted into the TRK file by using an INC file, if it is wished to override the SuperElevation physics defaults. These parameters need to be inserted into a modified and "shortened" file in in an OpenRails subfolder within the route. This means that any changes to the TRK file will not cause the loss of these parameters. The file inserted into the OpenRails folder will look like the following example.

To override the basic 'standard' track SuperElevation design parameters within a particular route, include the following code into the route TRK file by using an INC file. The INC file should be named after the route, for example, using the CTN Test route, the file is au_ctn_test_route.trk used. The file is then located in a sub-folder uner the root Route folder, called OpenRails. Note: For the INC file to be read correctly there should be no "blank" lines after the final parenthesis in the main TRK file of the route.

To see an example implementation refer to the test route.

More Info

Note: The inclusion of this parameter does not currently have any impact on the visual SuperElevation, but only on the SuperElevation 'physics', ie the curve speed, and overturning moments of the train.

Comment ( Information to set superelevation for tracks )
ORTSTrackSuperElevation ( 0.0 0.051 160.0 0.064 241.4 0.064 281.6 0.076 301.8 0.076 402.3 0.102 502.9 0.102 603.5 0.089 804.7 0.064 1005.8 0.051 1207.0 0.038 1609.3 0.025 3218.7 0.013 10000.0 0.0.013 )

Code Notes:

top


Route Sounds

A number of "global sound features can be added to the route by using the following parameters. These parameters can be added to the TRK file by using an INC file with the caveats described in the above sections.

ORTSDefaultTurntableSMS ( x ) - adds sounds to the turntable when it rotates. x is a SMS file that can be found in the Sound folder.

ORTSSwitchSMSNumber ( x ) - adds a sound that will be played whenever the train passes over a switch or point. x is a number corresponding to a line number in the TType.dat file in the main route folder. The corresponding entry in the TType.dat file can be either a common SMS file, or one that is specifically set up for this feature.

ORTSCurveSMSNumber ( x ) - adds a sound that will be played whenever the train passes over a curved section of track. x is a number corresponding to a line number in the TType.dat file in the main route folder. The corresponding entry in the TType.dat file can be either a common SMS file, or one that is specifically set up for this feature.

ORTSCurveSwitchSMSNumber ( x ) - adds a sound that will be played whenever the train passes over a switch or point on a curve. x is a number corresponding to a line number in the TType.dat file in the main route folder. The corresponding entry in the TType.dat file can be either a common SMS file, or one that is specifically set up for this feature.

To see an example implementation refer to the test route.

top


Key Open Rails Parameters for Route Building

The key parameters that impact upon the performance of a diesel locomotive are described on the following web page.

Standard Parameters for Route Building (updated Oct 2020)

top


Useful References

top