BVE > Other Projects

TUTORIAL: Third Rail Gap for OpenBVE Trains (Interiors/Exteriors) AND Routes!

(1/4) > >>

[CT1660]:
Third Rail Gap For The Train

For Trains, the plugin with the third rail gap feature (which is also used for animated rollsigns) will be needed, which you can download the files below:
http://www.mediafire.com/?fxjirei5s9bappv

After applying the files, edit your train.dat file, and replace the #Device section with the following:

--- Code: ---#DEVICE
0               ; Ats
0               ; Atc
0               ; Eb
0               ; ConstSpeed
0               ; HoldBrake
-1              ; ReAdhesionDevice
0               ; LoadCompensatingDevice (not used)
0               ; PassAlarm
0               ; DoorOpenMode
0               ; DoorCloseMode
--- End code ---

Now, for your very basic train exterior with a generic lighting effect (or a train exterior with an interior, but doesn't have animated doors), all you need to do is create an .animated file with the following coded in:

For Train Exteriors:

--- Code: ---[Object]
States = 6394OFF.b3d, 6394ON.b3d
StateFunction = pluginstate[53]
--- End code ---

Your train's extensions.cfg MUST specify these .animated files. For each car, a pair of .b3d files (or .csv) needs to be made.

Make sure your ON state object has EmissiveColor added in for .b3d files, or SetEmissiveColor / LoadTexture interior.png,interior.png on .csv files


However, if your train has animated doors, you will need to add the follwing within the code for the animated doors
 
--- Code: ---StateFunction = pluginstate[53]
--- End code ---

This goes between States and TranslateZfunction. If your interior uses EmissiveColor, you will need to make another set of doors without the EmissiveColor coded in. Then you will need to specify within the same .animated file, which should look like this:

For Train Exterior Animated Doors (a sample using two pairs of animated doors):

--- Code: ---[Object]
Position = -1.28, 1.05, -6.67
States = doorLNP.b3d,doorL.b3d
StateFunction = pluginstate[53]
TranslateZFunction = if[leftdoorstarget==0, min[value+delta*1.8/4.8,0], max[value-delta*0.8/1.5,-0.8]]

[Object]
Position = -1.28, 1.05, -6.03
States = doorL1NP.b3d,doorL1.b3d
StateFunction = pluginstate[53]
TranslateZFunction = if[leftdoorstarget==0, max[value-delta*1.8/4.8,0], min[value+delta*0.8/1.5,0.8]]

[Object]
Position = 1.30, 1.05, -2.50
States = doorRNP.b3d,doorR.b3d
StateFunction = pluginstate[53]
TranslateZFunction = if[rightdoorstarget==0, min[value+delta*1.8/4.8,0], max[value-delta*0.8/1.5,-0.8]]

[Object]
Position = 1.30, 1.05, -1.85
States = doorR1NP.b3d,doorR1.b3d
StateFunction = pluginstate[53]
TranslateZFunction = if[rightdoorstarget==0, max[value-delta*1.8/4.8,0], min[value+delta*0.8/1.5,0.8]]

--- End code ---

place this on your .animated file for the train with the interior/exterior. for best results, make sure it's the first [object] specified

again, you will need TWO exterior objects per car (.b3d or .csv), one with the EmissiveColor value added in (for the ON state), and another without EmissiveColor (for the OFF state). Same applies for the animated doors and other miscellaneous stuff that is either .b3d or .csv

The OFF state MUST be mentioned first, then the ON state, since the first object mentioned first assumes the power loss state (a.k.a the OFF state), and the second object mentioned, when there is power on the third rail/pantograph (a.k.a the ON state), which is ATS state # 53 (which supported routes with this 3rd rail gap feature uses)

Basically what this does is, once it crosses a gap, it swaps the emissive objects for non-emissive objects, and once 3rd rail power is on the train again, it swaps the non-emissive objects to emissive objects again.

I am still experimenting to whether the code "StateFunction = pluginstate[53] can co-exist with the other codes for the animated rollsigns.

This will be implemented on Mr. Railfan's R30, and my R16, to take advantage of this.

As you can see,

6394OFF.b3d, DoorLNP.b3d, DoorL1NP.b3d,DoorRNP.b3d, DoorR1NP.b3d  is the OFF state for the interior lighting (no emissivecolor)

6394ON.b3d, DoorL.b3d, DoorL1.b3d, DoorR.b3d, DoorR1.b3d is the ON state for the interior lighting (with emissivecolor)

Third Rail Gap For The Route


Now, for the fun part, the route:
After much messing around with various london routes, i found this specific code that makes the third rail gap. I have tested this on the Franklin Ave Shuttle (1969) version, and can confirm it works:

You will need to specify this within your "With Structure" list. Of course, change the directory to where the null.x object would be within your route's objects


--- Code: ---.Beacon(1) 1969 Franklin Shuttle\Rails\null.x ;beacon for power rail gaps and tripcock


--- End code ---

This is where your Third Rail gap code would be, for example, what i used to verify that this is the 3rd rail gap dependency and code for the route end:


--- Code: ---X, .Beacon 20; 1; 0; Y
--- End code ---

X, is the position where you would place your beacon within the route.

Y, in length in meters, is how long your gap will last. the higher the number, the longer the gap.

so:

--- Code: ---190, .Beacon 20; 1; 0; 15
--- End code ---

As you can see, this beacon is placed 190 meters within the route (in this case, 1969 Franklin Ave shuttle), and the duration is 15 meters.


Create a blank object that will be associated with the beacon. Null.x can be found in various routes.

BStyles:
Okay...so is this for the developers, or for people wishing to modify the routes? Because if so, you're going to have to run through the route to find all of the gaps if you don't know where they are, and the meter marks for them.

BStyles

[CT1660]:
It's intended for route and train developers, so they can add them on their current projects, future projects, or update their older projects. This should ease them in creating the gaps, and adding them to their trains to take advantage of this.

TJay1724:
This is a good idea. However, NYC trains no longer lose power between 3rd rails gaps. Power is now supported throughout the car in the gap because NYC trains supply a short system battery in all cars now to provide power for a short period of time should the train leave contact with the 3rd Rail. Thus, no train power loss and no lights go out. It just wouldn't make any sense to code this into trains or routes since no train in the NYC system losses power over gaps anymore. The only way I could see this being used is on older trains such as your upcoming R16 and routes from the past such as the 1969 shuttle.

nelson3001:

--- Quote from: TJay1724 on January 14, 2012, 01:56:14 pm ---This is a good idea. However, NYC trains no longer lose power between 3rd rails gaps. Power is now supported throughout the car in the gap because NYC trains supply a short system battery in all cars now to provide power for a short period of time should the train leave contact with the 3rd Rail. Thus, no train power loss and no lights go out. It just wouldn't make any sense to code this into trains or routes since no train in the NYC system losses power over gaps anymore. The only way I could see this being used is on older trains such as your upcoming R16 and routes from the past such as the 1969 shuttle.

--- End quote ---
Actually the HVAC turns off on the NTT and once on a late night special 2 run I think to E180 Street, the train stopped over a third rail gap and some of the lights turned off because it layed on the gap for a few minutes. It takes a while for the onboard battery to loose power but it does. Also, sometimes when an NTT goes over a rail gap sometimes a few lights dim along with the HVAC turning off.

Navigation

[0] Message Index

[#] Next page

Go to full version