Route Building Tutorial 6: Tidying the Junction & An Introduction To Speed Limits

In this sixth tutorial, we will add code to extend the ‘disappearing‘ rails, use a modified track object to remove the gap in the rails and also add pointwork at our diverging junction. For more realistic running, speed limits will also be introduced.

Time to open the route file and get coding…

The route file we created previously should look something like this

Our first job is to extend the straight mainline after the diverging junction so that it does not appear to suddenly end. We can do this by continuing to displace these by 5.08m further to the right of the running rail for every 25m along the route. In the previous tutorial, we ended the straight mainline tracks (rails 2 and 3) at 3325m using the railend command. To continue the mainline tracks, the following change must be made from:


We then need to add the following code to continue our mainline tracks for a further 500m:

Save the route and check the changes were successful.

Now that the tracks do not suddenly end in the distance, we next need to modify the rail object to ensure no gaps are visible in the straight mainline section. To do this, we need to extend the length of the straight rail object slightly.

This has been done in the object file STRAIGHT_EXTENDED.B3D which is included in the objects download for this tutorial. Comparison of this object with STRAIGHT.B3D, the track object currently in place, shows the length of the object has been increased by 40cm backwards and forwards. (Don’t worry about object coding, apart from changing textures, this subject is outside the remit of these tutorials. An excellent guide to object coding is available from Luigi Cartello’s site at: ).

Before trying to use this extended section, we need to index it in our railtype section, by adding this:

At 3050, we then need to change the rail types of rails 1 and 2 (Our mainline tracks), changing from:


When the route is viewed, you should now be able to see that the gaps in the rails have been eliminated.

The final change we are going to make to the track work (for now!) is to add some points to the junction. To do this, we are going to replace the sections of plain track with a suitable free object. This, like the track objects, has been created using Switch 15 and is included in the objects download for this tutorial.

Before positioning the points, they must first be indexed as a free object by adding the following statement into the freeobjects list in the ’with structure’ section of the code:

We can now position our set of points as a freeobject at position 3075, by changing our code there to look like this:

When positioning a free object, the code required is as follows:

.freeobj I;T;X;Y;R,
Where I is the index of the object as defined in the ‘with structure’ section, T is the rail to which the object is being associated, X is the distance, in metres, to the left (negative) or right (positive) of the running rail, Y is the distance, in metres, below (negative) or above (positive) the running rail, R is the angle, in degrees, by which the object is to be rotated

It is a requirement of ‘Switch’ that the distance between the two rails exceeds 3.5metres and that the length of the objects are in increments of 25m. For our 250m radius curve, if the points were 25m long, the distance between the rails would be 1.25m (as we calculated when positioning the diverging curve). Because of this, the points constructed for 250m radius diverging curves must be 50m long.

Because the mid-distance of the points is set at 0m (the length of the object extending from -25m to +25m), they must be located 25m forwards of where the rails actually diverge, hence the positioning at 3075m.

The points have been placed 1.25m to the right of the running rail (rail 0), again as a consequence of the way ‘Switch’ builds the objects. The straight track of the points is displaced by this distance away from the curved track (which forms our running rail) at 25m along the length of the object (again, this is known from the curve calculations we used to construct the divergence).

Finally, we need to rotate the points object by an amount consistent with having travelled 25m along a 250m radius curve. The degree of rotation applied was found by trial and error although it could be calculated by working out the distance travelled around the circumference of the curve and the angle subtended by this arc.

If we now view our junction, we find that where we have placed the points, the track now appears very ‘flickery’. This is a phenomenon called Z-Fighting, and is caused by two textures being overlaid in the same position, namely the original track and the points objects. To overcome this, we need to remove the original track objects which are present where the points are located. The easiest way of doing this is to use a null (blank) rail object in place of the normal track object. A null rail object has been included in the objects download (NULL_RAIL.B3D), which, if we open up the object file is seen to contain just a single vertex, the minimum code possible in an object file.

Before using the null rail, we must first index this as a rail object by adding this statement to the ‘with structure’ section of the route file, like this:

We should then replace the track textures between 3050m and 3100m, by changing our routefile to look like this:

You will notice that the railtype of rails 0 & 2 were changed to our null rail object at position 3050, and then returned to the standard rail objects at position 3100.
Also notice that the track object of rail 2 is defined by extending the rail command to include our railtype.

Perform the same operation for our next set of points (rails 1 & 3), and your routefile should now look like this:

If the route is now viewed, a region of ‘flickering’ still occurs over the region where we have two superimposed points objects. This could be overcome by producing a modified points object which omits the overlaid region (or the whole junction could be modelled using a single ‘custom built’ object). However, as object building (or modification) is largely beyond the scope of this tutorial, we will leave the objects ‘as built‘.

On viewing the route, it is apparent that a small gaps remain in the right hand track between the straight track and the points. This can be overcome by using our extended straight track object for the right hand rail. To do this, change our code at position 3000 from:

To look like this:

For the moment then, that’s the track laying completed for our route. Laying the plain line was straightforward, just using the curve command to make our track follow the desired route (graduating the curves where necessary). We then introduced smooth curves as replacement track objects and also saw how to use these to diverge and converge tracks around the island platform and diverging junction. Finally, we replaced the curved track objects at the junction with points. We will deal with gradients once we start ‘landscaping’ the route.

The junction itself could really do with more work – we have uncovered several deficiencies in the ‘Switch’ generated objects and we could do with a proper crossover. However, this utility is very much easier for the beginner to use than ‘hand building’ the junction, something which even seasoned route builders can find difficult!

It is now time to start enhancing the operational aspects of our route, looking initially at introducing speed limits. To add or change the speed limit, the limit command is used:

.limit X;Y
Where X is the speed limit in KMH (to convert MPH to KMH, multiply by 1.61), Y is the distance in metres after the command at which the restriction will be enforced.

To make the linespeed of the first part of our route 75MPH, we need to add this code:

Notice that that the second parameter has not been included as we want the speed limit to be effective immediately (and BVE will default this value to zero if it is not specified).

We also need to include a lineside sign to let the driver know what the speed limit is. Before doing this, we must index a suitable object (one of which has been included in the objects download) as a free object. We can do this by adding this to our freeobjects section:

Next, add the object, so our code now looks like this:

With the short distances between stops on our route, it is unlikely 75MPH will be exceeded, but if so, the standard BVE warning will be applied on screen.

Approaching the second station, a reduced speed limit is required, 20MPH being necessary due to the reverse curves being present. To add this, we again need to index our sign object by again adding this code to our freeobjects section:

We then need to position this sign where our reduced speed limit becomes effective by adding this code:

Also needed will be an advanced warning board for this speed restriction, and again we need to index a free object:

The location of the advanced warning board must allow a sufficient distance for all train types to decelerate from the permitted line speed, taking gradients into consideration.

The deceleration distances are published online by Railway Group Safety and should be adhered to if prototypical operation is to be followed. For our speed restriction, advanced warning must be given 1267m before the restriction, therefore the warning board must be placed at 1100m (after rounding to the nearest 25m);

We will leave the remaining speed restrictions until the next tutorial where we will also look at adding AWS warnings to the restrictions and protecting the end of our route with TPWS.

Leave a Reply

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