Lua and bin Files

Post your problems and installation issues here!

Lua and bin Files

Unread postby JohnS » Sat Oct 17, 2015 5:49 pm

Well most of you know I have been working on brake mods for a lot of USA add ons. Well today I came across an odd one. NYNH CSX SD40-2 is the odd duck. It has a regular TrainBrakeControl in the Engine.bin file but it also has VirtualBrakeControl. The virtualBrakeControl is what is being used to control the train brakes and takes it's place in the inputmapper file. Now if I remove the VirtualBrakeControl then set the bin file and inputmappers to correct settings the Lua file no longer works. I can't read the Lua file since it is compiled into LuaP (.out) but I don't understand how removing a line in the bin file would effect the Lua. I just figured if the Lua file can't find the reference it would be ignored. Any idea how to make this work? I need to remove the VirtualBrakeControl to make the brakes and the locomotive usable as a player locomotive.
User avatar
JohnS
 
Posts: 1116
Joined: Sun Dec 29, 2013 6:48 am
Location: Portage IN

Re: Lua and bin Files

Unread postby mrennie » Sat Oct 17, 2015 6:11 pm

JohnS wrote:Well most of you know I have been working on brake mods for a lot of USA add ons. Well today I came across an odd one. NYNH CSX SD40-2 is the odd duck. It has a regular TrainBrakeControl in the Engine.bin file but it also has VirtualBrakeControl. The virtualBrakeControl is what is being used to control the train brakes and takes it's place in the inputmapper file. Now if I remove the VirtualBrakeControl then set the bin file and inputmappers to correct settings the Lua file no longer works. I can't read the Lua file since it is compiled into LuaP (.out) but I don't understand how removing a line in the bin file would effect the Lua. I just figured if the Lua file can't find the reference it would be ignored. Any idea how to make this work? I need to remove the VirtualBrakeControl to make the brakes and the locomotive usable as a player locomotive.


You can't remove the VirtualBrake without breaking the brakes. The inputmapper is mapping the VirtualBrake control value to the user input (via the mouse on an in-cab control, or the F4 HUD slider, or an XBox controller lever or button). The LUA script reads that value and does some calculations and transformations on it to get the value for TrainBrakeControl that will cause the required effect on the train brakes - that's because the engine simulation blueprint file (if you look at its train brakes section) is using TrainBrakeControl as the controller for the train brakes. Actually, what really matters to the engine sim blueprint isn't the name of the controller but the names of the notches. Anyway, the point is that VirtualBrake corresponds to the position of the automatic train brake lever that the player sees, whereas TrainBrakeControl is how the script commands the core code to make the train brake cylinder pressure (what you see in the F5 HUD - and nowhere else!) to behave as it should. It's all part of the advanced brake scripting that was introduced into Sherman Hill.
User avatar
mrennie
 
Posts: 3219
Joined: Wed May 30, 2012 12:22 pm

Re: Lua and bin Files

Unread postby JohnS » Sat Oct 17, 2015 6:29 pm

I understand what the VirtualBrakeControl is doing in reguards to the TrainBrakeControl. If I change the inputmapper to use TrainBrakeControl then remove the VirtualBrakeControl from the bin file I can get the brakes to function properly using the pressures and handle positions from the simulation and engine bin files but it breaks the Lua file scripting. If I leave it alone the pressures and handle positions are all incorrect no matter what I do to the Engine and Simulation bin files. If I can't adjust the Lua file then there is no way to correct what is incorrect. Am I correct in this?
User avatar
JohnS
 
Posts: 1116
Joined: Sun Dec 29, 2013 6:48 am
Location: Portage IN

Re: Lua and bin Files

Unread postby JohnS » Sat Oct 17, 2015 7:06 pm

any way to edit\Decompile the LuaP (out) file so the brake handle and pressures operate in the correct range?
User avatar
JohnS
 
Posts: 1116
Joined: Sun Dec 29, 2013 6:48 am
Location: Portage IN

Re: Lua and bin Files

Unread postby mrennie » Sat Oct 17, 2015 7:56 pm

JohnS wrote:I understand what the VirtualBrakeControl is doing in reguards to the TrainBrakeControl. If I change the inputmapper to use TrainBrakeControl then remove the VirtualBrakeControl from the bin file I can get the brakes to function properly using the pressures and handle positions from the simulation and engine bin files but it breaks the Lua file scripting. If I leave it alone the pressures and handle positions are all incorrect no matter what I do to the Engine and Simulation bin files. If I can't adjust the Lua file then there is no way to correct what is incorrect. Am I correct in this?


If you break the LUA scripting, you won't have advanced brakes and no matter what you do to the inputmapper and engine sim file, the brakes will be very unrealistic because the default coding for the brakes doesn't cope with things such as engine brake bail-off, pressure wave propagation, quick service release, proper recharging of the auxiliary reservoirs, etc.

EDIT: Wait, I just realised that we're talking about the NYNH SD40-2, not the Sherman Hill diesels. The NYNH was done before the advanced brakes for SH, so they could well be the not-very-advanced brakes (not done by me). In which case, ignore what I said about the SH advanced brakes *!embar*!

In any case, if the LUA is reading from VirtualBrake and then writing to TrainBrakeControl, it'll continue to try do that even if you remove VirtualBrake from the engine blueprint and the inputmapper. It might actually cause the LUA script to crash when it tries to get a value from a controller that it can't find anymore. At best, it'll write rubbish to TrainBrakeControl.

There's no way to decompile (or reverse engineer) the .out files. The best you can do is to replace the .out file with a basic one that does practically nothing (like from the old SD40-2). That way, it won't interfere with the normal core code handling of the brakes (and everything else).

I see what you mean about the brakes in the NYNH SD40-2 - they're a mess.
User avatar
mrennie
 
Posts: 3219
Joined: Wed May 30, 2012 12:22 pm

Re: Lua and bin Files

Unread postby mrennie » Sat Oct 17, 2015 8:18 pm

If it were me, I'd copy over the .out, engine and simulation bin files from the SH SD40-2 and then edit the names and texture paths and so on.

Personally, I think it's a pity that DTG haven't chosen to update all the diesels, on every route, to have my advanced brakes. I can't stand using the old ones now.
User avatar
mrennie
 
Posts: 3219
Joined: Wed May 30, 2012 12:22 pm

Re: Lua and bin Files

Unread postby jalsina » Sun Oct 18, 2015 12:24 am

I crossed by a nightmare with a similar situation, a couple months ago.
As many of you may know the CSX SD80MAC has an annoying brakes problem. If you brake, it will change notches up to lapped and then from about 26% of handle control it will jump suddenly to different brake notches (lap goes up to 45%), resting finally in emergency state at 100%. So every time you brake it is very easy hitting the brakes and fall into emergency.

Those brakes have the same two blueprints mentioned here, one for virtual brakes and the other for train brakes control.
I tried to make changes in both BP with no success. When trying fixing the problem I lost digital pressure readings or the controls animation or whatever. Finally I realized the bug was in the lua script.
I tried to look for a way to decompile the out file but had no success (there are a couple decompilers in the Internet).

I tried changing different notch positions, deleting parts of coding, exchanging code, with no success at all.
At the end I surrendered the fort and to bear the annoyance I deleted the emergency notch and changed somewhat the notches values. Now when I brake at least the diesel doesn't fall into emergency but it keeps jumping to the last brakes state. If I need to brake to emergency I just press the stop button in the cab.
During my testing I realized that most of the braking pressures values were located in the simulation bin.

DTG is aware of that bug, not only because of my posts in Steam, but because of an opinion request thread that was initiated a year ago by someone of DTG in the forum, to know about the opinion of players related with that DLC. There both major bugs, the brakes and the couplings were exposed by different users.
Intel i7-7900K (3.60 GHz) - ASUS Prime Z390A - 32 GB DDR4 RAM 2400 MHz
GPU EVGA GTX-1060 OC 6GB at 1920x1080, 144 Hz - Monitor ASUS VG-248QE
System Windows 11 Pro in WD SSD 500 GB. Games in Inland 1Tb M.2 NVMe PCIe
User avatar
jalsina
 
Posts: 2010
Joined: Sun Jul 05, 2015 8:32 pm

Re: Lua and bin Files

Unread postby JohnS » Sun Oct 18, 2015 6:12 am

mrennie wrote: Wait, I just realised that we're talking about the NYNH SD40-2, not the Sherman Hill diesels. The NYNH was done before the advanced brakes for SH, so they could well be the not-very-advanced brakes (not done by me). In which case, ignore what I said about the SH advanced brakes *!embar*!

In any case, if the LUA is reading from VirtualBrake and then writing to TrainBrakeControl, it'll continue to try do that even if you remove VirtualBrake from the engine blueprint and the inputmapper. It might actually cause the LUA script to crash when it tries to get a value from a controller that it can't find anymore. At best, it'll write rubbish to TrainBrakeControl.

There's no way to decompile (or reverse engineer) the .out files. The best you can do is to replace the .out file with a basic one that does practically nothing (like from the old SD40-2). That way, it won't interfere with the normal core code handling of the brakes (and everything else).

I see what you mean about the brakes in the NYNH SD40-2 - they're a mess.


Yes the NYNH SD40-2. Ok so it will crash the Lua then. I haven't purchased the 2016 update just the free one so I'm assuming I don't have the upgraded Sherman Hill route or content so I don't have access to your braking model. Is there any chance that you have the Lua file with the new braking model so I can try to add the flashing ditch lights and cab signals used by CSX? I think the Horn triggered bell is also part of the lua I would need to add? Since this was sold to DTG you probably aren't allowed to just hand it out then? Thank you mrennie.
User avatar
JohnS
 
Posts: 1116
Joined: Sun Dec 29, 2013 6:48 am
Location: Portage IN

Re: Lua and bin Files

Unread postby _o_OOOO_oo-Kanawha » Sun Oct 18, 2015 6:23 am

mrennie wrote:If it were me, I'd copy over the .out, engine and simulation bin files from the SH SD40-2 and then edit the names and texture paths and so on.

Personally, I think it's a pity that DTG haven't chosen to update all the diesels, on every route, to have my advanced brakes. I can't stand using the old ones now.


Why don't you release the (yours?) advanced braking in lua so it can be used to update all the other locomotives? Bailing off on the independents using the handle is probably not possible without the proper animation, but can still be simulated using the HUD, keyboard or XBOX? The escutcheon plate is well simulated, PCS cutout in a way also. Proper wheel slip detection and automatic bail off when using the dynamics?

I also hate to have to run straight, broken (CMP, MP, NYNH, NSCD, CSX) or useable realistic braking (SH, SS and some individual locos) next to each other.
I have removed all of the broken advanced braking by remapping the inputs back to the core game engine controllers, leaving the virtuals untouched in the .out file. Because dropping in an old Kuju straight engine simulation will remove useful features like blinking ditch lights or cab signalling.
Edwin "Kanawha"
Image
The Chessie, the train that never was ... (6000 hp Baldwin-Westinghouse steam turbine electric)
User avatar
_o_OOOO_oo-Kanawha
 
Posts: 3231
Joined: Mon Nov 14, 2011 2:12 pm

Re: Lua and bin Files

Unread postby mrennie » Sun Oct 18, 2015 7:41 am

_o_OOOO_oo-Kanawha wrote:
Why don't you release the (yours?) advanced braking in lua so it can be used to update all the other locomotives?


There's quite possibly more value in the .lua source for the advanced braking than there is in many a .3ds file, and just as I would never release a payware model's source geometry files (not even the geopcdx file, for that matter), nor would I release its script source code. The fact that the script has considerable value is evident, given that DTG themselves paid me a reasonable sum of money to develop it (it was based on the code I developed for the FEF-3, but then adapted for the newer air brake control stands and with a much improved simulation of the auxiliary reservoirs, better simulation of pressure wave propagation, inclusion of PCS, etc., all of which cost time and money to do).
User avatar
mrennie
 
Posts: 3219
Joined: Wed May 30, 2012 12:22 pm

Re: Lua and bin Files

Unread postby JohnS » Sun Oct 18, 2015 8:09 am

mrennie wrote:There's quite possibly more value in the .lua source for the advanced braking than there is in many a .3ds file, and just as I would never release a payware model's source geometry files (not even the geopcdx file, for that matter), nor would I release its script source code. The fact that the script has considerable value is evident, given that DTG themselves paid me a reasonable sum of money to develop it (it was based on the code I developed for the FEF-3, but then adapted for the newer air brake control stands and with a much improved simulation of the auxiliary reservoirs, better simulation of pressure wave propagation, inclusion of PCS, etc., all of which cost time and money to do).

No I agree with you. It's just a shame that they release add-ons that don't work correctly having the full ability and resources to make things correct. For them it's a matter of cut and paste and seems lazy to me for them not to have a team of people that will fix these small things. It would take a week of full time hours to copy paste and test to have everything in the north american content working correctly. They have adopted the business model of "as long as I'm getting paid I don't care if it works". We all will still buy there crap (I'm guilty too) even though they don't live up to their potential **!!2cents!!** .
You have done amazing work and ground breaking animations with physics and they see the work one individual puts toward something and gets scared at the time frame. DTG has the technology to do it so freaking do it! !!**sorry**!! !!bang!!
User avatar
JohnS
 
Posts: 1116
Joined: Sun Dec 29, 2013 6:48 am
Location: Portage IN

Re: Lua and bin Files

Unread postby buzz456 » Sun Oct 18, 2015 8:12 am

Please John give it a rest.
Buzz
39 and holding.
"Some people find fault like there's a reward for it."- Zig Ziglar
"If you can dream it you can do it."- Walt Disney
Image
User avatar
buzz456
Site Admin
 
Posts: 20917
Joined: Sun Mar 21, 2010 8:30 am
Location: SW Florida

Re: Lua and bin Files

Unread postby JohnS » Sun Oct 18, 2015 8:13 am

buzz456 wrote:Please John give it a rest.

you're right Buzz I'm done. sorry about that. I just get frustrated sometimes. and thank you again mrennie for all your help and advancements.
User avatar
JohnS
 
Posts: 1116
Joined: Sun Dec 29, 2013 6:48 am
Location: Portage IN

Re: Lua and bin Files

Unread postby _o_OOOO_oo-Kanawha » Sun Oct 18, 2015 8:34 am

mrennie wrote:
_o_OOOO_oo-Kanawha wrote:
Why don't you release the (yours?) advanced braking in lua so it can be used to update all the other locomotives?


There's quite possibly more value in the .lua source for the advanced braking than there is in many a .3ds file, and just as I would never release a payware model's source geometry files (not even the geopcdx file, for that matter), nor would I release its script source code. The fact that the script has considerable value is evident, given that DTG themselves paid me a reasonable sum of money to develop it (it was based on the code I developed for the FEF-3, but then adapted for the newer air brake control stands and with a much improved simulation of the auxiliary reservoirs, better simulation of pressure wave propagation, inclusion of PCS, etc., all of which cost time and money to do).


Understood. That means the collective of players should try to develop an 'open source' alternative in modular form of many locomotive scripts that can be adapted to use and are free of such restrictions. With TS2016 being the last incarnation and without any notion as to how "open" the new UE4 game will be, I doubt many will find the need and time to develop such a library of scripts. Besides, implementing the advanced braking scripts in SH 2016 broke other things in the locos.

I am inclined to remove the advanced braking from all of my DLC besides SH, for I think it is better to have one modus operandi across the whole game than one advanced loco amidst a stable of straight ones. Sherman Hill is best served with working advanced braking on the FEF, SD40-2, SD70M and ES44AC, plus the new GETL. Soldier Summit is a hodgepodge.

Are AI trains using advanced braking locos running as straight or advanced? I.e. controlled in Simple or Expert mode?
Edwin "Kanawha"
Image
The Chessie, the train that never was ... (6000 hp Baldwin-Westinghouse steam turbine electric)
User avatar
_o_OOOO_oo-Kanawha
 
Posts: 3231
Joined: Mon Nov 14, 2011 2:12 pm

Re: Lua and bin Files

Unread postby mrennie » Sun Oct 18, 2015 9:07 am

_o_OOOO_oo-Kanawha wrote:
Understood. That means the collective of players should try to develop an 'open source' alternative in modular form of many locomotive scripts that can be adapted to use and are free of such restrictions. With TS2016 being the last incarnation and without any notion as to how "open" the new UE4 game will be, I doubt many will find the need and time to develop such a library of scripts.


Well a lot of people have told me, and I believe they were being honest when they said it, that the advanced brakes (introduced into the SD4OT-2 in SS and then across all the diesels in SH) were one of the best things ever to happen to TS ("best thing since sliced bread" was one comment). If you're happy using the legacy, unrealistic brakes, that's up to you.

By the way, the scripts are only part of the story. The advanced brake setup also involves things in the sound blueprints, for example. It would be quite difficult to make it truly modular. In any case, it would take a considerable amount of time to develop from scracth. It certainly took me a long time (starting with the FEF-3). That's why it has a lot of value (maybe not to you, but to other people) and why it can't be given away for free (and I certainly don't want the source falling into the hands of third party competitors).

_o_OOOO_oo-Kanawha wrote: Besides, implementing the advanced braking scripts in SH 2016 broke other things in the locos.


Such as?

_o_OOOO_oo-Kanawha wrote:I am inclined to remove the advanced braking from all of my DLC besides SH, for I think it is better to have one modus operandi across the whole game than one advanced loco amidst a stable of straight ones.


That's up to you to do. Personally though, I would rather see DTG upgrade all those "straight" (which I would prefer to call "legacy", or even better, "unrealistic") locos as soon as feasibly possible (budget and schedule allowing).


_o_OOOO_oo-Kanawha wrote:Sherman Hill is best served with working advanced braking on the FEF, SD40-2, SD70M and ES44AC, plus the new GETL. Soldier Summit is a hodgepodge.


I agree wholeheartedly that Soldier Summit (and all the other routes - NSCD in particular, because it has neither "legacy" nor advanced brakes) ought to be updated. I no longer use any locos that don't have advanced brakes, because it just makes me go "yuck!" when I use anything else.


_o_OOOO_oo-Kanawha wrote:Are AI trains using advanced braking locos running as straight or advanced? I.e. controlled in Simple or Expert mode?


AI locos do execute their engine scripts, but only some of the controls manipulated by the script actually make a difference. A lot of the controlling done by the script is ignored by the core code when the loco is an AI and I believe that includes the brakes (although I'd have to do some experimenting to confirm it).
User avatar
mrennie
 
Posts: 3219
Joined: Wed May 30, 2012 12:22 pm

Next

Return to Problems and Peculiarities

Who is online

Users browsing this forum: No registered users and 0 guests