To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

The range animation can be left out, but it will improve our framerates a little, as the model will be hidden when the viewer is 20000 meter away. For small vehicles this can be significantly less than, as they won't be visible from large distances anyway.

For the moment the enable-hot workaround is neccesary, in order to stop the vehicles from climbing into the air. This might become redundant one day.

The FlightPlan

Altough our vehicles are groundbased, they need a flightplan (= route). Flightplans are saved in the $FG ROOT/AI/FlightPlans/ directory.

Some neccesary content:

<?xml version="1.0"?>
<PropertyList>
<flightplan>

Now we start on the actual route. A route exists of waypoints. The train will calculate its own (shortest) route between the current and next waypoint. The shorter the distance between waypoints, the more accurate the train will follow the track. However, if the distance is too small, the train will miss waypoints and go off track.

It is advised to cut the route into several sections. This will ease the bugtracking, as FlightGear does not tell you what line to look if an error occurs.

name: name of the waypoint. This can also be the name of a station, which will ease bugtracking later on.

lat: the latitude coordinate of the waypoint.

lon: the longitude coordinate of the waypoint.

alt: altitude above sea level in feet. Redundant when on-ground=true.

ktas: the speed in knots. The train will accelarte/decelerate after passing the waypoint.

on-ground: true if te vehicle should calculate its altitude based on scenery objects (it will drive on top of them).

Special waypoints

There are a couple of special waypoints.

Wait

The following will stop the train, which is useful at stations to (un)board passengers/load:

<wpt>
<name>WAIT</name>
<time-sec>20</time-sec>
</wpt>

time-sec: time in seconds that the train will wait before driving to the next waypoint.

Tunnel

If your vehicle should drive through (or underneath) buildings, bridges etc. you have to add tunnel waypoints. The tunnel waypoint must be added after the entrance waypoint and after the exit waypoint.

<wpt>
<name>TUNNEL</name>
</wpt>

All waypoints within the tunnel (so including the ones in front of the tunnel waypoint) should have on-ground set to false and an altitude specified.

If your entire route can be considered as a "tunnel" you can also set <tunnel>true</tunnel> in the scenario.

End

Every route should end in a END-waypoint. When this waypoint is reached, the train will be removed or set back to the starting point (we will define this in the scenario file).

<wpt>
<name>END</name>
</wpt>

Close the file with:

</flightplan>
</PropertyList>

The scenario

Create a .xml file in FlightGear's $FG ROOT/AI/ directory. This is the main file of the scenario, as FlightGear will look into it to see what else to load.

model: the full path to the .xml file of the model that we created earlier.

name: the name of this piece of the train. If you have a train with multiple cars, each car needs its own name.

flightplan: file name (including .xml format) of the flightplan (= route) that the vehicle should follow. Each train can have its own flightplan, but all cars of the same train must share a flightplan.

tunnel: set to true if the train starts where there is scenery overhead e.g a tunnel or terminus.

restart: after the last waypoint of the flightplan is reached, the model will be destroyed (<restart>0</restart>) or placed back on the starting waypoint (<restart>1</restart>).

speed-constant: speed increase/decrease in kts/sec.

contact-offset: define the points at which ground elevation is measured for pitch calulations in ft from the origin. Negative is forward. z and y components are not (yet) available. When x=0 no pitch calculations are performed.

hitch-x-offset: the distance in feet from the model origin to the hitch/coupling of the next car. Only required on trains with multiple cars.

Close the file with:

</scenario>
</PropertyList>

Troubleshooting

My trains are climbing on top of eachother

Make sure you added the disable-hot animation to the model (see #The model).

My framerate is low

Make sure you have less than 10 ground vehicles active at any one time. (Each coach/wagon in a train or articulated truck counts as 1.)