Track Following Object

This page explains the principle and implementation of the XML-based Track Following Object, which is supported in openBVE v1.6.0 or later.

■ Basic Principles

openBVE can freely run a Track Following Object on other tracks.

In order to do this, it is necessary to setup each object that you want to run using Track Following Object XML files. An example is shown below.

In this example the object runs as follows.

  1. It is displayed when the in-game time 00:01:00 has elapsed and the object exists within 50 m to 100 m of the player’s camera position in game. It becomes invisible after 5 minutes have elapsed since being displayed. The appearance is defined in extensions.cfg in 7-car formation.
  2. The in-game distance is 200 m and the right door is opened for 20 seconds and then the object accelerates to 30 km/h at an acceleration of 1.71km/h/s on Rail2.
  3. It travels at 60 km/h on Rail2 for 400 m.
  4. The object decelerates to 30km/h at 1.71 km/h/s on Rail2, when it reaches a distance of 1000 m within the game, it stops and opens the doors on both sides. After stopping for 10 seconds, it accelerates in reverse to 30 km/h with an acceleration of 1.71 km/h/s on Rail1.
  5. The object decelerates to 30 km/h at 1.71 km/h/s on Rail1, stops and opens the right door at an in-game distance of 200 m.

As you can see, the file consists of one <Definition> section, one <Car> section and one <Stops> section. The <Stops> section consists of two or more <Stop> sections.

■ Definition attribute

<AppearanceTime> Time </AppearanceTime>

Time sets the time when the object appears in the game.

Note: If this parameter is omitted, the object will emerge from the start of the game.


<AppearanceStartPosition> Position </AppearanceStartPosition>

Position sets the in-game distance at which the object starts appearing. The object will appear when the player’s train passes this point. The unit is meter.

Note: If this parameter is omitted, the object will emerge from the start of the game.


<AppearanceEndPosition> Position </AppearanceEndPosition>

Position sets the in-game distance at the end point where the object appears. The object will be hidden when the player’s camera position passes this point. It must also be greater than the value specified for <AppearanceStartPosition>. The unit is meter.

Note: If this parameter is omitted, the object will emerge from the start of the game.


<LeaveTime> Time </LeaveTime>

Time sets the duration from when the object appears in the game until it disappears. The object will not be visible after this time. This value is not an in-game time.

Note: If this parameter is omitted, the object will remain visible until the end of the game, or until it is hidden by <AppearanceEndPosition>

■ Train attribute

<Directory> Path </Directory>

Path sets the relative path to the directory containing the object’s train.dat, sound.cfg and extensions.cfg.

Note: If a train folder is intended solely for AI use, then the train.dat file may be renamed train.ai

<Reversed> true </Reversed>

If this attribute is set to true then the consist of the train will be reversed.

■ Stop attribute

<Decelerate> Value </Decelerate>

Value sets the deceleration of the object. The unit is km/h/s.


<StopPosition> Position </StopPosition>

Position sets the in-game distance where the object stops. The unit is meter.


<Doors> Value </Doors>

Value sets the open door of the object. The valid values are:


<StopTime> Time </StopTime>

Time sets the duration of the stop of the object. This value is not an in-game time.


<Accelerate> Value </Accelerate>

Value sets the acceleration of the object. The unit is km/h/s.


<TargetSpeed> Value </TargetSpeed>

Value sets the speed after the acceleration of the object. The unit is km/h.


<Direction> Value </Direction>

Value sets the direction of travel of the object. Valid values are as follows.


<Rail> RailIndex </Rail>

RailIndex sets the trajectory on which the object will run. It is necessary to define the trajectory by the Track.Rail command of the route file.