BVE4 Extension Coding Guide
By Richard Helliwell  

During the course of 2005, BVE4.2 was released, and brought a whole host a new codes with it, which enable BVE authors to create authentic, realistic routes and trains, using various new codes and scripts. Unlike BVE2, BVE4.2 is capable of working train safety systems, working weather and lighting effects, working on-board wipers and other features.
Although they have been converted into the .csv format, much of the codes have remained unchanged from BVE2. Therefore, I will not list these codes.

Tim Corrbet's base route coding guide can be found at the Virtual Rail CSV Coding Guide. This gives a lists of codes that can form your main BV2 base route. These routes will work in BVE4, however, most BVE4 routes are now fitted with the codes below. You will need your main route to be complete, before adding the BVE4 code, so please make sure you have read Tim's guide, and have a route to work on. 
    In this guide, I have listed all the new BVE4.2 codes that can be used in .csv routefiles to create extremely realistic routes.

Please note that the .Beacon command is a common used code. Some .Beacon commands, such as rain and AWS are forms or plug-ins, installed to trains. If a train does not have these plug-ins, then the train will not be able to use the features. For example, the LT1938 stock is not suitable for routes with AWS in.

'With Route' Commands

Lighting Effects Commands

.LightDirection x;y,  (Eg: .LightDirection 40;230,)
    x = elevation of directional light
    y = angle of directional light

.DirectionalLight R;G;B,  (
Eg: .DirectionalLight 140;140;140,)
 
  R = Red colour value
   G = Green colour value
   B = Blue colour value


.AmbientLight R;G;B,  (
Eg: .AmbientLight 140;140;140,)
   R = Red colour value
   G = Green colour value
   B = Blue colour value


'With Train' Commands

.Timetable(0).day.load - Place this code under the 'Train.Folder' command
..\..\Railway\Object\Example\Timetables\Class170.bmp,

(This is the default directory to which BVE4 will search for the specified .bitmap image; in this case, 'Class170.bmp')


'With Structure' Commands

Signaling & AWS Index -  Signals & AWS © Steve Green & Anthony Bowden

In order to use these signal and safety systems in BVE4, you must download them from TrainSimCentral, and read the included .html ReadMe file!

Copy the following code to the end of the 'With Structure' list:

Signals

Signal(1).Load brsigs\signal2g; brsigs\glow2g
Signal(2).Load brsigs\signal2y; brsigs\glow2y
Signal(3).Load brsigs\signal3; brsigs\glow3
Signal(4).Load brsigs\signal4yg; brsigs\glow4yg
Signal(5).Load brsigs\repeat; brsigs\glowrepeat
Signal(6).Load brsigs\signal3featherl; brsigs\glow3featherl
Signal(7).Load brsigs\signal3featherr; brsigs\glow3featherr
Signal(8).Load brsigs\signal4ygfeatherl; brsigs\glow4ygfeatherl
Signal(9).Load brsigs\signal4ygfeatherr; brsigs\glow4ygfeatherr
Signal(10).Load brsigs\signal2callon; brsigs\glow2g
Signal(11).Load brsigs\signal3callon; brsigs\glow3
Signal(12).Load brsigs\signal4callon; brsigs\glow4yg
Signal(13).Load brsigs\signal2gy; brsigs\glow2gy

AWS Safety System Beacons

.Beacon(0) Brsigs\aws_null_0.x  
.Beacon(1) Brsigs\awsmagnet_1.x
.Beacon(2) Brsigs\aws_tsr_2.x
 

'With Track' Commands

AWS/TPWS Safety Systems

Right, this is a very difficult section to code, so I'd best explain it using words first. Thanks to Tony Haylor of the Network West Midlands route for providing excellent information and help on this area of coding and commands.

AWS is a safety system used in the UK, which is designed to first detect the trains speed and then to warn the driver of a clear or red signal. After this, the system will again detect the speed of the train whilst passing the signal. This is all to stop trains from passing signals at danger, and to control the speeds of trains over certain sections of track.

In a UK signaling system, the safety devices are arranged in a certain order. Below is a working example of a typical signal and it's safety system.
(Commands in Bold Italics will be explained after the example.)
  • The TPWS loops should be about 250m before the signal and should be 6m apart. The detecting speed beacon (see below), set for 56kph (35mph), is placed with the second loop. For Example,

1000, .Freeobj 0;loop object;;,

1006, .Freeobj 0;loop object;;,.Beacon 44002;0;1;56,

  •  The AWS ramp should be about 183-200m before the signal. This is the object you have specified in your beacon index and will either sound a bell (signal clear), or a warning horn (caution or stop), in the cab.  For Example,

1056,.Beacon 44000;1;1;0,

  • The signal must have a .Beacon command 4m before the signal loops. There must be two loops at the signal,  the first 1m before the signal and the next with the signal. The signal in the example is a 4 aspect signal, but you can specify the type in your .Signal index. The .Section command must follow the .Sig F command and will in this example make the signal state depend on the next 4 sections, as four aspect signals do.

1252,.Beacon 44003;0;1;0,

1255,.Freeobj 0;loop object;;,

1256,.Freeobj 0;loop object,;.SigF 4;1;x;y,.Section 0; 2; 3; 4,.Freeobj 0;signal object,

  • If you do not code all of these steps in this order before each signal then you will not get the TPWS or AWS to work correctly. Below is the full set of signal/AWS/TPWS beacon commands.
AWS & TPWS Beacons
Note: The 3rd aspect of each of the following five .Beacon commands should be the number of the .Beacon you listed in the 'With Structure' section.
Eg: If you want to use this .Beacon(0) Brsigs\aws_null_0.x , then you would put '0' as your 3rd aspect.


.Beacon 44000; x;1;0, - AWS signal approach magnet. AWS alarm goes off if the next signal is not showing 'clear' aspect at the time of train running over the magnet.

.Beacon 44001;x;0;0, - Fixed AWS warning magnet. AWS alarm goes off when train runs over the magnet.

.Beacon 44002;x;1;Speed, - TPWS signal approach magnet. TPWS stops train if the next signal is at danger, and train's speed exceeds the defined value.

.Beacon 44003; x; 0; 0, - TPWS/LU Trainstop. Train is stopped if the adjacent signal is at danger at the time of train running over the magnet.

.Beacon 44004; x; 0; Speed, - TPWS fixed speed limit approach magnet. TPWS stops train if speed exceeds the defined value.


Signal & Section Commands

.SigF w; 1; x; y, (Eg: .SigF 1; 1; 2; 2.5 ,)
   
    w = Signal type, as listed in the 'With Structure' section (above).
    1 = Can be changed, however, it is not specified what numbers to                         change it to.
    x = Distance left or right of rail 0.
    y = Distance up or down from rail 0.

.Section s0; s1; s2; .....
    s0 = When the preceding train exists in this section, the signal index                        which is put out.
    s1 = When the preceding train exists in the next section, the signal index                which is put out.
    s2 = When the preceding train exists in the next but one section, the                        signal index which is put out. 

(There is no restriction on the 'number of aspects' (i.e. s0 to infinity)).


Weather Effects Commands
Rain
.Beacon a;b;c;d, (Eg: .Beacon 21;0;0;70,- this is the most common rain beacon, but it can only be used on train that support the rain effect.)

    a = Beacon type (21 for rain)
    b = Beacon image file (default path Object\bmp or b3d or csv or x formats  - for use in AWS/TPWS beacon commands only, not used in rain.)
    c = 0
    d = 0 (No rain) to 255 (Heavy rain)

Fog
.Fog x;y;R;G;B,  (Eg: .Fog 10; 400; 255; 255; 255, - Will set fog to a maximum visibility of 400 meters, and the fog is bright white.)

    x = minimum distance in front of the train
    y = maximum distance in front of the train
   R = Red colour value
   G = Green colour value
   B = Blue colour value

If you have any questions or problems that need answering regarding anything above, please don't hesitate to Contact Me, and I'll do my best to answer them!

Also, if any of the information above is incorrect, please Contact Me and I will rectify any mistakes as soon as possible.



Back To Top▲
This page is valid CSS! This page is valid HTML 4.01! All Text, Files & Images are Copyright© 2005-2008 Richard Helliwell. Design is Copyright© 2007 David Astarita and © 2008 Richard Helliwell . Unless otherwise stated. All rights reserved.