Open Nec Engine Rescripting

Discussion in 'Content Developer's Area' started by trinancrat, Mar 10, 2021.

  1. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    [​IMG]
    [​IMG]
    Open NEC is a free and open-source Train Simulator Classic mod that greatly enhances the functionality of passenger locomotives released for the Northeast Corridor (Washington, D.C. to Boston) locale. It’s a complete rescripting effort, using code written from scratch, to achieve an ultra-realistic driving experience.

    For downloads and more information about the mod, visit the project website.



    Drive easier with quality of life improvements.
    A scrolling menu for changing destination signs. A progress bar for switching dual-power locomotive modes. Automatic bell when blowing the horn. And, oh, did we mention fading ditch lights?

    Safety systems? We have safety systems.
    The mod includes complete implementations of the two safety systems in use on the corridor. Amtrak's Advanced Civil Speed Enforcement System (ACSES) finally gets a proper rendition, with a braking curve that provides advance warning of any reduction in the track speed limit. Automatic Train Control (ATC), which enforces the cab signal speed, is delightfully bug-free and is universally compatible—no longer do you need to switch it off just because your consist didn't ship with the route DLC you're driving. A must-have if you play scenarios from the scenario packs or the Steam Workshop.

    Plays nice with other community content.
    The mod is fully compatible with Fan Railer's popular physics and sound enhancement packs. Plus, it sends the consist messages needed to power the next generation of community content, like the Amfleet I Enhancement Pack and Ragno's Viewliners.

    Enhances almost everything that moves passengers on the Northeast Corridor.
    Currently, the complete list of enhanced locomotives includes:
    (If your Train Simulator collection isn't quite yet complete, don't worry—each script replacement is standalone and doesn't depend on the full set of DLC to work.)
     
    Last edited: Nov 1, 2023
    • Like Like x 6
    • Helpful Helpful x 2
  2. cActUsjUiCe

    cActUsjUiCe Developer

    Joined:
    Sep 21, 2017
    Messages:
    681
    Likes Received:
    2,179
    Cactusjuice approved haha
     
    • Like Like x 3
  3. NEC Railfan

    NEC Railfan Well-Known Member

    Joined:
    Jan 29, 2020
    Messages:
    976
    Likes Received:
    1,025
    I'm starting to tear up with joy.
     
    • Like Like x 1
  4. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    Why, thank you. That's quite the compliment. :)
     
    • Like Like x 1
  5. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    v0.2.0 is out! This release adds support for the Acela Express and Bombardier HHP-8.

    The HHP-8 no longer freaks out and forces a stop when running on the New York-Philadelphia route, while the Acela has gained new destination signs that cover the entire route from Washington to Boston. Have a look:

    AcelaDestinations.jpg
     
    • Like Like x 5
  6. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    Making good progress with the ACS-64. It's a neat locomotive because it's the only one in TS1 that includes the modern aspect display unit with combined signal and track speeds. Check it out!

     
    • Like Like x 3
  7. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    v0.3.0 is out! Here's the changelog:
    • Support for the Amtrak ACS-64.
    • Support for the MARC MP36PH and Multilevel Cab Car.
    • ACSES:
      • Temporarily disable positive stop as it is a nuisance in yards and stations.
    • Amtrak Acela:
      • Fix ditch lights rendering even when turned off.
    • Amtrak HHP-8:
      • Fix ditch lights rendering even when turned off.
      • Fix Xbox and Raildriver controls when running with Fan Railer's mod.
     
    • Like Like x 3
  8. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    v0.4.0 is out! Here's the changelog:
    • Support for the Amtrak and Metro-North P32AC-DM.
    • Support for the Amtrak P42DC (paths are set for the Washington-Baltimore version).
    • Official support for the Hudson Line route.
    • Amtrak Acela:
      • Critical: Fix broken destination signs and MU pantograph operation.
     
    • Like Like x 2
  9. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    v.0.5.0 is out! Here is the changelog:
    • Support for the NJ Transit Comet V and Multilevel Cab Car.
    • ATC:
      • Logic has been changed to require target deceleration rate AND brake lever in suppression.
    • Amtrak ACS-64:
      • Fix overpowered train brakes.
    • Amtrak P32/P42 and MNRR P32:
      • Ditch lights will now flash when switched on.
      • Equipment speed limit raised to 110 mph for Amtrak locos.
    • Bombardier Multilevel:
      • Brake light indicators reinstated.
      • Manual door control reinstated.
      • Destination sign control reinstated.
      • MARC Multilevel destination signs texture swapped for MARC destinations.
     
    • Like Like x 2
  10. benhhng

    benhhng Member

    Joined:
    Jun 1, 2020
    Messages:
    117
    Likes Received:
    15
    Do the industrial line around Morrisville exist? And do the New York Penn have the West Side Yard and Empire Corridor? Also, are the size of AEM, ACS and Amfleet as real?
     
  11. NEC Railfan

    NEC Railfan Well-Known Member

    Joined:
    Jan 29, 2020
    Messages:
    976
    Likes Received:
    1,025
    There are no route or model modifications with this install, only scripting.
     
  12. seanpholland

    seanpholland Member

    Joined:
    May 15, 2021
    Messages:
    34
    Likes Received:
    14
    Thanks for the great work! I dream of someday getting the New Haven-Boston route finished, though I realize it's brutally hard with the TS editor. But having improved locos is a fantastic addition.
     
    • Like Like x 1
  13. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    Thanks! I really appreciate it. :)

    It's been awhile since I've made a new release, but that changes today! I've been making a lot of behind-the-scenes improvements to the code and to my build system. So, without further ado...

    v0.6.0 is out!
    • Support for the NJ Transit ALP-45DP and ALP-46.
    • ATC:
      • Removed target deceleration rate requirement to achieve Suppression.
      • Fixed occasional failure to detect Suppression in locomotives with notched controllers.
      • Added support for Brandon Phelan's new Washington-Baltimore signal scripts.
    • Bombardier Comet V and Multilevel:
      • Changed speed bars to show the ACSES braking curve at all times.
      • Reinstated power mode changing when MU'ing with an ALP-45DP (see notes).
      • Reinstated blended braking and safety systems cut in/out.
      • Fixed HEP status and destination sign not being synced to other coaches.
    • MPI MP36PH:
      • Reinstated safety systems cut in/out.
    • All locomotives:
      • Removed the acknowledge auto-reset feature. Clicking the exclamation mark icon in the HUD now sticks the acknowledge control in the pressed state, as with other equipment in TS1.
     
    • Like Like x 2
  14. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    v0.7.0 is out!
    • Support for the NJ Transit Arrow III and GP40PH-2B.
    • Bombardier HHP-8:
      • Critical: Fixed nil error in script.
    • Bombardier ALP-45DP:
      • Reinstated exhaust fans.
      • Exhaust particles now increase or decrease depending on power output.
    • Siemens ACS-64:
      • Fixed wheelslip indicator being perpetually illuminated.
    The last locomotive I plan to overhaul will be the Metro-North M8, since the focus of the mod is on modern operations with PTC. Once the M8 is ready to go, I'll designate future Open NEC releases as 1.x.x.
     
    • Like Like x 2
  15. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    Hooray! v1.0.0 is out!
    • Support for the Metro-North M8.
      • Includes a notched master controller and, when used with Fan Railer's physics mod, blended braking.
    • ATC:
      • Fixed duplicate enforcement alarms.
    • ACSES:
      • Added acknowledgement for all civil speed drops.
      • Increased alert and penalty curve margins to 3 and 6 mph.
      • Cab displays now show a Stop aspect when nearing a Stop signal with a Restricting pulse code in force, to simulate a positive stop. There is a braking curve for the detection of positive stops, but there is no enforcement of the positive stop. Scripting limitations require OpenNEC to show a positive stop for all stop signals, not just ones at interlockings.
      • Reduced instances of "forgetting" the upcoming speed limit on heavier routes like New York-New Haven and Washington-Baltimore.
    • Acela Express:
      • Added a destination sign for New Carrollton, which Acela stopped at during its first few years of service.
    • EMD GP40PH-2B:
      • Changed strobe light pattern to be more prototypical.
    • GE Arrow III:
      • Restored ability to lower the pantograph using the cab control.
      • AI trains now turn on their bright headlights.
    • Amtrak locomotives:
      • Changed ditch lights to flash at a prototypical frequency.
    • NJ Transit locomotives:
      • Speed drop alarms can now be acknowledged and silenced.
      • Speed drop sounds now play at the beginning of the braking curve, not the end.
    • All locomotives:
      • For locomotives for which it would be unrealistic, sounding the horn no longer flashes the ditch lights.
      • Train brake status is now sent via consist message 10101, which enables the brake lights on Dovetail's Superliners and Ragno's Viewliner to work.
    This release really took awhile because I decided to rebuild the safety systems from the ground up, so I could make many improvements. Also, the MTA Unofficial Discord really knows a lot about the M8, so I had to get it just right. :D
     
    • Like Like x 2
  16. Cyclone

    Cyclone Well-Known Member

    Joined:
    Feb 29, 2020
    Messages:
    3,160
    Likes Received:
    1,051
    So how would this work? Is this added to the original routes and scenarios or does it take and possibly even combine these routes into a cohesive and operable network?
     
  17. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    The safety systems on each locomotive will behave realistically when playing any existing routes and scenarios. There is no additional or merged content.
     
  18. Cyclone

    Cyclone Well-Known Member

    Joined:
    Feb 29, 2020
    Messages:
    3,160
    Likes Received:
    1,051
    Gotcha. I wondered about that when I first heard. So it's more for the trains than the routes, which otherwise stay as they are.
     
    • Like Like x 1
  19. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    v1.1.0 is out! The big ticket items are support for the M7 and Shoreliner, by popular request.
    • Fixed ZIP download failing to extract in Windows Explorer.
    • By popular demand, support for the Metro-North M7 EMU and Shoreliner cab car.
    • Metro-North locomotives:
      • ATC now correctly enforces 15 mph for Restricting and 80 mph for Clear/Normal.
    • Siemens ACS-64:
      • Fixed alerter not triggering the safety systems warning icon on the HUD.
      • Fixed desk and console light controls to behave prototypically.
      • Horn now correctly plays the bell and flashes the ditch lights.
      • Reinstated blended braking.
      • Enhanced compatibility with CTSL Railfan's enhancement pack:
        • The Suppression threshold is now set correctly for the automatic brake lever.
        • Pressing Shift+' moves the brake lever to the correct Suppression setting.
        • The safety systems alarm sound now plays continuously and correctly.
    • Acela Express:
      • Added fading effect for ditch lights.
      • Horn now correctly plays the bell.
    • NJ Transit locomotives:
      • Fixed ACSES braking curve overriding the ATC-enforced speed when approaching a speed limit drop.
    • All locomotives:
      • Added popup alerts that trigger when encountering a change in electrification.
      • Added popup alerts that trigger when starting and stopping a power change in a dual-mode locomotive.
     
    • Like Like x 2
  20. Cyclone

    Cyclone Well-Known Member

    Joined:
    Feb 29, 2020
    Messages:
    3,160
    Likes Received:
    1,051
    What's planned for the next go? You're really been working at this!
     
  21. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    For now, I have no plans to upgrade any additional locomotives. I had originally considered rewriting the route signal scripts, which is also technically possible to do, but decided it would be too much work, with too many potential incompatibilities with the existing libraries of scenarios.

    Currently, I'm working with the team behind TypescriptToLua to potentially bring Typescript compatibility to Train Simulator (TSTL requires Lua 5.1 or above; TS uses 5.0). Typescript is a much richer language than Lua, with many valuable features, such as a strict typing system that prevents many common programming mistakes. If we could write scripts for Train Simulator with Typescript, that would be brilliant!

    Another long-term goal would be to improve the cockpit interfaces for ATC & ACSES. With the help of another modder--someone experienced in building 3D models for TS--I could install more realistic and complete Amtrak/NJ Transit/MTA panels into each locomotive. Or, with the help of the Raildriver API, you could even build a web app for OpenNEC, and get ATC & ACSES on your phone!

    And aside from these long-term goals, there will always be bugs to squash from time to time. ;)
     
    • Like Like x 1
  22. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    A new minor release is out for a hotfix: Certain diverging cab signals in MTA territory weren't getting interpreted correctly and were falling back to Restricting. This was known to occur on the New Haven and Hudson Line DLC's.
     
    • Like Like x 1
  23. slenderman7676RBLX

    slenderman7676RBLX Member

    Joined:
    Mar 18, 2018
    Messages:
    63
    Likes Received:
    41
    Hi. I wonder if this project is still actively being worked on in the background since there haven't been any updates for over a year now?
     
  24. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    Rest assured, I've been hard at work; there just hasn't been anything to report lately. Over the past year, I've been switching the entire codebase from Lua to TypeScript, which should virtually eliminate any runtime errors. I'm also aiming to get the safety systems in an even better state. For example, Amtrak recently switched their ACSES displays to count down speed limits (as depicted in the Trenton Line for TSW) and this will be present in Open NEC 2. Also--and I know this will be a community favorite--all locomotives will have fading ditch lights in Open NEC 2. :)

    On the side, I have also been working with Fan Railer and CTSL Railfan to add custom scripted behavior for their mods.
     
    • Like Like x 1
  25. Cyclone

    Cyclone Well-Known Member

    Joined:
    Feb 29, 2020
    Messages:
    3,160
    Likes Received:
    1,051
    Neato.

    Did we clarify whether existing scenarios on the original routes work on this project, BTW? Or would they not be compatible? Could be worth testing some Workshop scenarios (official ones are staying put). My guess is they would not work, however, due to signalling changes.
     
  26. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    I intend for all scenarios, official and workshop, to remain compatible and playable. The mod does not affect the operation of the signals themselves, just the way that the engine scripts interpret the messages sent by them--so in that sense there are no "signalling changes." Indeed, Open NEC actually significantly enhances many workshop scenarios. If the rolling stock picked by the scenario designer is a mismatch for the route, there's no need to worry about safety system incompatibilities; it all just works.

    (At some point, I actually investigated writing replacement signal scripts. It's technically possible, but with massive potential for changing the way that scenarios play, so I concluded it's not really worth the effort.)

    That said, there is ample room for other kinds of scenario breakage. For example, engine scripts also control which lights that AI trains switch on, or how dual-power locomotives switch between power modes. So if something is obviously broken, it's a bug, and I would welcome a report.
     
  27. kerry

    kerry New Member

    Joined:
    Jul 12, 2023
    Messages:
    2
    Likes Received:
    0
    I'm a Chinese Train SIM player. I create a Train SIM scenerio and published it in Steam Workshop. Some friends are interested in it, they ask me if I can make a DLC based on their own ore mine train route. But unfortunately I don't know LUA language at all. Can anybody tell me how much money to make a DLC?
     
  28. trinancrat

    trinancrat Member

    Joined:
    Jul 25, 2018
    Messages:
    41
    Likes Received:
    82
    v2.0.0 is out, and being the first release in over a year, it's a big one! The TypeScript rewrite is complete, and I used the opportunity to implement a bunch of improvements that affect every loco in the mod. Here's an announcement video describing the most notable changes:



    Full changelog:
    • Complete rewrite of the project using TypeScript instead of Lua. This introduces type safety, which should mean the end of runtime errors and easier project development and maintenance going forward.
    • Complete rewrite of all safety systems:
      • Alarm and penalty behavior now conforms to cActUsjUiCe's specifications.
      • The "ATC" and "ACSES" lights now flash to indicate which system is in an alarm state.
      • The alerter is disabled if both ATC and ACSES are disabled.
      • Safety systems can be acknowledged by switching to an external view.
    • Improved performance for sessions with lots of locomotives, especially MU units like the M7 and M8.
    • Support for the NJ Transit Comet IV cab car included in the Morristown DLC.
    • Added destination sign selector UI from the LIRR DLC.
    • Added progress bar UI for dual-power mode changes.
    • All equipment automatically rings the bell upon sounding the horn.
    • All equipment has a fading effect for lights controlled by scripting, such as ditch lights.
    • All equipment makes use of the reverse ditch lights and reverse cab lights when changing ends.
    • All equipment can switch Amfleet I enhancement pack cars to low-platform mode by placing the reverser in neutral. (AI trains will use a sane, equipment-specific default.)
    • ACS-64: Use Amtrak's 2022 countdown-style ADU as seen in TSW.
     
    • Like Like x 1

Share This Page