Anyone have any API docs? Would love to finally be able to write my own controller inputs. I'm assuming its some C++ tie-in to unreal but I'm definitely not familiar enough with unreal's architecture...
I don't think API documentation is available yet but this is a good startpoint: The API runs on http://localhost:31270/. Start by checking these endpoints using f.e Postman, don't forget to add the api key in the header called "DTGCommKey". When you activate the API by adding the -HTTPAPI launch parameter in Steam, you can find the api key in you user profile under Documents\My Games\TrainSimWorld5\Saved\Config\CommAPIKey.txt http://localhost:31270/list http://localhost:31270/info These give you insight into available nodes and endpoints, great starting points for exploring.
While we wait for the official Train Sim World API documentation, I’ve compiled an unofficial reference PDF based on how ThirdRails uses the API. It includes practical examples of API usage and should be helpful if you’re exploring implementation details. If you’re interested in working with it in C#, I’m happy to share my client code to help you get started. You can download the unofficial API documentation at ThirdRails.org: https://thirdrails.org/Downloads/TSW_API_Unofficial_Documentation.pdf Hopefully this can help anybody out there!
Awesome. The main control goodness is definitely in setFeatureStatus. And because this is HTTP, I don't need the C# code -- I just figured that this was some UE4 dll tie-in under the hood. (It still might be, but if so then TSW has done the work of abstracting it.) This isn't the world's best use case for an HTTP implementation (a websocket layer would absolutely shine here) but async requests ought to get the job done given the absolute minimal latency of local devices. Nice work, much appreciated
Yeah I see what you mean. But I must say that polling the API works fine for ThirdRails. On localhost there’s really no noticeable latency, even when polling multiple times per second for sessions that run over an hour. It’s great that DTG is making this possible it is really fun to build on!
darn right. so many great project ideas floating through my head. now i'm really gonna need to buy a 3d printer and figure out cad. oh no, woe is me
This looks like an interesting API … already thinking of quick hack for my TrainMapper app to show the live positions of everything in the game, just to see how it looks! In theory it’s just replacing the live NR feed with an adapter off the back of this API That being said, if we can only get the lat/long of the player that’s going to be a pretty empty map