I Created A Mod/software To Directly Control In Game Trains Using A Joystick (no Raildriver)

Discussion in 'TSW General Discussion' started by liam#5302, Apr 3, 2025.

  1. liam#5302

    liam#5302 New Member

    Joined:
    Jan 11, 2025
    Messages:
    1
    Likes Received:
    6
    As the title says! It's been a few months of work but I finally have it in a good and stable state with a lot of locos pre-configured. (basically all the ones I personally have access to).

    This isn't some kind of rail driver interface or just a basic keymapper (although it does also handle keymapping for most actions) - it directly interfaces with the in game controls through a UE4SS mod to send raw inputs to the levers and buttons. It's also fully configurable through JSON config files if you want to change the way your the levers interact with the train.

    You can find the project on GitHub https://github.com/LiamMartens/tsw-controller-app

    The set-up and initial configuration depending on your joystick controller takes a little bit of effort, but it the steps are outlined in the beta package readme file https://github.com/LiamMartens/tsw-controller-app/blob/main/beta.package/README.md
     
    • Like Like x 6
  2. C525B

    C525B New Member

    Joined:
    Aug 19, 2019
    Messages:
    17
    Likes Received:
    9
    I've been messing around with Liam's software for a couple weeks now...it is extremely powerful and I strongly recommend it to anyone who wants to use a USB controller with TSW, and has the basic ability to use a text editor to edit a script. It's really great stuff. Please check it out. You can bind almost any control to almost any type of controller.

    In my case, I'm using a VPC Control Panel #3. It's got levers, rotary controls, rotary encoders, buttons, momentary switches, toggle switches...I can bind pretty much anything and everything I want. It takes some time to set up each cab, but I've found it to be extremely powerful, and I can create set-ups that are far superior to the RailDriver.
     
    • Like Like x 1
  3. OpenMinded

    OpenMinded Well-Known Member

    Joined:
    Feb 10, 2021
    Messages:
    1,225
    Likes Received:
    2,023
    The UE4SS interface really has the potential to be a game changer for external programs that need to interact with the game. Personally I am really enjoying the live weather mod, which uses the same interface. Still waiting for an EBuLa to make an appearance, though.

    However, as long as DTG is still experimenting with their own API (which is supposed to be released with the next official editor update, btw) you don’t really have control over its functionality. The weather mod, for example, stopped working two patches ago and has just recently started working again with the latest patch… I hope that there will be more consistency once the interface is officially supported by DTG.
     
  4. subwayvaughn

    subwayvaughn Active Member

    Joined:
    Sep 2, 2020
    Messages:
    67
    Likes Received:
    181
    Is there a time frame on when this API will be released?
     
  5. OpenMinded

    OpenMinded Well-Known Member

    Joined:
    Feb 10, 2021
    Messages:
    1,225
    Likes Received:
    2,023
    In one of the last streams (I believe it was the April roadmap stream) Matt said that it would be released with the next official editor update and that it should not be long any more. No precise timeline was given…
     
    • Like Like x 1
  6. lovetrains 3628

    lovetrains 3628 Active Member

    Joined:
    Jan 13, 2022
    Messages:
    494
    Likes Received:
    161
    is the api just pc
     
  7. OpenMinded

    OpenMinded Well-Known Member

    Joined:
    Feb 10, 2021
    Messages:
    1,225
    Likes Received:
    2,023
    I have absolutely no idea tbh…
     
    • Like Like x 1
  8. subwayvaughn

    subwayvaughn Active Member

    Joined:
    Sep 2, 2020
    Messages:
    67
    Likes Received:
    181
    Hopefully it comes to fruition. Thank you.
     
  9. zappatime

    zappatime Well-Known Member

    Joined:
    Mar 19, 2020
    Messages:
    212
    Likes Received:
    370
    What does this do that CobraOne's interface cannot do? UE4SS is used with two mods (Luex's TSW Live and Historic Weather, and Tyler58546's Automatic Train Announcements) both of which can have problems/crashes possibly related to UE4SS.
     
  10. OpenMinded

    OpenMinded Well-Known Member

    Joined:
    Feb 10, 2021
    Messages:
    1,225
    Likes Received:
    2,023
    Well, for one it would be officially supported. This, I would hope, would prevent it from occasionally stop working after certain updates…

    What exactly it can do I have no idea. All we know is it’s in work with DTG for quite some time now.
     
  11. zappatime

    zappatime Well-Known Member

    Joined:
    Mar 19, 2020
    Messages:
    212
    Likes Received:
    370
    My question was regarding liam#5302 ’s mod/software, not DTG’s api, which has been talked about by since TSW2 and we’re still waiting!
     
  12. haskell99

    haskell99 New Member

    Joined:
    Jul 5, 2024
    Messages:
    24
    Likes Received:
    9
    Trying to figure out how to get this to work but have a question. In the instructions it says:

    1. Switch to the UE4SS debugging tools and go to the "Dumpers" menu. Click "Generate LUA Types".

    2. Now you will have to open up a code editor inside the ue4ss directory and you are going
      to need to look for the loco class
      which inherits the ARailVehicle class in Lua. You will be looking for something like this: ---@class ARVM_BPE_AMTK_Acela_PowerCarBase_C : ARailVehicle (this is from the Acela pak).
    What file do we open in the code editor? The Debugging Tool screen just stays blank.
    Thanks!
    Eddie
     
  13. C525B

    C525B New Member

    Joined:
    Aug 19, 2019
    Messages:
    17
    Likes Received:
    9
    Yeah, totally...the DTG API stuff was a diversion of this thread.

    So, Liam's software allows direct access to the analog axes of a controller, as well as knobs, buttons and other controls, via a simple scripting language for the bespoke locomotive config files. The documentation on the GitHub is pretty helpful, but I am also happy to help as I have made quite a number of profiles now.
     
  14. C525B

    C525B New Member

    Joined:
    Aug 19, 2019
    Messages:
    17
    Likes Received:
    9
    That step just dumps a bunch of files with the properties of the rolling stock for that route or scenario, which you then need to sift through.

    Notepad++ is a great, free software to have here. What you need to do is browse to:
    [OS drive]C:\Program Files (x86)\Steam\steamapps\common\Train Sim World 5\WindowsNoEditor\TS2Prototype\Binaries\Win64\ue4ss\Mods\shared\types

    And look for the files that start with RVM_ eetc.. (You can also use Notepad++ to search all files in this directory for specific text). You basically want to start by finding "IrregularLever" controls, as those are the ones that can be manipulated directly by an axis. Reference the name of those controls in your loco profile file using the examples in the GitHub.
     
  15. haskell99

    haskell99 New Member

    Joined:
    Jul 5, 2024
    Messages:
    24
    Likes Received:
    9
    Perfect. I use Notepad++ so I just needed to know which files to open. Appreciate your help!
     

Share This Page