Difference between revisions of "CSV Routes"
(Created page with "<font size="small"><font face="sans-serif"> <font size="+2" color="#0080ff">The '''.csv''' route format</font><br /> =<font size="+1" color="#0080ff">Overview</font>= A C...") |
(No difference)
|
Latest revision as of 19:21, 6 February 2015
The .csv route format
Contents
Overview
A CSV route allows to create a route in a text file.
The file is a plain text file encoded in any arbitrary encoding, however, UTF-8 with a byte order mark is the preferred choice. The parsing model for numbers is Loose (unless otherwise stated), however, you are encouraged to produce Strict output nonetheless. The file is required to be located inside any folder whose current or parent folder includes the Railway and Train folders. The file name is arbitrary, but must have the extension .csv. The file is interpreted on a per-line basis, from top to bottom, where each line is split into expressions, which are interpreted from left to right.
The route file consists of a series of commands to define the objects which are used throughout the route (Structure namespace). Additional properties for the route, for the default train to be used and for the background images to be used can also be defined. At last, the route file will contain instructions from the Track namespace. Here, track positions (usually in meters) are used to define when the track should curve, when stations are to be placed, when a wall should start and end, and so on. Generally speaking, instructions from the Track namespace should be used after using instructions from any of the other namespaces.
The format assumes an implicit rail 0 which cannot be explicitly started or ended. Instead, it is present from the beginning of the route to the end, and it marks the rail the player's train drives on. All other rails in the CSV format are purely visual and have no functional purpose.
Geometrically, you can curve and pitch the implicit rail 0, while all other rails are defined relative to rail 0 and follow rail 0 into curves and pitch changes. Unless overridden, the file format is built around a fixed block size of 25 meters length, and it is only possible for certain commands to be used on 25 meter block boundaries. The placement of objects always assumes a non-curved coordinate system which connects blocks linearly.
➟ See also the quick reference for the CSV route...
Check these tutorials out: |
Syntax
For each line in the file, white spaces at the beginning and the end of that line are ignored. Then, lines are split into individual expressions, separated by commas (U+002C). Thus, each line is of the following form:
Expression1, Expression2, Expression3, ..., Expressionn |
In turn, each expression can be of any of the following forms:
Comments
A comment is completely ignored by the parser. To form a comment, the expression must begin with a semicolon (U+003B).
Track positions and lengths
Position |
A non-negative strict floating-point number corresponding to a track position. All subsequent commands from the Track namespace are associated to this track position.
Part1:Part2:...:Partn |
This is a more complex way of specifying track positions for use in conjunction with Options.UnitOfLength. Each of the Parti is a strict floating-point number. Part1 will be multiplied with Factor1, Part2 with Factor2, and so on, then all products are added together to form the final track position. This track position must be non-negative. The parts are separated by colons (U+003A). Please consult Options.UnitOfLength for further information on how to define the factors.
Whereever arguments in commands represent lengths, they can also be entered using the colon notation. These cases are highlighted in green in the following.
When n units are defined via Options.UnitOfLength, but fewer parameters are given using the colon notation, the parameters are right-associative, meaning, the parameters on the left are those which are skipped. Therefore, each of the following lengths are equivalent: 0:0:2, 0:2, and 2.
Commands
Commands without arguments:
NameOfTheCommand |
Commands with arguments:
NameOfTheCommand Argument1;Argument2;Argument3;...;Argumentn NameOfTheCommand(Argument1;Argument2;Argument3;...;Argumentn) |
Commands with indices and arguments:
NameOfTheCommand(Index1;Index2;...;Indexm) Argument1;Argument2;Argument3;...;Argumentn NameOfTheCommand(Index1;Index2;...;Indexm).Suffix Argument1;Argument2;Argument3;...;Argumentn NameOfTheCommand(Index1;Index2;...;Indexm).Suffix(Argument1;Argument2;Argument3;...;Argumentn) |
Rules:
NameOfTheCommand is case-insensitive. Indices and arguments are separated by semicolons (U+003B). White spaces around NameOfTheCommand and any of the indices and arguments are ignored. White spaces surrounding any of the parantheses are also ignored.
If indices are used, these are enclosed by opening parantheses (U+0028) and closing parantheses (U+0029). At least one argument, or a Suffix is mandatory when using indices.
There are two variations on how to encode arguments. Except for the $-directives ($Chr, $Rnd, $Sub, ...), you can freely choose which variant to use. Variant 1: The first argument is separated from the command, indices or Suffix by at least one space (U+0020). Variant two: The arguments are enclosed by opening parantheses (U+0028) and closing parantheses (U+0029). In the latter case, Suffix is mandatory when used in conjunction with indices. White spaces surrounding any of the parantheses are ignored.
Please note that in some commands, Suffix is mandatory regardless of the style you use to encode arguments. In the following, Suffix will be bolded when it is mandatory, and grayed when it is optional.
The With statement
With Prefix |
All subsequent commands that start with a period (U+002E) are prepended by Prefix. For example:
' | |
▶ | With Route .Gauge 1435 .Timetable 1157_M |
Is equivalent to:
' | |
▶ | Route.Gauge 1435 Route.Timetable 1157_M |
Preprocessing
Before any of the commands in the route file are actually interpreted, the expressions are preprocessed. The first thing done is to replace any occurences of the $-directives within an expression from right to left. The $Chr, $Rnd and $Sub directives may be nested in any way, while $Include, $If, $Else and $EndIf must not appear inside another directive.
⚠ | The syntax for the $-directives cannot be freely chosen, but must adhere to the forms presented below. |
Include
$Include(File) $Include(File:TrackPositionOffset) $Include(File1; Weight1; File2; Weight2; ...) |
Filei: A file to include of the same format (CSV/RW) as the main file. Weighti: A positive floating-point number giving a probability weight for the corresponding file. |
This directive chooses randomly from the specified files based on their associated probabilities and includes the content from one selected file into the main file. The content is copied into the place of the $Include directive, meaning that you need to take care of track positions and the last used With statement, for example. If the last weight in the argument sequence is omitted, it is treated as 1.
The $Include directive is useful for splitting up a large file into smaller files, for sharing common sections of code between multiple routes, and for choosing randomly from a larger block of code. Please note that the included files may themselves include other files, but you need to make sure that there are no circular dependencies, e.g. file A including file B, and file B including file A, etc. You should use a file extension different from .csv for included files so that users cannot accidentally select them in the main menu (except where this is desired).
If any of the Filei is followed by :TrackPositionOffset, then all expressions in the included file are offset by the specified track position in meters. For example, $Include(stations.include:2000) shifts all track positions in the part.include file by 2000 meters before including them. It is important to understand that "track positions" are not actually understood until after the $-directives have been processed, so all expressions in the included file are simply flagged to be offset later should they form track positions then. This means that if the included file contains expressions such as 1$Rnd(2;8)00, these are offset, too, even though at this stage, they do not form track positions yet.
⚠ | The track position offset feature is only available in the development release 1.2.11 and above. |
$Chr(Ascii)
$Chr(Ascii) |
Ascii: An integer in the range from 20 to 127, or 10 or 13, corresponding to an ASCII character of the same code. |
This directive is replaced by the ASCII character represented by Ascii. This is useful if you want to include characters that are part of syntax rules or would be stripped away. A list of relevant characters:
Code | Meaning | Character |
---|---|---|
10 | Newline | newline |
13 | Newline | newline |
20 | Space | space |
40 | Opening parantheses | ( |
41 | Closing parantheses | ) |
44 | Comma | , |
59 | Semicolon | ; |
The sequence $Chr(13)$Chr(10) is handled as a single newline. Inserting $Chr(59) can be interpreted as a comment starter or as an argument separator, depending on where it is used.
Start
$Rnd(Start; End) |
Start: An integer representing the lower bound. End: An integer representing the upper bound. |
This directive is replaced by a random integer in the range from Start to End. It is useful to add randomness to a route.
Example for the use of the $Rnd directive: | |
▶ | 10$Rnd(3;5)0, Track.FreeObj 0; 1 |
Possible outcome from the previous example is exactly one of these lines: | |
▶ | 1030, Track.FreeObj 0; 1 1040, Track.FreeObj 0; 1 1050, Track.FreeObj 0; 1 |
$Sub(Index)
$Sub(Index) = Expression |
Index: A non-negative integer representing the index of a variable. Expression: The expression to store in the variable. |
This directive should only appear as a single expression. It is used to assign Expression to a variable identified by Index. The whole $Sub directive is replaced by an empty string once the assignment is done. It is useful for storing values obtained by the $Rnd directive in order to reuse the same randomly-generated value. See the following definition of the $Sub(Index) directive for examples.
⚠ | Implementation note: While it is also possible to store non-numeric strings, it is not possible to include commas via $Chr(44) and have them work as a statement separator. However, it is possible to store a semicolon as the first character via $Chr(59) and have it work as a comment. For conditional expressions, you should use $Include or $If, though. |
Index
$Sub(Index) |
Index: A non-negative integer representing the index of the variable to retrieve. |
This directive is replaced by the content of the variable Index. The variable must have been assigned prior to retrieving it.
Example for the use of the $Sub(Index)=Value and $Sub(Index) directives: | |
▶ | $Sub(0) = $Rnd(3; 5) 1000, Track.FreeObj $Sub(0); 47 1020, Track.FreeObj $Sub(0); 47 1040, Track.FreeObj $Sub(0); 47 |
In the previous example, all three Track.FreeObj commands are guaranteed to use the same randomly-generated value in order to place a free object on the same rail. If you inserted the $Rnd(3;5) directive in each of the three lines individually, the objects could be placed on different rails each time.
$If(Condition)
$If(Condition) |
Condition: A number that represents false if zero, and true otherwise. |
The $If directive allows to only process subsequent expressions if the specified condition evaluates to true (any non-zero number). $If must be followed by $EndIf in any subsequent expression. Optionally, an $Else directive may appear between $If and $EndIf.
$Else()
$Else() |
The $Else directive allows to only process subsequent expressions if the condition in the preceding $If evaluated to false (zero).
$EndIf()
$EndIf() |
The $EndIf directive marks the end of an $If block that was started previously.
Example of $If, $Else and $EndIf | |
▶ | $Sub(1) = 0 With Track $If($Sub(1)) 1020, .FreeObj 0; 1 1040, .FreeObj 0; 2 $Else() 1030, .FreeObj 0; 3 $EndIf() |
Another example of $If, $Else and $EndIf | |
▶ | With Track 1050 $If($Rnd(0;1)), .FreeObj 0; 4, $Else(), .FreeObj 0; 5, $EndIf() |
It is possible to nest $If blocks. If you place $If/$Else/$EndIf on separate lines, you may want to employ indentation to improve readability of the block structure (as in the first example).
After the $-directives
Finally, after the $-directives have been processed, all expressions in the route file are sorted according to their associated track positions.
Example of a partial route file: | |
▶ | 1000, Track.FreeObj 0; 23 1050, Track.RailType 0; 1 10$Rnd(3;7)0, Track.Rail 1; 4 Track.FreeObj 1; 42 |
Preprocessing the $Rnd directive (assuming 3 is produced): | |
▶ | 1000, Track.FreeObj 0; 23 1050, Track.RailType 0; 1 1030, Track.Rail 1; 4 Track.FreeObj 1; 42 |
Sorting by associated track positions: | |
▶ | 1000, Track.FreeObj 0; 23 1030, Track.Rail 1; 4 Track.FreeObj 1; 42 1050, Track.RailType 0; 1 |
The Options namespace
Commands from this namespace provide generic options that affect the way other commands are processed. You should make use of commands from this namespace before making use of commands from other namespaces.
Options.UnitOfLength FactorInMeters1; FactorInMeters2; FactorInMeters3; ...; FactorInMetersn |
FactorInMetersi: A floating-point number representing how many meters the desired unit has. The default value is 1 for FactorInMeters1, and 0 for all others. |
This command can be used to specify the unit of length to be used in other commands. When entering a generic track position of the form Part1:Part2:...:Partn, each of the Parti will be multipled with the corresponding FactorInMetersi, then all of these products are added to form a single track position represented in meters. Ideally, you should set the block length to an integer multiple of any of the units you use via Options.BlockLength.
Examples of conversion factors:
Desired unit | Conversion factor |
---|---|
mile | 1609.344 |
chain | 20.1168 |
meter | 1 |
yard | 0.9144 |
foot | 0.3048 |
In the following, all arguments of all commands are highlighted in green whenever they are affected by Options.UnitOfLength.
Options.UnitOfSpeed FactorInKmph |
FactorInKmph: A floating-point number representing how many kilometes per hour the desired unit has. The default value is 1. |
This command can be used to specify the unit of speed to be used in other commands. Examples of conversion factors:
Desired unit | Conversion factor |
---|---|
meters/second | 3.6 |
miles/hour | 1.609344 |
kilometers/hour | 1 |
In the following, all arguments of all commands are highlighted in blue whenever they are affected by Options.UnitOfSpeed.
Options.BlockLength Length |
Length: A positive floating-point number representing the length of a block, by default measured in meters. The default is 25 meters. |
This command can be used to specify the length of a block. This is an overall setting and cannot be changed in the middle of the route. Length is only expressed in the unit specified by Options.UnitOfLength if Options.UnitOfLength is used before Options.BlockLength.
Options.ObjectVisibility Mode |
Mode: The mode determining how objects appear and disappear. The default value is 0. |
▸ Available options for Mode: |
0: Legacy: An object is made invisible as soon as the end of the block which it resides in has been passed by the camera. This does not work well when turning the camera around. Self-intersecting track (e.g. loops) is not possible. 1: Track-based: An object is made invisible as soon as its end has been passed by the camera. This is measured in track positions. Self-intersecting track (e.g. loops) is not possible. |
Options.SectionBehavior Mode |
Mode: The mode determining how the Track.Section command is processed. |
▸ Available options for Mode: |
0: Default: In Track.Section Aspect0; Aspect1; ...; Aspectn, any of the Aspecti refer to the aspect the section should have if i following sections are clear. 1: Simplified: In Track.Section Aspect0; Aspect1; ...; Aspectn, the section bears the smallest aspect which is higher than that of the following section. |
Options.CantBehavior Mode |
Mode: The mode determining how cant in the Track.Curve command is processed. |
▸ Available options for Mode: |
0: Unsigned: The CantInMillimeters parameter in Track.Curve is unsigned, i.e. the sign is ignored and the superelevation is always towards the curve center (inward). Cant cannot be applied on straight track. 1: Signed: The CantInMillimeters parameter in Track.Curve is signed, i.e. negative values bank outward and positive ones inward on curved track. Cant can be applied on straight track, where negative values bank toward the left and positive ones toward the right. |
Options.FogBehavior Mode |
Mode: The mode determining how the Track.Fog command is processed. The default value is 0. |
▸ Available options for Mode: |
0: Block-based: Fog color and ranges are interpolated from the beginning of the block where Track.Fog is used with the old settings to the end of the block with the new settings. 1: Interpolated: Fog color and ranges are interpolated between adjacent Track.Fog commands. This behavior mimicks Track.Brightness. |
■ 5. The Route namespace
Commands from this namespace define general properties of the route.
Route.Comment Text |
Text: The route comments which appear in the route selection dialog. |
⚠ | You need to use $Chr directives if you want to include newlines, commas and the like in the text. |
Route.Image File |
File: The file name of the image which appears in the route selection dialog, relative to the route's folder. |
Route.Timetable Text |
Text: The text which appears at the top of the default timetable. |
⚠ | You need to use $Chr directives if you want to include newlines, commas and the like in the text. |
Route.Change Mode |
Mode: The mode for the train's safety system to start in. The default value is implementation-specific. |
▸ Available options for Mode: |
-1: The safety system is activated and the service brakes are applied. 0: The safety system is activated and the emergency brakes are applied. 1: The safety system is deactivated and the emergency brakes are applied. |
Route.Gauge ValueInMillimeters |
ValueInMillimeters: A floating-point number representing the rail gauge, measured in millimeters (0.001 meters). The default value is 1435. |
☀ | Note: |
Route.Gauge is the same as Train.Gauge. |
Route.Signal(AspectIndex).Set Speed |
AspectIndex: A non-negative integer representing the signal aspect. The aspect 0 corresponds to red. Speed: A non-negative floating-point number representing the allowed speed for this aspect, by default measured in kilometers per hour (km/h). |
Use this command to associate speed limits to signal aspects. Aspect 0 represents a red signal, higher values represent more permissive aspects. The default values (for the included Japanese signals) are:
Index | Aspect | Speed |
---|---|---|
0 | ● | 0 km/h |
1 | ●● | 25 km/h |
2 | ● | 55 km/h |
3 | ●● | 75 km/h |
4 | ● | unlimited |
5 | ●● | unlimited |
Route.RunInterval Interval0; Interval1; ...; Intervaln-1 |
Intervali: A floating-point number representing the time interval between the player's train's timetable and that of another train to be created, measured in seconds. Positive values indicate an earlier train, negative numbers a later train. |
This command creates one or more preceding or following trains. These other trains are visible, fully operational, and use the same train as the player has. The other trains follow the same schedule as the player does, but are offset in time by Intervali. Via the Track.Sta command, you can also define stations where only the player or only the other trains should stop. Follow-up trains only appear once the section they are placed in has been cleared by other trains, but the player's train is introduced regardless of the current signalling section's state. Therefore, you should make sure that other trains have cleared the area where the player's train will appear when the scenario begins.
☀ | Note: |
Route.RunInterval is the same as Train.Interval. |
Route.AccelerationDueToGravity Value |
Value: A positive floating-point number representing the acceleration due to gravity in meters per second squared (m/s²). The default value is 9.80665. |
Route.Elevation Height |
Height: A floating-point number representing the initial height above sea level, by default measured in meters (m). The default value is 0. |
Route.Temperature ValueInCelsius |
Value: A floating-point number representing the initial temperature in Celsius. The default value is 20. |
Route.Pressure ValueInKPa |
ValueInKPa: A positive floating-point number representing the initial air pressure in kPa (1000 Pascal). The default value is 101.325. |
Route.AmbientLight RedValue; GreenValue; BlueValue |
RedValue: An integer ranging from 0 to 255 representing the red component of the ambient light. The default value is 160. GreenValue: An integer ranging from 0 to 255 representing the green component of the ambient light. The default value is 160. BlueValue: An integer ranging from 0 to 255 representing the blue component of the ambient light. The default value is 160. |
This command defines the ambient light color to be used. All polygons in the scene are illuminated by the ambient light regardless of the light direction.
Route.DirectionalLight RedValue; GreenValue; BlueValue |
RedValue: An integer ranging from 0 to 255 representing the red component of the directional light. The default value is 160. GreenValue: An integer ranging from 0 to 255 representing the green component of the directional light. The default value is 160. BlueValue: An integer ranging from 0 to 255 representing the blue component of the directional light. The default value is 160. |
This command defines the directional light to be used. The polygons in the scene are only fully illuminated by the directional light if the light direction points at the front faces. If pointing at back faces, no light is contributed. Route.LightDirection should be set to specify the light direction.
Route.LightDirection Theta; Phi |
Theta: A floating-point number representing the angle in degrees which controls the pitch of the light direction. The default value is 60. Phi: A floating-point number representing the angle in degrees which controls the planar rotation of the light direction. The default value is about -26.57. |
This command defines the initial light direction for track position 0. This is the direction the light shines at, meaning the opposite direction the sun is located at. First, Theta determines the pitch. A value of 90 represents a downward direction, while a value of -90 represents an upward direction. With those extremes, the value of Phi is irrelevant. A value of 0 for Theta represents a forward direction originating at the horizon behind. Once the pitch is defined by Theta, Phi determines the rotation in the plane. A value of 0 does not rotate, a value of 90 rotates the direction to the right and a value of -90 rotates to the left. A backward direction can be both obtained by setting Theta and Phi to 180 and 0 or to 0 and 180, respectively. Values in-between allow for more precise control of the exact light direction.
File:Illustration light direction.png
Converting a spherical direction (theta,phi) into a cartesian direction (x,y,z): | |
ƒ | x = cos(theta) * sin(phi) y = -sin(theta) z = cos(theta) * cos(phi) |
Converting a cartesian direction (x,y,z) into a spherical direction (theta,phi) for y²≠1: | |
ƒ | theta = -arctan(y/sqrt(x2+z2)) phi = arctan(z,x) |
Converting a cartesian direction (x,y,z) into a spherical direction (theta,phi) for y²=1: | |
ƒ | theta = -y * pi/2 phi = 0 |
In the formulas above, cos(x) represents the cosine, sin(x) the sine, arctan(x) the inverse tangent, arctan(x,y) the two-argument inverse tangent and sqrt(x) the square root. The formulas can be used to convert between spherical and cartesian coordinates if working with either one seems more intuitive than working with the other one. The formulas also serve as the official documentation on how the light direction is mathematically defined (using radians for the trigonometric functions).
Route.DeveloperID |
This command is ignored by openBVE. |
■ 6. The Train namespace
Commands from this namespace define route-train associations.
Train.Folder FolderName Train.File FolderName |
FolderName: The folder name of the default train to use on this route. |
Train.Run(RailTypeIndex).Set RunSoundIndex Train.Rail(RailTypeIndex).Set RunSoundIndex |
RailTypeIndex: A non-negative integer representing the rail type as defined via Structure.Rail and used via Track.RailType. RunSoundIndex: A non-negative integer representing the train's run sound to associate to the rail type. |
The train developer provides a repertoire of different run sounds. Use this command to associate these run sounds to the rail types you use in your route. In order for the correct run sounds to be played on any of your rail types, you need to coordinate your efforts with the train developer. Please see the page about standards for further information.
Train.Flange(RailTypeIndex).Set FlangeSoundIndex |
RailTypeIndex: A non-negative integer representing the rail type as defined via Structure.Rail and used via Track.RailType. RunSoundIndex: A non-negative integer representing the train's flange sound to associate to the rail type. |
The train developer provides a repertoire of different flange sounds. Use this command to associate these flange sounds to the rail types you use in your route. In order for the correct flange sounds to be played on any of your rail types, you need to coordinate your efforts with the train developer. Please see the page about standards for further information.
Train.Timetable(TimetableIndex).Day.Load FileName |
TimetableIndex: A non-negative integer representing the timetable index. FileName: The file name for the daytime version of the timetable, relative to the train's folder (1st choice), or relative to the Object folder (2nd choice). |
Use this command to load daytime versions of the timetable. Which timetable index to show starting with a particular station can be set in Track.Sta commands.
Train.Timetable(TimetableIndex).Night.Load FileName |
TimetableIndex: A non-negative integer representing the timetable index. FileName: The file name for the daytime version of the timetable, relative to the train's folder (1st choice), or relative to the Object folder (2nd choice). |
Use this command to load nighttime versions of the timetable. Which timetable index to show starting with a particular station can be set in Track.Sta commands.
Train.Gauge ValueInMillimeters |
ValueInMillimeters: A floating-point number representing the rail gauge, measured in millimeters (0.001 meters). The default value is 1435. |
☀ | Note: |
Train.Gauge is the same as Route.Gauge. |
Train.Interval Interval0; Interval1; ...; Intervaln-1 |
ValueInSeconds: A floating-point number representing the time interval between the player's train and the preceding train, measured in seconds. The default value is 0. |
Same as Route.RunInterval. See there for more information.
Train.Velocity Speed |
Speed: A positive floating-point number representing the maximum speed the preceding trains may travel at, by default measured in kilometers per hour, or 0 for infinite speed. The default value is 0. |
This command defines the maximum speed limit the preceding trains may travel at. The actual speed limit may be reduced by Track.Limit commands. The player's train is unaffected by this setting and may travel up to the limits defined by Track.Limit.
Train.Acceleration |
This command is ignored by openBVE. |
Train.Station |
This command is ignored by openBVE. |
■ 7. The Structure namespace
The commands in the Structure namespace define which objects to use in other commands. Generally, commands like Track.Rail, Track.FreeObj and so on create objects referenced by a StructureIndex. This StructureIndex is specific to that command, so you can define a set of objects specific to Track.Rail, Track.FreeObj and so on.
The general syntax for commands in the Structure namespace is:
Structure.Command(StructureIndex).Load FileName |
StructureIndex is a non-negative integer. FileName is the object file to load, relative to the Object folder. Command is any of the following commands:
Command: | Remarks |
---|---|
Ground | Defines objects for Cycle.Ground and Track.Ground. |
Rail | Defines objects for Track.Rail, Track.RailStart and Track.RailType. |
WallL | Defines left objects for Track.Wall. |
WallR | Defines right objects for Track.Wall. |
DikeL | Defines left objects for Track.Dike. |
DikeR | Defines right objects for Track.Dike. |
FormL | Defines left platforms edges for Track.Form. |
FormR | Defines right platforms edges for Track.Form. |
FormCL | Defines transformable left platforms for Track.Form. No ANIMATED objects supported. |
FormCR | Defines transformable right platforms for Track.Form. No ANIMATED objects supported. |
RoofL | Defines left roof edges for Track.Form. |
RoofR | Defines right roof edges for Track.Form. |
RoofCL | Defines transformable left roofs for Track.Form. No ANIMATED objects supported. |
RoofCR | Defines transformable rigth roofs for Track.Form. No ANIMATED objects supported. |
CrackL | Defines transformable left objects for Track.Crack. No ANIMATED objects supported. |
CrackR | Defines transformable right objects for Track.Crack. No ANIMATED objects supported. |
FreeObj | Defines objects for Track.FreeObj. |
Beacon | Defines objects for Track.Beacon. |
Generally, supported objects are B3D, CSV, X and ANIMATED. However, the FormCL, FormCR, RoofCL, RoofCR, CrackL and CrackR commands only accept B3D, CSV and X objects.
➟ More information about forms, roofs and cracks...
Additionally, there is the Structure.Pole command, which has a slightly different syntax:
Structure.Pole(NumberOfAdditionalRails; PoleStructureIndex).Load FileName |
NumberOfAdditionalRails: An non-negative integer representing the number of additional rails covered by the pole. 0 creates a pole for one rail, 1 for two rails, etc. PoleStructureIndex: A non-negative integer representing the pole structure index. FileName: The object file to load, relative to the Object folder. |
Please note that all objects but the FreeObj are inserted at the beginning of a block and should thus extend from 0 to BlockLength (by default 25m) on the z-axis. For further information on usage, see the respective commands from the Track namespace.
■ 8. The Texture namespace
Commands from this namespace define which background images to use and how they are aligned.
File:Illustration background.png
The background image is displayed as a cylindric wall around the camera whose start (viewed from above) is 60 degrees to the left of the initial forward direction (at the 10 o'clock position). From there, the background image wraps clock-wise around the cylinder with a repetition count specified via Texture.Background(BackgroundTextureIndex).X, which by default creats 6 repetitions in a full circle.
The upper 3/4 of the image is displayed above the horizon, while the lower 1/4 is displayed below the horizon. Via Texture.Background(BackgroundTextureIndex).Aspect, you can choose whether to have a fixed cylinder height or to preserve the aspect ratio of the texture. If the image should have a fixed height, the cylinder has a height of 1/2 its radius, which corresponds to about 20 degree inclination to the top of the image, and about -7 degrees to the bottom of the image. If the aspect ratio of the image is preserved, this takes not only the width and height of the image into account, but also the repetition count.
Regardless of the repetition count you chose, you should make sure that the left and right edges of the textures fit seamlessly together. Please also take into account that top and bottom caps are created which sample from the top and bottom 10% of the image. You should avoid mountain peaks and similar extremes in the top 10% of the image in order for such extremes to not leak into the top cap.
The image loaded into Texture.Background(0) is displayed at the beginning of the route, unless a Track.Back command at the beginning of the route requests a different image.
Texture.Background(BackgroundTextureIndex).Load FileName |
FileName: The texture file to load, relative to the Object folder. |
This command loads a background image to be later used by Track.Back.
Texture.Background(BackgroundTextureIndex).X RepetitionCount |
RepetitionCount: The number of times the background image is repeated in a full circle. The default value is 6. |
Texture.Background(BackgroundTextureIndex).Aspect Mode |
Mode: The mode of aspect ratio handling to use. The default value is 0. |
▸ Options for Mode: |
0: Use a fixed height for the cylinder. 1: Preserve the aspect ratio of the image. |
■ 9. The Cycle namespace
Cycle.Ground(GroundStructureIndex).Params GroundStructureIndex0; GroundStructureIndex1; GroundStructureIndex2; ...; GroundStructureIndexn-1 |
GroundStructureIndex: A non-negative integer indicating the ground structure index for which a cycle is to be defined. GroundStructureIndexi: A non-negative integer indicating a ground structure that has been previously loaded via Structure.Ground. |
When usually using Track.Ground(GroundStructureIndex), the same ground structure object will be repeatedly placed in every block. Via Cycle.Ground, you can override this behavior and automatically cycle through a series of different objects when using Track.Ground(GroundStructureIndex). The cycle repeats indefinately, where GroundStructureIndex0 starts at track position 0. Technically, the i in GroundStructureIndexi chosen for a particular track position p is Mod[p / BlockLength, n].
Consider the following definition:
' | |
▶ | With Structure .Ground(0) grass.csv .Ground(1) river.csv .Ground(2) asphalt.csv |
The following two codes will produce the same output:
' | |
▶ | With Track 0, .Ground 0 25, .Ground 1 50, .Ground 2 75, .Ground 0 100, .Ground 1 125, .Ground 2 ; and so on... |
' | |
▶ | With Cycle .Ground(0) 0; 1; 2 With Track 0, .Ground 0 |
■ 10. The Signal namespace
Commands from this namespace define custom signals.
Signal(SignalIndex).Load AnimatedObjectFile |
SignalIndex: A non-negative integer representing the signal index. AnimatedObjectFile: A reference to an animated object file, relative to the Object folder. |
Use this command to load signals directly from animated objects. The SignalIndex can be later referenced in Track.SigF commands to place the signal.
Signal(SignalIndex).Load SignalFileWithoutExtension; GlowFileWithoutExtension |
SignalIndex: A non-negative integer representing the signal index. SignalFileWithoutExtension: A reference to a B3D/CSV/X object file representing the signal, relative to the Object folder, but without the file extension. Is required to be specified. GlowFileWithoutExtension: An optional reference to a B3D/CSV/X object file representing the distance glow, relative to the Object folder, but without the file extension. |
Use this command to load signals from a series of individual textures applied onto a common object. openBVE looks for X, CSV and B3D objects in this exact order. Textures are required to have the same name as the signal or glow, plus a non-negative aspect index, plus a file extension for textures. The SignalIndex can be later referenced in Track.SigF commands to place the signal.
For the SignalFileWithoutExtension, there should be the following files present (example):
SignalFileWithoutExtension.x
SignalFileWithoutExtension0.bmp
SignalFileWithoutExtension1.bmp
SignalFileWithoutExtension2.bmp
SignalFileWithoutExtensionn.bmp
The aspect indices from 0 through n represent successively more permissive aspects, where 0 is red. The built-in signals, for example, use the indices 0 (●), 1 (●●), 2 (●), 3 (●●), 4 (●) and 5 (●●). You can use as many as required.
All faces in the object will be applied the currently active aspect texture. This means that you cannot use any other texture in the object, but still have to assign texture coordinates appropriately. For the glow object, the above rules also apply. The glow object is usually a rectangle placed clearly in front of the signal, although you can also use different shapes.
The glow textures deserve special attention. All glow textures are pre-processed in the following way:
A | B | C | D | E | F |
---|---|---|---|---|---|
The texture you start with should have a sharp shape, usually oval. The shape should be fully saturated in the core and blend into pure white at its outer rim. The surroundings of the shape can be either pure black (A) or pure white (B).
When openBVE loads the glow texture, it will replace all purely black pixels with purely white pixels, thus arriving at (B). From there, the image is inverted (C), then hue-shifted by 180 degrees (D). Compared to (B), this has the overall effect of inverting the lightness of the image, i.e. fully saturated pixels will be left unchanged (e.g. the core), while bright pixels (such as the outer rim of the shape) will become dark, and vice versa. Then, the image is gamma-corrected to further darken the dark parts (E), and finally, the image is blurred slightly (F).
The resulting texture is always additively blended. This means that instead of directly drawing the texture onto the screen, the pixels of the texture are added to the screen pixels. Here, adding black (0) does not change the screen pixels, while adding a fully satured color channel (1) will result in a fully satured color channel, e.g. adding white produces white. Keep in mind that when designing the textures, you will have to follow the inverse rules, e.g. design the image as depicted in (A) or (B), while having in mind how it will be processed afterward.
■ 11. The Track namespace
Commands from this namespace define the track layout. Commands from this namespace should appear after commands from any of the other namespaces, and they usually form the largest part of the route file.
ⓘ Use of track positions |
All commands from the Track namespace need to be associated to track positions. Once a track position has been defined, all subsequent commands are associated to this track position until a new track position is defined. If you do not explicitly state a track position before the first command of the Track namespace is used, 0 will be assumed. While you do not need to use track positions in ascending order, series of commands which are associated the same track position will be sorted into ascending order once the file is loaded. While track positions can be any non-negative floating-point number, many commands in the Track namespace are only to be applied at the beginning of a block, which is 25m by default. For the default situation, this means that some commands are only to be used at track positions 0, 25, 50, 75, 100, 125 and so on. All commands for which this restriction applies are marked as such. |
● 11.1. Rails
Track.RailStart RailIndex; X; Y; RailType |
RailIndex: A positive integer (>=1) indicating which rail index to use. X: A floating-point number representing the horizontal distance from the player's rail, by default measured in meters. Negative values indicate left, positive ones right. Y: A floating-point number representing the vertical distance from the player's rail, by default measured in meters. Negative values indicate below, positive ones above. RailType: A non-negative integer referencing the rail type to use as defined by a Structure.Rail command. |
This command starts a new rail represented by the index RailIndex. Upon the point where this command is used, a rail of the same RailIndex must either not have been used so far in the route, or must have been ended via a Track.RailEnd command. If a rail of the same RailIndex was already used in the route, the default values of X, Y and RailType are the values last used by that rail, otherwise 0. If the rail is to be updated, use the Track.Rail command. If it is to be ended, use the Track.RailEnd command. You can end a rail of a given RailIndex and start a new rail of the same RailIndex at the same track position provided that the old rail is first ended and the new rail started afterward. For every block, a structure, determined by RailType, is automatically placed.
⚠ | This command can only be used at the beginning of a block. |
Track.Rail RailIndex; X; Y; RailType |
RailIndex: A positive integer (>=1) indicating which rail index to use. X: A floating-point number representing the horizontal distance from the player's rail, by default measured in meters. Negative values indicate left, positive ones right. Y: A floating-point number representing the vertical distance from the player's rail, by default measured in meters. Negative values indicate below, positive ones above. RailType: A non-negative integer referencing the rail type to use as defined by a Structure.Rail command. |
This command starts a new rail or updates an existing rail. The rail is represented by the index RailIndex. If a rail of the same RailIndex was already used in the route, the default values of X, Y and RailType are the values last used by that rail, otherwise 0. If the rail is to be ended, use the Track.RailEnd command. You can end a rail of a given RailIndex and start a new rail of the same RailIndex at the same track position provided that the old rail is first ended and the new rail started afterward. In each block, the X and Y values are repeated if a Track.Rail command is not used for that block. As a consequence, updating the X or Y values affects the layout of the rail from the preceding block only. Changing the RailType will affect the rail from the point on where this command is used. If this command is used multiple times on the same track position for the same rail, then the first instance of the command takes effect, while subsequent ones are ignored.
⚠ | This command can only be used at the beginning of a block. |
ⓘ Track.RailStart vs. Track.Rail |
If you want to start a new rail, you can either use Track.RailStart or Track.Rail. When using Track.RailStart, you provide markup that a new rail is in fact to be started, which is invalid if the rail already exists. Using an explicit Track.RailStart will protect you from using a RailIndex which is already in use, in which case an error message is generated. |
Track.RailType RailIndex; RailType |
RailIndex: A non-negative integer indicating which rail index to change. The player's rail can be referred to with index 0. The default value is 0. RailType: A non-negative integer referencing the rail type to use as defined by a Structure.Rail command. The default value is 0. |
This command changes the rail type for an existing rail, represented by RailIndex. The rail must have been started with a Track.RailStart or Track.Rail command and must not have been ended by a Track.RailEnd command. Changing the RailType will affect the rail from the point on where this command is used.
⚠ | This command can only be used at the beginning of a block. |
Track.RailEnd RailIndex; X; Y |
RailIndex: A positive integer (>=1) indicating which rail index to use. X: A floating-point number representing the horizontal distance from the player's rail, by default measured in meters. Negative values indicate left, positive ones right. Y: A floating-point number representing the vertical distance from the player's rail, by default measured in meters. Negative values indicate below, positive ones above. |
This command ends an existing rail, represented by the index RailIndex. The default values of X and Y are the ones last used by the rail. Once this command is used for a specific RailIndex, the corresponding rail is considered to be non-existing afterward.
⚠ | This command can only be used at the beginning of a block. |
Example of Track.RailStart, Track.Rail, Track.RailType and Track.RailEnd commands | |
▶ | With Track 1000, .RailStart 1; 3.8; 0.0; 0 1025, .RailType 1; 1 1050, .Rail 1; 1.9; 0.0; 0 1075, .RailEnd 1 |
In the preceding example, rail 1 starts with an x-value of 3.8 and bears a rail index which corresponds to an object intended to depict a straight rail. The rail keeps the x-value of 3.8 at track position 1025, where the rail type is changed to correspond to an object intended to depict an s-shaped curve. At track position 1050, the rail is redefined to have an x-value of 1.9, after which the rail is straight again until 1075, where it is ended, still having an x-value of 1.9.
Track.Accuracy Value |
Value: A non-negative floating-point number representing the accuracy of the track. The default value is 2. |
This command sets the accuracy of the track from this point on. Values should be in the range from 0 to 4, where 0 means perfect accuracy (no inaccuracy at all), 1 means very good accuracy (high speed lines), 2 means good accuracy, 3 means mediocre accuracy, and 4 means poor accuracy. Intermediate values are also possible. Currently, values below 0 are clamped at 0, and values above 4 are clamped at 4.
Track.Adhesion Rate |
Rate: A non-negative floating-point number measured in percent representing the adhesion of the track. The default value is 100. |
This command sets the adhesion of the track from this point on. As a reference, the value of 135 represents dry conditions, 85 represents frost and 50 represents snowy conditions. With a value of 0, the train will not be able to move at all.
● 11.2. Geometry
Track.Pitch Rate |
Rate: A floating-point number measured in per thousands representing the pitch of the track. The default value is 0. |
This command defines the pitch of all rails from this point on. Negative values indicate a downward gradient, positive ones an upward gradient. The value of 0 represents a level track. Rate can be calculated from a length difference X and a height difference Y in the following way:
'Rate expressed through X and Y: | |
ƒ | Rate = 1000 * Y / X |
⚠ | This command can only be used at the beginning of a block. |
Track.Curve Radius; CantInMillimeters |
Radius: A floating-point number representing the radius of the curve, by default measured in meters. The default value is 0. CantInMillimeters: A floating-point number which represents the superelevation of a banked curve, always measured in millimeters (0.001 meters). The default value is 0. See also Options.CantBehavior. |
This command defines the radius of the curve for the player's rail from this point on. Negative values for Radius indicate a curve to the left, positive ones to the right. The value of 0 represents straight track. The CantInMillimeters parameter defines the cant (superelevation) in millimeters. If Options.CantBehavior is 0 (default), only the absolute value of CantInMillimeters is considered, and the superelevation is always towards the curve center (inward). Also, cant cannot be applied on straight track. If Options.CantBehavior is 1, CantInMillimeters is signed, i.e. negative values bank outward and positive ones inward on curved track. Also, cant can be applied on straight track, where negative values bank toward the left and positive ones toward the right.
⚠ | This command can only be used at the beginning of a block. |
Track.Turn Ratio |
Rate: A floating-point number representing a turn. The default value is 0. |
This command creates a point-based turn at the point of insertion. Ratio indicates the ratio between the length difference Z and the horizontal offset X in the following way:
' | |
ƒ | Ratio = X / Z |
A negative ratio represents a turn to the left, a positive one to the right. The value of 0 represents a straight track.
⚠ | This command can only be used at the beginning of a block. |
⚠ | This command is deprecated - use Track.Curve instead. |
Track.Height Y |
Y: A floating-point number representing the height of the player's rail, by default measured in meters. |
This command defines the height of the player's rail above the ground at the point of insertion. It influences the placement of the ground objects defined via Structure.Ground and changed via Track.Ground. The height is interpolated between adjacent Track.Height commands. For example, the following two codes produce equivalent results:
Example of a Track.Height command interpolated at 25m boundaries: | |
▶ | 1000, Track.Height 1 1075, Track.Height 4 |
Example of Track.Height explicitly set each 25m to produce the same result: | |
▶ | 1000, Track.Height 1 1025, Track.Height 2 1050, Track.Height 3 1075, Track.Height 4 |
⚠ | This command can only be used at the beginning of a block. |
● 11.3. Objects
Track.FreeObj RailIndex; FreeObjStructureIndex; X; Y; Yaw; Pitch; Roll |
RailIndex: A non-negative integer representing the rail on which to place the object. The default value is 0. FreeObjStructureIndex: A non-negative integer representing the object to place as defined via Structure.FreeObj. The default value is 0. X: The x-offset from the (straight) rail, by default measured in meters. Negative values represent the left, positive ones the right. The default value is 0. Y: The y-offset from the (straight) rail, by default measured in meters. Negative values represent below the top of the rails, positive ones above. The default value is 0. Yaw: The angle in degrees by which the object is rotated in the XZ-plane in clock-wise order when viewed from above. The default value is 0. Pitch: The angle in degrees by which the object is rotated in the YZ-plane in clock-wise order when viewed from the left. The default value is 0. Roll: The angle in degrees by which the object is rotated in the XY-plane in clock-wise order when viewed from behind. The default value is 0. |
This places a "free" object a single time on a specified rail. The object must have been loaded via Structure.FreeObj(FreeObjStructureIndex) prior to using this command.
Track.Wall RailIndex; Direction; WallStructureIndex |
RailIndex: A non-negative integer representing the rail on which to start or update the wall. The default value is 0. Direction: An integer indicating which wall to use as described below. WallStructureIndex: A non-negative integer representing the object to place as defined via Structure.WallL and Structure.WallR. The default value is 0. |
▸ Options for Direction: |
-1: The WallL object (left wall) is used. 0: Both the WallL and WallR objects are used. 1: The WallR object (right wall) is used. |
This starts or updates a wall on a specified rail. The object must have been loaded via Structure.WallL(WallObjectIndex) or Structure.WallR(WallObjectIndex) prior to using this command. The walls are placed at the beginning of every block until a corresponding Track.WallEnd ends the wall for this rail. Please note that walls are resurrected if a rail is ended via Track.RailEnd and then started again via Track.RailStart or Track.Rail unless the wall was also ended via Track.WallEnd.
⚠ | This command can only be used at the beginning of a block. |
Track.WallEnd RailIndex |
RailIndex: A non-negative integer representing the rail on which to end an existing wall. |
This ends an existing wall that was previously started via Track.Wall on a specified rail. The wall is not placed for the block in which this command is used.
⚠ | This command can only be used at the beginning of a block. |
Track.Dike RailIndex; Direction; DikeStructureIndex |
RailIndex: A non-negative integer representing the rail on which to start or update the dike. The default value is 0. Direction: An integer indicating which dike to use as described below. DikeStructureIndex: A non-negative integer representing the object to place as defined via Structure.DikeL and Structure.DikeR. The default value is 0. |
▸ Options for Direction: |
-1: The DikeL object (left dike) is used. 0: Both the DikeL and DikeR objects are used. 1: The DikeR object (right dike) is used. |
This starts or updates a dike on a specified rail. The object must have been loaded via Structure.DikeL(DikeObjectIndex) or Structure.DikeR(DikeObjectIndex) prior to using this command. The dikes are placed at the beginning of every block until a corresponding Track.DikeEnd ends the dike for this rail. Please note that dikes are resurrected if a rail is ended via Track.RailEnd and then started again via Track.RailStart or Track.Rail unless the dike was also ended via Track.DikeEnd.
⚠ | This command can only be used at the beginning of a block. |
Track.DikeEnd RailIndex |
RailIndex: A non-negative integer representing the rail on which to end an existing dike. |
This ends an existing dike that was previously started via Track.Dike on a specified rail. The dike is not placed for the block in which this command is used.
⚠ | This command can only be used at the beginning of a block. |
Track.Pole RailIndex; NumberOfAdditionalRails; Location; Interval; PoleStructureIndex |
RailIndex: A non-negative integer representing the rail on which to start or update the pole. The default value is 0. NumberOfAdditionalRails: A non-negative integer representing the amount of additional rails covered by this pole (i.e. this rail, plus NumberOfAdditionalRails rails). The default value is 0. Location: If NumberOfAdditionalRails is 0, the side on which the pole is placed (see below), or the x-offset in multiples of 3.8 meters if NumberOfAdditionalRails is at least 1. The default value is 0. Interval: An integer multiple of the block length specifying the interval in which poles are placed. PoleStructureIndex: A non-negative integer representing the object to place as defined via Structure.Pole. The default value is 0. |
This starts or updates a pole on a specified rail. The object must have been loaded via Structure.Pole(NumberOfAdditionalRails; PoleStructureIndex) prior to using this command. The poles are placed at the beginning of every block whose track positions are an integer multiple of the Interval (that is not necessarily at the same location this command is placed). If NumberOfAdditionalRails is 0, Location indicates the side of the rail on which the pole is placed. If Location is less than or equal to 0, the pole is placed as-is (corresponding to the left side). If Location is greater than 0, the object is mirrored on the x-axis and then placed (corresponding to the right side). If NumberOfAdditionalRails is greater than or equal to 1, Location specifies the x-offset in multiples of 3.8 meters. Please note that poles are resurrected if a rail is ended via Track.RailEnd and then started again via Track.RailStart or Track.Rail unless the pole was also ended via Track.PoleEnd.
⚠ | This command can only be used at the beginning of a block. |
Track.PoleEnd RailIndex |
RailIndex: A non-negative integer representing the rail on which to end an existing pole. |
This ends an existing pole that was previously started via Track.Pole on a specified rail. The pole is not placed for the block in which this command is used.
⚠ | This command can only be used at the beginning of a block. |
Track.Crack RailIndex1; RailIndex2; CrackStructureIndex |
File:Construction 16.png Description not available yet. |
Track.Ground CycleIndex |
CycleIndex: A non-negative integer representing the cycle of ground objects to place as defined via Structure.Ground or Cycle.Ground. |
This defines which ground objects to place from this point on. Ground objects are always placed at the beginning of a block at a certain height below the player's rail (as defined via Track.Height). If no cycle was defined for CycleIndex, then the object loaded into Structure.Ground(CycleIndex) is placed. Otherwise, the cycle of ground objects as defined via Cycle.Ground(CycleIndex) is used.
⚠ | This command can only be used at the beginning of a block. |
● 11.4. Stations
Track.Sta Name; ArrivalTime; DepartureTime; PassAlarm; Doors; ForcedRedSignal; System; ArrivalSound; StopDuration; PassengerRatio; DepartureSound; TimetableIndex |
Name: The name of the station. This is displayed in the timetable and in messages, so should not be omitted. ArrivalTime: The time the player's train is expected to arrive at this station. Special values may also appear - see below. DepartureTime: The time the player's train is expected to depart from this station. Special values may also appear - see below. PassAlarm: Indicates whether the pass alarm device should remind the driver of stopping at this station. The default value is 0. Doors: Indicates which doors should open at this station. The default value is 0. ForcedRedSignal: Indicates whether the signal behind the last station stop should be red on a train approach. The default value is 0. System: Indicates which built-in safety system should apply until the next station. The default value is 0. ArrivalSound: The sound file to be played on arrival, relative to the Sound folder. StopDuration: A positive floating-point number indicating the minimum stop duration in seconds, including door opening/closing times. The default value is 15. PassengerRatio: A non-negative floating-point number indicating the relative amount of passengers in the train from this station on. As a reference, 100 represents a train with normal amount of passengers, while 250 represents an over-crowded train. Values in-between 0 and 250 should be used. The default value is 100. DepartureSound: The sound file to be played before departure (departure time minus sound duration minus door closing time), relative to the Sound folder. TimetableIndex: A non-negative integer representing the timetable to be shown from this station on as defined via Train.Timetable(TimetableIndex). |
▸ Available options for ArrivalTime: |
time: The train is expected to arrive at this particular time. omitted: The train may arrive at any time. P or L: All trains are expected to pass this station. B: The player's train is expected to pass this station, while all other trains are expected to stop. S: The player's train is expected to stop at this station, while all other trains are expected to pass. S:time: The player's train is expected to arrive at this particular time, while all other trains are expected to pass. |
▸ Available options for DepartureTime: |
time: The train is expected to depart at this particular time. omitted: The train may depart at any time. T or =: This is the terminal station. If ForcedRedSignal is set to 1, the departure signal will be held at red indefinately. T:time: This is the terminal station. If ForcedRedSignal is set to 1, the departure signal will still switch to green before the specified time as if this was a regular station. C: This is a station at which to "change ends". See the description below. C:time: This is a station at which to "change ends". Changing ends will take place at the specified time unless StopDuration interferes. See the description below. |
▸ Available options for PassAlarm: |
0: The pass alarm device does not remind the driver of stopping at this station. 1: The pass alarm device reminds the driver of stopping at this station. |
▸ Available options for Doors: |
L or -1: The left doors are expected to open at this station. N or 0: No doors are expected to open at this station, i.e. the train should simply come to a hold. R or 1: The right doors are expected to open at this station. B: Both the left and right doors are expected to open at this station. |
▸ Available options for ForcedRedSignal: |
0: Signals are unaffected by this station. 1: The signal immediately following the last station stop is hold at red until the train reaches the stopping area and the departure time. |
▸ Available options for System: |
ATS or 0: ATS should be used from this station on. The following track is not be equipped with ATC. ATC or 1: ATC should be used from this station on. The following track is equipped with ATC. |
This command initializes a new station. It should be placed at the beginning of the station platform. In order to finalize the creation of a station, use the Track.Stop command to place stop points following this command. All following Track.Stop commands will be associated to this station. At least one Track.Stop command must follow if trains are expected to stop at this station.
Stations can be marked as "changing ends" in the departure time. At such stations, when the departure time has been reached, the train will automatically jump to the next station. This feature is intended to fake a reverse of traveling direction without the need to jump to stations manually from the menu.
⚠ | The "changing ends" feature is only available in the development release 1.2.11 and above. |
Track.Station Name; ArrivalTime; DepartureTime; ForcedRedSignal; System; DepartureSound |
Name: The name of the station. This is displayed in the timetable and in messages, so should not be omitted. ArrivalTime: The time the player's train is expected to arrive at this station. Special values may also appear - see below. DepartureTime: The time the player's train is expected to depart from this station. Special values may also appear - see below. ForcedRedSignal: Indicates whether the signal behind the last station stop should be red on a train approach. The default value is 0. System: Indicates which built-in safety system should apply until the next station. The default value is 0. DepartureSound: The sound file to be played before departure (departure time minus sound duration minus door closing time), relative to the Sound folder. |
▸ Available options for ArrivalTime: |
time: The train is expected to arrive at this particular time. omitted: The train may arrive at any time. P or L: All trains are expected to pass this station. B: The player's train is expected to pass this station, while all other trains are expected to stop. S: The player's train is expected to stop at this station, while all other trains are expected to pass. S:time: The player's train is expected to arrive at this particular time, while all other trains are expected to pass. |
▸ Available options for DepartureTime: |
time: The train is expected to depart at this particular time. omitted: The train may depart at any time. T or =: This is the terminal station. If ForcedRedSignal is set to 1, the departure signal will be held at red indefinately. T:time: This is the terminal station. If ForcedRedSignal is set to 1, the departure signal will still switch to green before the specified time as if this was a regular station. C: This is a station at which to "change ends". See the description below. C:time: This is a station at which to "change ends". Changing ends will take place at the specified departure unless StopDuration interferes. |
▸ Available options for ForcedRedSignal: |
0: Signals are unaffected by this station. 1: The signal immediately following the last station stop is hold at red until the train reaches the stopping area and the departure time. |
▸ Available options for System: |
ATS or 0: ATS should be used from this station on. The following track is not be equipped with ATC. ATC or 1: ATC should be used from this station on. The following track is equipped with ATC. |
This command initializes a new station. Prefer using the Track.Sta command, which includes more options. For the options of Track.Sta which are not offered by Track.Station, the following values apply:
PassAlarm | 0 (not used) |
Doors | B (both doors must be opened) |
ArrivalSound | Not played |
StopDuration | 15 |
PassengerRatio | 100 |
TimetableIndex | Not affected |
The command should be placed at the beginning of the station platform. In order to finalize the creation of a station, use the Track.Stop command to place stop points following this command. All following Track.Stop commands will be associated to this station. At least one Track.Stop command must follow if trains are expected to stop at this station.
Stations can be marked as "changing ends" in the departure time. At such stations, when the departure time has been reached, the train will automatically jump to the next station. This feature is intended to fake a reverse of traveling direction without the need to jump to stations manually from the menu.
⚠ | The "changing ends" feature is only available in the development release 1.2.11 and above. |
Track.Stop Direction; BackwardTolerance; ForwardTolerance; Cars |
Direction: On which side to place a default stop post. The default value is 0. BackwardTolerance: A positive floating-point number indicating the allowed tolerance in the backward direction, by default measured in meters. The default value is 5. ForwardTolerance: A positive floating-point number indicating the allowed tolerance in the forward direction, by default measured in meters. The default value is 5. Cars: A non-negative integer indicating for how many cars this stop point applies, or 0 for all cars. The default value is 0. |
▸ Available options for Direction: |
-1: A stop post is created on the left side. 0: No stop post is created. 1: A stop post is created on the right side. |
This command places a stop point for the last created station. If there is more than one stop defined for a station, a train is expected to stop at the first Track.Stop command for which Cars is greater than or equal to the number of cars the train has, where a value for Cars of 0 indicates a stop point regardless of the amount of cars to be used as the last stop point for a station.
Example of a station with multiple stop points: | |
▶ | With Track 0100, .Sta STATION 0178, .Stop 1;;;4 ,; for 4 or less cars 0212, .Stop 1;;;6 ,; for 5 or 6 cars 0246, .Stop 1;;;8 ,; for 7 or 8 cars 0280, .Stop 1;;;0 ,; for 9 or more cars |
Track.Form RailIndex1; RailIndex2; RoofStructureIndex; FormStructureIndex |
File:Construction 16.png Description not available yet. |
● 11.5. Signalling and speed limits
Track.Limit Speed; Post; Cource |
Speed: A positive floating-point number representing the speed, by default measured in km/h, or 0 to indicate no speed restriction. The default value is 0. Post: The side on which to place a default Japanese-style speed limit post. The default value is 0. Cource: The directional indication. The default value is 0. |
▸ Options for Post: |
-1: The post is placed on the left side of the track. 0: No post will be placed. 1: The post is placed on the right side of the track. |
▸ Options for Cource: |
-1: The post applies for a left-bound track. 0: The post does not indicate a particular direction. 1: The post applies for a right-bound track. |
This command defines the new speed limit from this point on. If the new speed limit is lower than the current speed limit, the new speed limit will take effect immediately. If the speed limit is higher than the current speed limit, the new speed limit will take effect only once the whole train has passed this point. By setting Speed to 0, the speed restriction is released. By setting Post to either -1 or 1, a default Japanese-style speed post is placed at the respective side of the track. Setting Course to either -1 or 1 includes a directional indication, which is usually used at railroad switches to indicate that the speed limit only applies if the respective direction is being taken. If Speed is set to 0, the setting of Course has no effect.
Track.Section a0; a1; a2; ...; an |
ai: A non-negative number specifying one of the section's aspects. |
This command starts a section, the functional part of signalling, to be used in conjunction with Track.SigF, which creates a visual representation of a section (a signal). The ai parameters specify the aspects the section can bear. An aspect of 0 corresponds to a red section which must not be passed by a train. The a0 term is mandatory.
ⓘ Default versus simplified section behavior |
There are two different modes of behavior on how to interpret the ai parameters. The mode can be set via Options.SectionBehavior. The following are separate descriptions for default and simplified behavior. |
Default behavior:
The ai terms specify the aspect the section should bear depending on how many sections ahead are clear until a red one is encountered. The order of the terms is relevant. The same aspect may occur multiple times.
▸ Meanings of the ai terms: |
a0: The aspect to show when this section is occupied by a train or otherwise hold at red. a1: The aspect to show when this section is clear, but the immediately following section is red. a2: The aspect to show when this section and the following section are clear, but the one immediately following the latter one is red. an: The aspect to show when n sections are clear before a red one is encountered. |
In the case more sections ahead are clear than indicated by the ai terms, the section will bear the aspect of an.
Simplified behavior:
The ai terms specify the repertoire of aspects the section can have. A section will bear the smallest of the ai which is greater than the current aspect of the upcoming section. If no such ai exists, the section will bear the aspect of an. The order of the ai is irrelevant. If the same aspect occurs multiple times, this has no effect.
Example of a Track.Section command in conjunction with a Track.SigF command: | |
▶ | With Track 1000, .Section 0;2;4, .SigF 3;0;-3;-1 |
Track.SigF SignalIndex; Section; X; Y; Yaw; Pitch; Roll |
SignalIndex: A non-negative integer representing the signal to be placed as defined via Signal(SignalIndex).Load. Section: A non-negative integer representing the section this signal is attached to, with 0 being the current section, 1 the upcoming section, 2 the section after that, and so on. X: The X-coordinate to place the signal object, by default measured in meters. The default value is 0. Y: The Y-coordinate to place the signal object, by default measured in meters. The default value is 0. Yaw: The angle in degrees by which the object is rotated in the XZ-plane in clock-wise order when viewed from above. The default value is 0. Pitch: The angle in degrees by which the object is rotated in the YZ-plane in clock-wise order when viewed from the left. The default value is 0. Roll: The angle in degrees by which the object is rotated in the XY-plane in clock-wise order when viewed from behind. The default value is 0. |
This command creates a non-function signal, that is, a visual representation of a section as defined via Track.Section. Setting Y to a negative number resets the y-coordinate to 4.8 meters and attaches a default signal post. Also see Track.Section.
If no object has been defined by Signal(SignalIndex), one of the default Japanese signals is used:
▸ Default signals for SignalIndex: |
3: A three-aspect signal having aspects ●red, ●yellow and ●green. 4: A four-aspect (type A) signal having aspects ●red, ●●yellow-yellow, ●yellow and ●green. 5: A five-aspect (type A) signal having aspects ●red, ●●yellow-yellow, ●yellow, ●●yellow-green and ●green. 6: A repeating signal equivalent to that created by Track.Relay. |
Track.Signal Aspects; Unused; X; Y; Yaw; Pitch; Roll Track.Sig Aspects; Unused; X; Y; Yaw; Pitch; Roll |
Type: The number of aspects for this signal. The default value is -2. Unused: This argument is not used by openBVE. X: The X-coordinate to place the signal object, by default measured in meters. The default value is 0. Y: The Y-coordinate to place the signal object, by default measured in meters. The default value is 0. Yaw: The angle in degrees by which the object is rotated in the XZ-plane in clock-wise order when viewed from above. The default value is 0. Pitch: The angle in degrees by which the object is rotated in the YZ-plane in clock-wise order when viewed from the left. The default value is 0. Roll: The angle in degrees by which the object is rotated in the XY-plane in clock-wise order when viewed from behind. The default value is 0. |
▸ Options for Type: |
File:Illustration signals small.png 2: A two-aspect (type A) signal having aspects ●red and ●yellow. -2: A two-aspect (type B) signal having aspects ●red and ●green. 3: A three-aspect signal having aspects ●red, ●yellow and ●green. 4: A four-aspect (type A) signal having aspects ●red, ●●yellow-yellow, ●yellow and ●green. -4: A four-aspect (type B) signal having aspects ●red, ●yellow, ●●yellow-green and ●green. 5: A five-aspect (type A) signal having aspects ●red, ●●yellow-yellow, ●yellow, ●●yellow-green and ●green. -5: A five-aspect (type B) signal having aspects ●red, ●yellow, ●●yellow-green, ●green and ●●green-green. 6: A six-aspect signal having aspects ●red, ●●yellow-yellow, ●yellow, ●●yellow-green, ●green and ●●green-green. |
This command creates a functional signal. You can choose from the available options for Aspect to create any of the default Japanese signals. Setting X to 0 creates a functional but invisible signal similar to Track.Section. Setting X to a non-zero number and Y to a negative number resets the y-coordinate to 4.8 meters and attaches a default signal post.
Example of a four-aspect type B signal without a post at x=-3 and y=5: | |
▶ | 1000, Track.Signal -4;;-3;5 |
Example of a four-aspect type B signal including a post at x=-3 and y=4.8: | |
▶ | 1000, Track.Signal -4;;-3;-1 |
Track.Signal is similar to using Track.Section and Track.SigF in one command.
Track.Relay X; Y; Yaw; Pitch; Roll |
X: The X-coordinate at which to place the object, by default measured in meters. The default value is 0. Y: The Y-coordinate at which to place the object, by default measured in meters. The default value is 0. Yaw: The angle in degrees by which the object is rotated in the XZ-plane in clock-wise order when viewed from above. The default value is 0. Pitch: The angle in degrees by which the object is rotated in the YZ-plane in clock-wise order when viewed from the left. The default value is 0. Roll: The angle in degrees by which the object is rotated in the XY-plane in clock-wise order when viewed from behind. The default value is 0. |
This commands creates a default Japanese repeating signal. The repeating signal repeats the state of the upcoming signal. Setting X to zero does not create a repeating signal, but forces the command to be ignored. Setting X to a non-zero number and Y to a negative number resets the y-coordinate to 4.8 and attaches a default signal post.
● 11.6. Safety systems
Track.Beacon Type; BeaconStructureIndex; Section; Data; X; Y; Yaw; Pitch; Roll |
Type: A non-negative integer representing the type of the beacon to be transmitted to the train. BeaconStructureIndex: A non-negative integer representing the object to be placed as defined via Structure.Beacon, or -1 to not place any object. Section: An integer representing the section to which the beacon is attached, namely 0 for the current section, 1 for the upcoming section, 2 for the section behind that, etc., or -1 for the next red section. Data: An integer representing arbitrary data specific to the beacon type to be transmitted to the train. X: The X-coordinate at which to place the object, by default measured in meters. The default value is 0. Y: The Y-coordinate at which to place the object, by default measured in meters. The default value is 0. Yaw: The angle in degrees by which the object is rotated in the XZ-plane in clock-wise order when viewed from above. The default value is 0. Pitch: The angle in degrees by which the object is rotated in the YZ-plane in clock-wise order when viewed from the left. The default value is 0. Roll: The angle in degrees by which the object is rotated in the XY-plane in clock-wise order when viewed from behind. The default value is 0. |
This command places a beacon (transponder). The object must have been loaded via Structure.Beacon(BeaconStructureIndex) prior to using this command. When the train passes the beacon, the type of beacon and various data will be transmitted to the train, including the state of the referenced section.
It should be noted that the built-in safety systems also receive data from these beacons as Track.Beacon(Type) is roughly equivalent to Track.Transponder(Type). Please see the page about beacon standards for more information.
Track.Transponder Type; Signal; SwitchSystem; X; Y; Yaw; Pitch; Roll Track.Tr Type; Signal; SwitchSystem; X; Y; Yaw; Pitch; Roll |
Type: The type of the transponder. The default value is 0. Signal: The signal this transponder references. The default value is 0. SwitchSystem: Whether to automatically switch the safety system. The default value is 0. X: The X-coordinate at which to place the object, by default measured in meters. The default value is 0. Y: The Y-coordinate at which to place the object, by default measured in meters. The default value is 0. Yaw: The angle in degrees by which the object is rotated in the XZ-plane in clock-wise order when viewed from above. The default value is 0. Pitch: The angle in degrees by which the object is rotated in the YZ-plane in clock-wise order when viewed from the left. The default value is 0. Roll: The angle in degrees by which the object is rotated in the XY-plane in clock-wise order when viewed from behind. The default value is 0. |
▸ Options for Type: |
File:Illustration transponders.png 0: An S-type transponder used by ATS-S. Usually placed 600m in front of a signal. 1: An SN-type transponder used by ATS-SN. Usually placed 20m in front of a signal. 2: An accidental departure transponder. Usually placed shortly behind a station stop. 3: An ATS-P pattern renewal transponder. Usually placed 600m, 280m, 180m, 130m, 85m or 50m in front of a signal, depending on the circumstances. 4: An ATS-P immediate stop transponder. Usually placed either 25m or 30m in front of a signal, depending on the circumstances. |
▸ Options for Signal: |
'0: The upcoming signal is referenced. 1: The signal immediately behind the upcoming signal is referenced. n: The nth signal behind the upcoming signal is referenced. |
▸ Options for SwitchSystem: |
-1: The transponder does not switch the train between ATS-SN and ATS-P. 0: The transponder automatically switches the train to ATS-SN for transponder types 0 and 1, and to ATS-P for types 3 and 4. |
This command places a transponder, usually for the built-in safety systems ATS-SN or ATS-P. For more information about these systems and their transponders, see the user's documentation about ATS.
It should be noted that custom safety system plugins also receive data from these transponders as Track.Transponder(Type) is roughly equivalent to Track.Beacon(Type). Please see the page about beacon standards for more information.
➟ Go here to find out more about ATS-SN and ATS-P.
➟ There is a tutorial available for the proper use of ATS-SN and ATS-P in route files, including all of the five transponders.
Track.AtsSn |
This command places an S-type transponder for the built-in safety system ATS-SN, referencing the upcoming signal, and automatically switching to ATS-SN. The command is equivalent to Track.Tr 0;0;0. See there for more information.
Track.AtsP |
This command places a pattern renewal transponder for the built-in safety system ATS-P, referencing the upcoming signal, and automatically switching to ATS-P. The command is equivalent to Track.Tr 3;0;0. See there for more information.
Track.Pattern Type; Speed |
Type: The type of speed restriction. Speed: A non-negative floating-point number representing the speed restriction, by default measured in km/h. |
▸ Options for Type: |
0: A temporary speed restriction. 1: A permanent speed restriction. |
This command defines a speed restriction for the built-in safety system ATS-P.
A temporary speed restriction (Type=0) is to be inserted at the point where the speed restriction should apply. ATS-P will know about this speed restriction in advance and will brake the train so that the train meets the speed restriction at that point. Once the point is passed, the speed restriction no longer applies.
A permanent speed restriction (Type=1) is to be inserted at the point where the speed restriction should apply, however, ATS-P does not know about this limit in advance and will only brake the train from that point on. For a higher degree of realism, insert permanent speed restrictions at the same point as ATS-P transponders. A permanent speed restriction, as the name suggests, is remembered by ATS-P and is only released by a subsequent permanent speed restriction.
Track.PLimit Speed |
Speed: A positive floating-point number representing the permanent speed restriction for ATS-P, by default measured in km/h. |
This command is equivalent to Track.Pattern 1;Speed. See there for more information.
● 11.7. Miscellaneous
Track.Back BackgroundTextureIndex |
BackgroundTextureIndex: A non-negative integer representing the background image to be displayed as defined via Texture.Background(BackgroundTextureIndex). |
This command defines which background image to show from now on.
⚠ | This command can only be used at the beginning of a block. |
Track.Fog StartingDistance; EndingDistance; RedValue; GreenValue; BlueValue |
StartingDistance: A floating-point number indicating the start of fog, by default measured in meters. The default value is 0. EndingDistance: A floating-point number indicating the end of fog, by default measured in meters. The default value is 0. RedValue: An integer ranging from 0 to 255 representing the red component of the fog. The default value is 128. GreenValue: An integer ranging from 0 to 255 representing the green component of the fog. The default value is 128. BlueValue: An integer ranging from 0 to 255 representing the blue component of the fog. The default value is 128. |
This command defines the fog from this point on, or deactivates fog. If fog is to be enabled, StartingDistance must be less than EndingDistance. If fog is to be disabled, StartingDistance must be greater than or equal to EndingDistance.
Fog affects the coloring of objects. Objects before the starting distance appear as-is, objects after the ending distance appear in the fog color, and objects in-between blend linearly between those. The background image is affected by fog as well. For the fog calculations, the background image is assumed to be at 600 meters distance from the camera, regardless of the actual viewing distance.
Depending on Options.FogBehavior, there are two options how this command affects fog from this point on. In block-wise mode, the current fog blends from the beginning of this block to the new settings at the end of this block. The new setting is kept for following blocks. This is the default behavior. In interpolation mode, each Track.Fog command defines a control point for fog, where all of the settings (distances and colors) are interpolated linearly between the control points.
⚠ | This command can only be used at the beginning of a block. |
Track.Brightness Value |
Value: A non-negative integer within the range from 0 to 255. The default value is 255. |
This command marks a point which affects the brightness in the cab. Value is measured from 0 (dark) to 255 (light), and is linearly interpolated between successive Track.Brightness commands for any given point on the track. This command should be used for tunnels, bridges, station roofs, or anything else that would affect the brightness as perceived inside the cab.
Example: | |
▶ | With Track 1200, .Brightness 255 ,; before the bridge starts 1205, .Brightness 128 ,; directly under the bridge here 1210, .Brightness 255 ,; as soon as the bridge ends |
Track.Marker FileName; Distance |
FileName: The file name for the marker image, relative to the Object folder. Distance: A non-zero floating-point number indicating the length for which the marker image is displayed, by default measured in meters. |
▸ Behavior for Distance: |
negative value: The marker image starts to display at the Track.Marker command, and ends -Distance meters after the Track.Marker command. positive value: The marker image starts to display Distance meters before the Track.Marker command, and ends at the Track.Marker command. |
This command shows a so-called marker image, which is displayed in the top-right corner of the screen. You can use these images for advisory or informational purposes. The RGB color of 64,64,64 inside the image is made transparent.
Track.PointOfInterest RailIndex; X; Y; Yaw; Pitch; Roll; Text Track.POI RailIndex; X; Y; Yaw; Pitch; Roll; Text |
RailIndex: A non-negative integer representing the rail for the point of interest. X: A floating-point number representing the horizontal offset from the rail, by default measured in meters. Negative values indicate left, positive ones right. Y: A floating-point number representing the vertical offset from the rail, by default measured in meters. Negative values indicate below, positive ones above. Yaw: The angle in degrees by which the view is rotated in the XZ-plane in clock-wise order when viewed from above. The default value is 0. Pitch: The angle in degrees by which the view is rotated in the YZ-plane in clock-wise order when viewed from the left. The default value is 0. Roll: The angle in degrees by which the view is rotated in the XY-plane in clock-wise order when viewed from behind. The default value is 0. Text: A textual representation of the point of interest. |
This command creates a point of interest which the user can jump to by pressing the CAMERA_POI_PREVIOUS (NUM 1) or CAMERA_POI_NEXT (NUM 7) keys. The camera will be placed at the specified location with the specified orientation. If Text is non-empty, a message will appear briefly showing the text.
Track.PreTrain Time |
Time: The time at which the pretrain is at this track position. |
This commands creates a position-time-association for an invisible preceding train in order to influence signalling. Contrary to a real preceding train as created by Route.RunInterval, the invisible preceding train created by Track.PreTrain is a way of scripting where the invisible preceding train is at any given time. The position-time-associations must be in increasing order, that is, at a later track position, the associated time must also be later. Before the first scripted time, the invisible preceding train resides at the first scripted position. In-between the first and last scripted time, the invisible preceding train moves (linearly) between the scripted points. After the last scripted time, the invisible preceding train is removed and thus clears signalling.
Track.Announce FileName; Speed |
FileName: The file name for the sound to play, relative to the Sound folder. Speed: The reference speed in km/h for speed-dependant sounds, or 0 to play the sound speed-independently. The default value is 0. |
This command plays an announcement or other kind of sound in the cab once the player's train crosses the point where this command is used. If Speed is set to 0 (default), the sound is played as-is. If a Speed is given though, the sound plays at is original pitch at the specified speed, and is pitch-modulated proportionally for other speeds, useful for custom flange sounds, pointwork sounds, etc.
Track.Doppler FileName; X; Y |
FileName: The file name for the sound to play, relative to the Sound folder. X: A floating-point number representing the horizontal offset from rail 0, by default measured in meters. Negative values indicate left, positive ones right. Y: A floating-point number representing the vertical offset from rail 0, by default measured in meters. Negative values indicate below, positive ones above. |
This command places an environmental sound effect at the specified location. The sound will play in a loop for the duration of the simulation and employs the doppler effect. (Note: All sounds in openBVE employ the doppler effect.)
Track.Buffer |
This command places a bumper. The train can collide with the bumper in both the forward and backward directions. Place this command at the beginning and the end of the route. An object is not automatically created, so use Track.FreeObj to create a visual representation of the bumper if necessary.