• Bookmark hashtag #RDLMS on Twitter, Facebook and Instagram
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Programming own functions for steering wheel input

Discussion in 'Racer Physics and Technical' started by wacruise, Nov 29, 2012.

  1. Hello everyone,

    I am working on a driving wheel/concept and need to program buttons on the steering wheel (g27).

    However, these buttons will have different functions based on the situation in the simulator. For example, button 1 does X when moving at a certain speed or it will do Y when stopped and next to a turn.

    I need to have the function take data from the game as well as the steering wheel and adjust what the wheel does, cruise control for example.

    I figure I would need an API to do this, unfortunately, I do not have much experiences working with simulators like this and I am not sure where to begin. My programming experience is limited to control responses and other functions.

    It seems that this is a closed source simulator. Will i be able to achieve my concept/idea in this sim?

    I appreciate any help that can be offered.
  2. Hey Warcruise,

    Sure, you can do custom G25/G27 buttons mapping, for example on my G25 button 2, I have mapped the lights on/off which is settable in controls.ini or via Racer ingame.

    Anyway, via RSX/RCX or better Onyx scripting, almost anything is possible. Let's just wait until Ruud finishes to stabilize all the new features which will literally transform the way we see Racer today.

    Custom events to trigger certain functions ingame is already possible, via REX files. Rex files is now an old story & you must use Onyx scripting do the same.

    My new website : Racer-Max
  3. To clarify, you can only set script inputs via keyboard directly at the moment, wheels and other controllers are not "visible" for scripts. Ruud is aware that we would benefit from controllers and scripts being able to communicate, so it might just be a matter of when he implements it.
  4. Though I personally think controller buttons should be linked to keyboard presses, then scripts run off keyboard buttons. As the default case any way.

    Obviously we need some standardisation. Anyone who wants to customise stuff can do so then if they want to go tinkering in files.

    But to start with having a key map we all generally agree on for different functions would be nice.

    Ie, plenty of flight sims have literally hundreds of buttons for all sorts of things but they use a common key map for almost all of them. It'd be mad to try approach it without standardised buttons for most standardised functions.

    Ie, cruise control on/off, left door open/close, indicators, trunk, horn, traction control, whatever... :)

    That way if you learn one lot, you are generally gonna be able to run any car and enjoy features without learning lots of tweaks :D

    As said, in flight sim world this applies from flying a refueller to dropping bombs, or firing anti-radiation missiles. So the maps in those games cover EVERYTHING usually :D

  5. What Rigs of Rods does (which is pretty reasonable) is have the set of defaults, plus 'action' hotkeys that are commonly bound to various options (raise/lower crane, etc.), and part of the vehicle's HUD is a little set of notes on what each action hotkey is used for. If we're gonna have cruise control, wipers etc. then a little bit of UI that shows which ones are on (and how to toggle them) would be nice.

    I believe RSX scripts can paint textures on, the way views.ini does - onyx definitely can, but is currently not quite practical to use. So if you have a cruise control indicator light, it can just paint that lit up when the script's on.

    Definitely makes sense to agree on default hotkeys for the more common functions, and set aside some for less common ones, though. (shooters usually have a 'interact' button which turns locks and stuff, would be nice to set a key aside for that kind of thing on tracks - eg. drive up to the slalom course, and pop up 'hit U to reset cones' or whatever, drive up to a garage and pop up 'hit U to open door'.)

    As for scripting actions for wheel buttons, which depend on other conditions - yeah, that's definitely possible for the scripts to handle, it'll just be some work to set up the logic. And you'd need to map the buttons to send keypresses.
  6. Thank you all for your responses,

    It definitely helps get an idea on where to start.

    A lot of the coding terms and languages you mention are very foreign to myself and those I am working with, however, I have been trying to read through the Onyx handbook. Most of my coding experience is in matlab or basic C coding. The logic/control scheme for how a car would handle different situations is more in relation to my groups experience (block diagrams and basic control theory etc...).

    We were hoping to get a VERY basic model working within a month, does anybody have any advice on where to start or what to do to get us prepared for this?
  7. Can you give examples of exactly what you want to code? Might help us say how you would start?

    For example, we only just got wheel rotvel in Onyx for wheel rotation speed. Until now we had to basically do without it.

    Until we have access to everything you are limited to what Onyx has to offer, and right now that is quite limited by all accounts.

    The list keeps growing but part of me wishes Ruud would just put access too ALL variables both in and out via Onyx.

    If I wake up one day and want to have a random chance of tyre failure and set wheel tyre_rate to 0, I should be able to... but right now I can't.

    Snapped spring? No way to do that either. I can change spring rate I think, but not length.

    If Ruud suddenly adds the full I/O of Racer variables then we'd be able to let our imaginations be the limit, but right now the limit is what is accessible and right now that will determine what you can or can't do.

    Also no interface with sound system, so you can't make the car sound louder with an opened door. Can't make a spoiler make a whooshing noise when extended. No way to add brake squeal when the brakes get hot, etc.

    No doubt Onyx will be very good when it's got everything implemented, but it hasn't right now.

  8. Thanks for the response.

    Among things we are trying to do:

    we are looking for a way to take variables such as the cars position on the track, the speed it is going, and said variables of other cars as well. We want to use these variables in loops to drive the players car. For example: knowing your position and the AI cars position you can set it to automatically overtake the car ahead by going to the right (or left), increasing the speed, and then after passing it going back in front of the car.

    Is this still not possible?

    Thanks for the help!