BVEStation

Author Topic: TUTORIAL: Third Rail Gap for OpenBVE Trains (Interiors/Exteriors) AND Routes!  (Read 9787 times)

Offline [CT1660]

  • Dispatcher
  • ****
  • Posts: 575
  • Rating: +2/-1
  • Gender: Male
  • openBVE Developer, OMSI Repainter & Engine Modder
    • View Profile
    • Enter The Lair
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: [Select]
#DEVICE
0               ; Ats
0               ; Atc
0               ; Eb
0               ; ConstSpeed
0               ; HoldBrake
-1              ; ReAdhesionDevice
0               ; LoadCompensatingDevice (not used)
0               ; PassAlarm
0               ; DoorOpenMode
0               ; DoorCloseMode

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: [Select]
[Object]
States = 6394OFF.b3d, 6394ON.b3d
StateFunction = pluginstate[53]

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: [Select]
StateFunction = pluginstate[53]
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: [Select]
[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]]

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: [Select]
.Beacon(1) 1969 Franklin Shuttle\Rails\null.x ;beacon for power rail gaps and tripcock


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: [Select]
X, .Beacon 20; 1; 0; Y
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: [Select]
190, .Beacon 20; 1; 0; 15
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.
« Last Edit: March 18, 2012, 07:11:15 am by [CT1660] »

Offline BStyles

  • Head Admin
  • Operator
  • ******
  • Posts: 344
  • Rating: +25/-17
  • Gender: Male
  • The CEO
    • View Profile
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

Offline [CT1660]

  • Dispatcher
  • ****
  • Posts: 575
  • Rating: +2/-1
  • Gender: Male
  • openBVE Developer, OMSI Repainter & Engine Modder
    • View Profile
    • Enter The Lair
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.

Offline TJay1724

  • Developer
  • Conductor
  • **
  • Posts: 150
  • Rating: +13/-0
  • Gender: Male
  • BVEStation Member
    • View Profile
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.
« Last Edit: January 14, 2012, 02:15:14 pm by TJay1724 »

Offline nelson3001

  • Conductor
  • **
  • Posts: 187
  • Rating: +3/-1
  • Gender: Male
  • BVEStation Member
    • View Profile
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.
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.

Offline [CT1660]

  • Dispatcher
  • ****
  • Posts: 575
  • Rating: +2/-1
  • Gender: Male
  • openBVE Developer, OMSI Repainter & Engine Modder
    • View Profile
    • Enter The Lair
Actually, if you're around the 6th-9th car of a Manhattan-bound (7), some of the lights go off when it stops at the 111th St platform due to a gap.

Same is true for the R160A's on the (E). Some of the lights dim.
« Last Edit: January 15, 2012, 04:51:51 am by NYZ3R0DAY »

Offline peacemak3r

  • Dispatcher
  • ****
  • Posts: 536
  • Rating: +11/-2
  • Gender: Male
  • NYCTF
    • View Profile
The lights dimming and HVAC turning off would have to be a feature implemented with the on-board batteries in the car itself.  It's just like one of the alternator's job of a regular car to recharge the battery while the motor is turned on.  I'd assume the on-board batteries wouldn't be able to sustain-ably keep the lights bright and HVAC on at the same time.  I'm not subway car wiz but that's what I think when relating it to a regular car.

Offline TJay1724

  • Developer
  • Conductor
  • **
  • Posts: 150
  • Rating: +13/-0
  • Gender: Male
  • BVEStation Member
    • View Profile
That's exactly my point. The battery is only meant to sustain the car as it crossing over the point or the gap. A lot of transit systems use this method now. I ride the 4,5,6 everyday, and I have never once seen the lights dim or the HVAC even shut off leaving the 3rd rail. Now of course if it's taking longer to reconnect, then yes, the lights will go out and the HVAC would shut off. The battery is only meant to hold for a few seconds on cross. If it's sitting in the gap, then yes, the lights would go off. But again, it is extremely rare for this to happen, thus, it wouldn't make any sense or be realistic to code this into any car after the R32 and up or any route.

Offline [CT1660]

  • Dispatcher
  • ****
  • Posts: 575
  • Rating: +2/-1
  • Gender: Male
  • openBVE Developer, OMSI Repainter & Engine Modder
    • View Profile
    • Enter The Lair
That's exactly my point. The battery is only meant to sustain the car as it crossing over the point or the gap. A lot of transit systems use this method now. I ride the 4,5,6 everyday, and I have never once seen the lights dim or the HVAC even shut off leaving the 3rd rail. Now of course if it's taking longer to reconnect, then yes, the lights will go out and the HVAC would shut off. The battery is only meant to hold for a few seconds on cross. If it's sitting in the gap, then yes, the lights would go off. But again, it is extremely rare for this to happen, thus, it wouldn't make any sense or be realistic to code this into any car after the R32 and up or any route.

Actually besides the R-16, Mr. Railfan's R-30 has this implemented. There are three more projects i am about to begin soon (which i have yet to announce, but it's in my sig). Also, if i do make the interior for DJ Hammer's TOMC, that's going to be 6 trains with this feature.

Offline TJay1724

  • Developer
  • Conductor
  • **
  • Posts: 150
  • Rating: +13/-0
  • Gender: Male
  • BVEStation Member
    • View Profile
That's fine. Any train prior to the R32, such as the one your working on, R1 thru R30 did not have the battery so it is great that those features will be there. The TOMC didn't have the battery b4 overhaul. Back when they were in revenue service. In the early '90's, the TOMC did get the battery as well. But as I have stated b4, since these trains are from the era of the '50's, '60's and '70's, then yes the feature should be there. Not on the NTT's though. Any old school route should also have this feature. Not present day routes though.

Offline SubwayTrainOperator5

  • Dispatcher
  • ****
  • Posts: 761
  • Rating: +3/-4
  • Gender: Male
  • R44, R46, and R68 fan / OpenBVE Videomaker
    • View Profile
    • My YouTube Channel
Wait, if the train does not have the feature, but the route does, then wouldn't the feature not be in effect? And only come into effect if both the train and route have it? So I do not see the reason why the present day routes should not have the feature, as long as we run trains without the feature then it is fine, but it still should be there if you are driving a train with the feature.
Signature Removed (dead link)

Offline TJay1724

  • Developer
  • Conductor
  • **
  • Posts: 150
  • Rating: +13/-0
  • Gender: Male
  • BVEStation Member
    • View Profile
Good point.

Offline [CT1660]

  • Dispatcher
  • ****
  • Posts: 575
  • Rating: +2/-1
  • Gender: Male
  • openBVE Developer, OMSI Repainter & Engine Modder
    • View Profile
    • Enter The Lair
Actually, on the NTT's, the lighting gets noticeably dimmer (like around 5%-15% dimmer). I have seen this happen on an R142 on the (5) and an R160B (N) train.

Offline Dj Hammers

  • Head Admin
  • Supervisor
  • ******
  • Posts: 1,034
  • Rating: +64/-40
  • Gender: Male
  • 7 Years of Developing for openBVE!
    • View Profile
    • My YouTube Channel
Depending on the condition of the car's battery, the lights may dim or turn off entirely when passing over a 3rd rail gap.
I seem to notice this on the R62s a lot.

Offline SubwayTrainOperator5

  • Dispatcher
  • ****
  • Posts: 761
  • Rating: +3/-4
  • Gender: Male
  • R44, R46, and R68 fan / OpenBVE Videomaker
    • View Profile
    • My YouTube Channel
The dimming lights should be just as easy to implement as the lights turning off completely on the older cars, just use dimmed interior images. (For this reason, it turns out we should have the feature on the routes that are meant to be run with an NTT after all.)
« Last Edit: January 30, 2012, 07:27:40 pm by SubwayTrainOperator5 »
Signature Removed (dead link)