Custom Overlay/Interface and Joystick helper (with pics)

General discussion about Train Simulator, your thoughts, questions, news and views!

Moderator: Moderators

User avatar
gazz292
Been on the forums for a while
Posts: 231
Joined: Mon Jan 10, 2011 9:46 pm

Re: Custom Overlay/Interface and Joystick helper (with pics)

Post by gazz292 »

awww nooo,
i was hoping your joystick helper would be released soon so i can get to use my driving desk i built,

Always something to throw a spanner in the works tho,
tnleeuw01
Very Active Forum Member
Posts: 2493
Joined: Sat Oct 08, 2011 11:17 am
Location: Diemen, Netherlands

Re: Custom Overlay/Interface and Joystick helper (with pics)

Post by tnleeuw01 »

Does the engine file need to be compiled? Or is it 'only' a performance issue?
User avatar
Havner
Been on the forums for a while
Posts: 293
Joined: Thu Sep 11, 2014 1:32 am

Re: Custom Overlay/Interface and Joystick helper (with pics)

Post by Havner »

Because of the way it works (injecting itself in the loco lua scripts) it's not the easiest thing to install for non technical people anyway. So I'd really like the first release be as little troublesome as possible.
tnleeuw01 wrote:Does the engine file need to be compiled? Or is it 'only' a performance issue?
If I had an original lua scripts for every loco this wouldn't be a problem. As we know RSC is releasing compiled .out files now. And I don't decompile to lua. If I had a means of doing that recompilation wouldn't be a problem. I decompile to bytecode which cannot be run in its own form. So yes. I have to recompile.
tnleeuw01
Very Active Forum Member
Posts: 2493
Joined: Sat Oct 08, 2011 11:17 am
Location: Diemen, Netherlands

Re: Custom Overlay/Interface and Joystick helper (with pics)

Post by tnleeuw01 »

Aha, I see. I understand the problem.
User avatar
Havner
Been on the forums for a while
Posts: 293
Joined: Thu Sep 11, 2014 1:32 am

Re: Custom Overlay/Interface and Joystick helper (with pics)

Post by Havner »

I'm leaving this problem for now. I got somewhat to the bottom of it but fixing it might require for me to have a complete understanding of LUA bytecode (including its binary format) which is not that trivial. For the locos I tried I can get them to work either way. It may just sometimes require a little bit of guess work. Will try to document this.
Anyway. For the recent changes:

- Configured AFB as an axis (per someone's suggestion between the lines), works perfectly (of course it's optional, you can still use Y/C)
EDIT: well, almost perfectly, it is not notched so while the display tells you you have 50kph in reality you can have between 50-60 so you need to watch speed limits ;-)
- Already started with the documentation.
User avatar
linuxbot
Been on the forums for a while
Posts: 102
Joined: Sat Aug 28, 2010 4:23 am
Location: Auckland, NZ

Re: Custom Overlay/Interface and Joystick helper (with pics)

Post by linuxbot »

You may not need to do any decompile/recompile process, as there is a way to use the update() function embedded in the .out file in your own file, so when TS201* runs update(), you can run your code, loading control values in, then run the loco's update(), then your own code again.

There's more info here
James
User avatar
Havner
Been on the forums for a while
Posts: 293
Joined: Thu Sep 11, 2014 1:32 am

Re: Custom Overlay/Interface and Joystick helper (with pics)

Post by Havner »

Wow. Thank you for that. Didn't know about that. Will definitely give it a go.

Edit: yes. Expected somethink similar immediately after reading your post. This has a drawback of being difficult for users to do. But it's definitely going to be a fallback for now if I ever run into a loco that's impossible to patch. Thanks again!
User avatar
Havner
Been on the forums for a while
Posts: 293
Joined: Thu Sep 11, 2014 1:32 am

Re: Custom Overlay/Interface and Joystick helper (with pics)

Post by Havner »

The more I think about it this sounds as a much better solution. We'd have to compile the final script anyway to make the one in .AP file inactive not to force people to modify their .AP files.

But still this process can be automated. You end up with 1-2 more files (2x .out, not one, and optional .lua for people to look at) but it should be much more reliable and safe.
User avatar
gazz292
Been on the forums for a while
Posts: 231
Joined: Mon Jan 10, 2011 9:46 pm

Re: Custom Overlay/Interface and Joystick helper (with pics)

Post by gazz292 »

Yay, things are back on track?

I'm being selfish as the only train i want to drive with my joystick at the moment is the German BR423 S bahn set, What i don't get is that my rail driver handles the combined throttle and brake lever fine, yet cadde's joystick API which uses the raildriver 'dll in train simulator can't handle it when i try to use it with my joystick... which is an arduino uno flashed to be seen as a 2 axis joystick in windows (hence i'll need to look at alternative way to handle the switch commands as i have no software for my joystick that does that.

But it will be so much better to be able to bypass the raildriver stuff and get control of the virtual throttle, brake, AFB and dynamic brake levers,
and the overlay i will enjoy as i too hate having to have the F4 hud up to see where the next station is as i have not learnt the routes off by heart.... i just want a distance to next stopping station display and not have to have a great big bar across the bottom of the screen.

Also i have plans that will use the rest of the data your app can extract from the sim, i want to have a 12 inch or so monitor mounted on the back of my Sbahn driver joystick and have it display the speedo/traction effort meters and warning lights,
I thought at first i may be able to clone the in cab display and move it to this monitor, but i am not sure i can do that (short of using one of those 'minimap' zooming proggies, but if i move the main screen view, the capture of the panel will move too)
but if i can figure out how to read the data from your app and get it to move the needles and turn the virtual lights on and off that'd be another way to do it....

Which brings a Q, will your app be able to get the data for the warning lamp status from the 'dashboard' of a train, it's German trains i like to drive, so they all have at least a set of lights that light up a bit like the UK's AWS... plus a door closed and locked light, a driver vigilance lamp and so on... basically this:
BR423 main panel.png
User avatar
Havner
Been on the forums for a while
Posts: 293
Joined: Thu Sep 11, 2014 1:32 am

Re: Custom Overlay/Interface and Joystick helper (with pics)

Post by Havner »

gazz292 wrote:Yay, things are back on track?
Yes, very much so. I just finished a tool to automate the process using the above method and it works great.
I'm being selfish as the only train i want to drive with my joystick at the moment is the German BR423 S bahn set, What i don't get is that my rail driver handles the combined throttle and brake lever fine, yet cadde's joystick API which uses the raildriver 'dll in train simulator can't handle it when i try to use it with my joystick... which is an arduino uno flashed to be seen as a 2 axis joystick in windows
I don't have this train. Does it have a combined with some brake and other brakes as separate? In that case you're fine.
But if you want to use 2 physical axes as one logical in game then you'll have add some code. I have not coded such thing but it is definitely possible.
(hence i'll need to look at alternative way to handle the switch commands as i have no software for my joystick that does that.
There definitely should be some windows software for that. To handle generic joysticks.
But it will be so much better to be able to bypass the raildriver stuff and get control of the virtual throttle, brake, AFB and dynamic brake levers,
and the overlay i will enjoy as i too hate having to have the F4 hud up to see where the next station is as i have not learnt the routes off by heart.... i just want a distance to next stopping station display and not have to have a great big bar across the bottom of the screen.
I have not found a way to extract distance to the next stop. I still use F1 for that :-(
Also i have plans that will use the rest of the data your app can extract from the sim, i want to have a 12 inch or so monitor mounted on the back of my Sbahn driver joystick and have it display the speedo/traction effort meters and warning lights,
I thought at first i may be able to clone the in cab display and move it to this monitor, but i am not sure i can do that (short of using one of those 'minimap' zooming proggies, but if i move the main screen view, the capture of the panel will move too)
If you are a programmer you can do whatever you want. You have data extracted from the sim and you have a D3D surface where you can paint whatever you want. Even the whole controls duplicated. Or you can create a new window and draw there. My program won't do that for you but it's a great developer's resource for such things if you want to code them yourself.
but if i can figure out how to read the data from your app and get it to move the needles and turn the virtual lights on and off that'd be another way to do it....
Data is extracted to a txt file. Do whatever you want with it :)
Which brings a Q, will your app be able to get the data for the warning lamp status from the 'dashboard' of a train, it's German trains i like to drive, so they all have at least a set of lights that light up a bit like the UK's AWS... plus a door closed and locked light, a driver vigilance lamp and so on... basically this:
If a data is displayed in a cab and works it definitely is hold in some control value in a loco. So you can extract it. Just have a look at the loco bin file in RW_Tools. Find a control name, add few lines to my script and it will save it in the txt file. Then you are free to do whatever you want.

The main part of documentation is written. Need to at least scratch the surface of coding done in the advanced part still.
User avatar
gazz292
Been on the forums for a while
Posts: 231
Joined: Mon Jan 10, 2011 9:46 pm

Re: Custom Overlay/Interface and Joystick helper (with pics)

Post by gazz292 »

awesome,

the 2 axis i talk about... one of them is used for the reversing switch, as railworks has that as an axis for the steam loco's, and i guess maps it's positions to 3 notches for diesel and electric trains (even tho most actually have 4 positions... one of them being motor only but i guess there's no real need for that in railworks)

The other axis is the combined brake/throttle lever, half of it forwards for go, the other half backwards for stop.

Dang about the distance to next stop, it's got to be in there somewhere, as the F4 hud shows it in 2 places... once on the big long bar with the track with the distances to signals, speed restrictions and stations to stop at, and again to the left of the big bar, where it shows the next stop's name and distance to the actual stopping point (where as the distance on the big bar is to the centre of the station)
But as i know very little about programming i'm not the one to be talking about this kind of thing as if it were simple.

I can't wait to try this out, it will be appreciated by those of us who want to drive the trains with a little realism.
User avatar
Havner
Been on the forums for a while
Posts: 293
Joined: Thu Sep 11, 2014 1:32 am

Re: Custom Overlay/Interface and Joystick helper (with pics)

Post by Havner »

gazz292 wrote:the 2 axis i talk about... one of them is used for the reversing switch, as railworks has that as an axis for the steam loco's, and i guess maps it's positions to 3 notches for diesel and electric trains (even tho most actually have 4 positions... one of them being motor only but i guess there's no real need for that in railworks)
The reverser is not exported as an axis (yet?) as I don't drive steam locos. But it's very easy to do. I can do that for the next version.
Dang about the distance to next stop, it's got to be in there somewhere, as the F4 hud shows it in 2 places... once on the big long bar with the track with the distances to signals, speed restrictions and stations to stop at, and again to the left of the big bar, where it shows the next stop's name and distance to the actual stopping point (where as the distance on the big bar is to the centre of the station)
But as i know very little about programming i'm not the one to be talking about this kind of thing as if it were simple.
The UI shows things it can get internally. I can only get/set what is exported for the LUA API. This doesn't seem to be. I have a document with the API itself, can't find a link now though.
You can get a distance to a next signal and speed limit. Not the next task though.
I can't wait to try this out, it will be appreciated by those of us who want to drive the trains with a little realism.
Finishing the docs, should release today although I'll probably be mad at myself for rushing this afterwards (stupid bugs or something).
I'll make a new post with the release.
Locked

Return to “[TS] General Discussion”