Route Building Tutorial 4: Track Layout and Textures & Run Sounds

In this fourth tutorial, we will take a look changing the position of the adjacent track, alter the appearance of the track and introduce run sounds.

Time to open the route file and get coding…

The route file we created previously should look something like this:

The adjacent track (which we have indexed as rail 1) runs the entire length of the route 3.5 metres to the right of the running rail. If we wish to alter the relative position, we need to use the rail command;

.rail n;x;y;t,
Where n is the index of the rail, x is the distance to the left (negative values) or right (positive values) of the running rail, y is the distance below (negative values) or above (positive values) of the running rail, t is the rail type as defined in the ‘with structure’ section of the route file.

Notice the similarity of the of this command to the railstart command we have used at the start of the route. This command may also be simplified by omitting any unchanged parameters at the end of the command (as we will in the example below).

Using the rail command, we can make our tracks diverge at the second station to allow inclusion of an island platform. If we assume this platform is to be about 13 metres wide, rail 1 must be moved so that it is 15 metres to the right of the running rail. This greater distance is to allow for the half width of the tracks (as all distances are measured from the centre of the tracks) and necessary clearance between the train and platform edges.

Looking at the route file, we currently have:

First, try adding a rail command to move the secondary rail 15m to the right of our running rail at the station:

Save the route, load it up and see what happens by viewing the route (no need to drive it, we can use viewer mode to do this).

Clearly, this is not correct. Rail 1 moves from 3.5 to 15m to the right of the running rail in just 25m and the track is all in straight sections. We could smooth things out a bit by adding incremental changes to the distance between the running rails by adding more rail commands:

This looks much better but by no means perfect. Lets think about what we can do using smooth curves.

Ideally, we want a construction something like this where, both the running rail and the adjacent rail curve on approaching the island platform:

A basic plan for the tracks of our island platform

A basic plan for the tracks of our island platform

To achieve this, we must curve our running rail (the top rail on this diagram) first to the left and then to the right before straightening out. The adjacent rail (rail 1 in our route) must curve first to the right and then to the left before straightening out. Now all we need to do is decide the radii of the curves to be used and calculate the distances between the two rails at the locations marked 1 and 2 (knowing that at location 1 our adjacent rail is 3.5 metres to the right of the running rail.

If we think about practical operation of the railway, the curves must not be of such sharp radius as to excessively slow passing trains, so a curve radius of ~750-1000m would be fine.

In our route, we now need to think about the combinations of curve length and radius available to us which will displace the track by about 3 metres.

Why 3m? Consider the end of this curve as being at location 2 on the track diagram. We want the total distance between the rails to be ~15m, the distance currently being 3.5m, so the total displacement required by one track is 6m and half of this will be achieved using the first of our two (reversing) curves.

Time for some maths…..take your time over this – it is a tricky subject which requires some thought.

Using the equation of a circle, given by the formula x2 + y2 = r2 , we can calculate that a 1000m radius curve wil be displaced by 2.8m over a distance of 75m – a little under our target value but we have curved rail objects of this radius which we can use. (The calculations can be performed by hand, or, on the index page, there is a link to a simple spreadsheet which can perform these calculations. Other solutions to problems of this nature have also been published).

Working out the displacment at 25m intervals (which is required for BVE coding), we have:

offset X (m)y

Remember, this is the displacement given by one curve only. We have two diverging curves which were initially 3.5 metres apart. The total distance between the running rail and rail 1 will therefore be (2 x calculated offset) + 3.5 and as our curve commences at 2425m we also need to add this to the y values, giving us the following distances between the rails:

Distance between rails (m)Distance along route (m)

Now it’s time to add our calculated displacements into the route code. We will also need to change the rail type of the running rail to use a left handed 1000m radius curve (indexed as rail (5) in the ‘with structure’ part of the route file). Similarly, the rail type of the adjacent rail needs to be a right handed 1000m radius curve, indexed as rail (12). Finally, using the curve command, we must also let BVE know we will be going around a 1000m radius curve to the left.

Before adding our smoothly curved diverging rails, we first need to remove any changes previously made. Instead, the code we need to add is:

Note how the rail command has been shortened when no changes are being made to the y offset or rail type. No cant is present on this curve.

We are now half way through building our reversing curve which approaches the island platform (having constructed the track between locations 1 and 2 on our diagram). At the moment, this looks no better than our first effort. Don’t worry, we’ll finish it off in the next tutorial.

For a little light relief, lets now have a look at changing the appearance of the track.

In amongst the objects, you will find bitmaps named “dl_track.bmp” and “dl_ballast.bmp“. These were cut from a photo I took recently on a trip to Dawlish – the orginal being “DSCF0056.JPG“. We can use these bitmaps to replace the Switch 1.5 default textures.

For the straight track, this has been performed by opening up the object file “straight.b3d” and replacing all occurrences of schotter1.bmp with dl_ballast and also replacing all occurrences of schwellen1.bmp with dl_track.bmp. The file was then resaved as DL_STRAIGHT.B3D (if using notepad, include the .b3d extension and choose ‘all files’ from the ‘save as type’ list).

Before we can use this track object, we need to index it in the ’with structure’ section of the route file by adding this code:

Now, in the same way as we have been using curved rail objects, we can use this straight track object by using the rail type command. So, to change the track texture after the first curve, alter the code which specifies which rail type is being used from;


Whether this is an improvement or not is open to debate – the bitmaps I have used need a little fine tuning as the rail in the original bitmap can still be seen under the rail generated in the object file and this should be changed to a darker rust colour. Nevertheless, the principle of modifying objects by using different textures (re-skinning) has been demonstrated.

The bitmaps to be used should be 8 bit indexed colour images dimensioned in ^2 (i.e. 16, 32, 64, 128 etc). For example 128×64 images are ok, 106×65 will not display correctly.

Use of true RGB colour bitmaps is possible but not encouraged as file sizes are significantly increased and display problems will occur when transparent regions are required.

Before publishing modified objects, copyright issues must be resolved.

So far, the default track sound has been used throughout our route. However, the sounds heard from a cab will be quite different on jointed or continuous track and will also vary when passing through tunnels or bridges. To enable these different sounds to be used, we must index rail types with the sounds. This is done in accordance with the BVE track sound standard, BVETSS. More information can be found at

The standard sounds are as follows:

Run Sound #Train Sound FileDescription
0Run0.wavJointed rails, wooden sleepers
1Run1.wavJointed rails, concrete sleepers and jointed track higher linespeed with wind noise
2Run2.wavContinuous welded rail
3Run3.wavContinuous welded rail - Tunnel and bridge
4Run4.wavJointed rails, wooden sleepers - Tunnel and bridge
5Run5.wavPassing train sound, continuous welded rail
6Run6.wavContinuous welded rail on steel bridge
7Run7.wavPassing train sound, jointed rails

Now, to use these, we need to use the command:
Train.Run(i) n,
Where i is the indexed track and n is the run sound number.

If for example, we wanted our standard straight track to sound like continuous rail rather than the default jointed track, we would need to change the start of the route file to look like this:

This will only change the sound of the standard straight track and not the curves. If these are to sound as continuous rail as well, we would need to add additional Train.Run commands to make the assignments for ALL of the curved rail types like this:

If we were to drive the route now, all of the original track will make the sound of continous welded rail.

In practice, at some point on the route, we will be passing under a bridge. As each indexed rail type can only have one run sound associated with it, we must index the same rail type again in the ‘with structure’ section of the route and asign our sound to this in the ‘with train’ section. We can do this by adding the following code into our railtypes section:

;standard straight track under bridge, is a comment which I have added as a reminder of the sound associated with the rail type. Such non-functional comments must start with a semicolon and end with a comma.

We also need to assign a run sound to this new railtype, which we do by adding this to the end of the Train.Run section:

Now, it’s possible to simulate the sound of our train passing under a bridge by adding this code to the main routefile:

You will notice that the appearance of our track now changes when we change the railtype in order to pass under the bridge. On the other hand, if we had indexed Railtype 20 with the track object dl_straight.b3d, then this wouldn’t happen. If we wish to change the appearance of the adjacent track in a similar way at the same location, we must change our routefile to look like this:


You will notice that both Railtypes 1 and 20 are identical in appearance, as they use the same object file (STRAIGHT.B3D), and that differing run sounds only affect the primary running rail.

So, at the moment our route now uses track of varying appearance and sound. We also have a half built pair of diverging curves at the second station.
In the next tutorial, we will finish the track construction necessary to fit the island platform at the second station and also create a simple diverging junction. For a little light relief, it will also start raining.

Leave a Reply

Your email address will not be published. Required fields are marked *