More on the MSTS Interface

The weather here has been rather awful the past few weeks, with temperatures exceeding 35C. This coupled with a number of comments I have received have encouraged me to concentrate on the interfacing part of the simulator – i.e. the code that allows external control of MSTS.

My intention is to create a generic API for MSTS that programmers can use to interface any number of devices into MSTS.

To this end I have considerably tidied up the VB code and modified it to make it easy to add new functionality – primarily by ensuring all the memory addresses are maintained in global variables, rather than just ad-hoc as it was before 🙂

Below are a couple of screenshots of me driving MSTS entirely “keyboard free” using the VB “MSTS_CONTROL” app. At this stage I only have throttle, brake, “zero brake pipe”, amp gauge and brake pipe gauge controls, but I’ll add the remaining ones in shortly. I will then expose all the functions (as a dll) which will complete version 1 of the msts_control library.

MSTS being controlled "keyboard free"

MSTS being controlled "Keyboard Free"

5 thoughts on “More on the MSTS Interface

  1. I’m looking forward to your description of the VB code and DLL implementation. Establishing a method for input of external hardware commands into MSTS without the need for keystroke emulation will be a major breakthrough. Will your DLL utilize a COM or USB interface port?

    As an independent evaluation of your approach, my time and simulator are available to potentially provide a test platform. That essentially is what Steve Millington in the UK and I did as he developed his interface. Just let me know if you have an interest in doing this.

    We obviously have a very small group of enthusiasts, but breakthroughs such as yours may encourage others to start projects. There is one other individual (Raymond Brooks) in New South Wales that I have been corresponding with that I alerted to your web site.

  2. Thanks Doug – I appreciate your input as it was your initial work with Cheat Engine that provided the major breakthrough in getting things moving and was a major inspiration to me.

    The DLL will simply be exposing a series of software calls to control MSTS, people are free to interface it to whatever hardware suits. In my case it will actually be a network interface as I am intending to offload the hardware control to a separate PC.

    One further thing to my post above – it appears diesel, steam and electric are a bit different. I’ve tried the app with a diesel and certain functions work and others don’t. I will put the code in to cope with diesels shortly.

  3. I too am building a real world interface for MSTS using real locomotive control parts and gauges. I intend to use real air brake equipment with real air. I’d like to hear more about how to interface with MSTS. I don’t have any difficulty controlling MSTS using PI Engineering’s “X-Keys” interface modules, but I do have a lot of trouble reading the gauges and translating them to work real world instruments.


    • Solved the gauge problem in MSTS finally with an optical interface on the CRT. I use a custom cab instrument (such as speedometer) set up as a black and white bar graph, then look at it with a photocell. I do have some linearity problems but solve that by using a variable width mask over the photocell to compensate for the photocell non-linearity. The photocell output drives a milliampmeter with a custom dial. For simple on-off functions like wheel slip and cab signal, I use a photocell array that watches a custom cab instrument that has a blinking white dot on the black background. Since MSTS likes 1600×1200 pixel graphics, I set all the cab instruments to display in the bottom 1600×300 pixel area with the projector set to display the top 1600×900 (16×9) pixels. In this way I can get all the gauges to display on real instruments and the driver only sees scenery and the track ahead on the projection screen. I have an EMD generic GP or SD locomotive cab in operation at the Paducah Railroad Museum (Kentucky) for over two years now.

Leave a Reply

Your email address will not be published. Required fields are marked *