Jump to content

[0.24.x] AltInput v0.9.1 - Joystick/GamePad Input


Akeo

Recommended Posts

It is my pleasure to announce the release of AltInput v0.9.1, an Alternate Input plugin for KSP, which currently aims at providing support for Joysticks and GamePads in the game, to allow more precise and enjoyable control and work around the dreadful controller support that Unity provides by default.

Currently it only does so for DirectInput controllers and as such will only work on Windows, but it could be extended to support any other kind of input.

Features:

  • Supports any DirectInput controller
  • POV support (if your controller has one)
  • Throttle/Slider support (if your controller has one)
  • Supports all of the main control actions, plus view switching and time warp
  • Three modes (Flight, AltFlight, Ground) allowing you to switch control mappings depending on the phase of the flight
  • Easy modification of your controller's properties (mapping, dead zone, sensitivity) through a plain text INI file
  • Allows the use of a button as an axis (e.g. for the throttle delta), an axis as a button or set of buttons, or even an axis as a delta

License:

Source:

ChangeLog 0.9 → 0.9.1 [2014.09.25]:

  • Add killThrottle, fullThrottle and toggleNavBall actions
  • Add Continuous mode for buttons (e.g. for throttle control - Use something like Button1.Continuous = true along with Button1.Mapping = mainThrottle [+0.01] if you want to use the feature)
  • Rename OneShot attribute for axes to Continuous (*)
  • Drop the Name attribute and use the controller name as section header (*)
  • Allow reload of config.ini during the game (To use this feature, apply your modifications during flight mode, then go to the menu and back to flight mode)
  • Add a more explicit message when the config file is not found
  • Provide a list of all detected devices, to help identify the section name to use
  • Use a relative path to locate the config file (Courtesy of enodatio)#

(*) These features effectively break existing config.ini syntax, hence the syntax version bump from 1.3 to 1.4. Please have a look at the latest config.ini if you want to understand what has changed.

Usage:

  • Download all the files from either the latest Release or Debug version (the difference between Debug and Release is that the Debug version will provides a bit more information on the debug console).
  • Copy AltInput.dll, SharpDX.dll and SharpDX.DirectInput.dll into the KSP Plugins\ directory. Typically this would be: 'C:\Program Files (x86)\Steam\SteamApps\common\Kerbal Space Program\Plugins'.
  • Copy the whole PluginData directory to the same directory where you copied the DLL files and if needed, edit PluginData\AltInput\config.ini according to your settings.. Please make sure you have a look at the plugin README as well as the comments from existing controllers from the latest config file, as they should provide insightful information.
  • Play. :kiss:
    If your joystick is properly configured, you will get a notification (in the upper left corner) and you should be able to use it to control the ship.
    Or, if you need to create a new entry, AltInput will provide you with the section name you should create, and you can have a look at existing sections to get started with adding your controller. Remember that you can reload your config if you modify it while in Flight mode, then go to the main menu and back again to flight mode.

Notes:

  • This module provides its ownversion of the SharpDX DLLs, due to a BUG in the Unity engine. If you try to deploy with the standard version of SharpDX, it WILL NOT WORK!
  • If you have an XBox 360 controller at hand, you should be able to test the module right away, using the following mappings:
    X360_KSP.png
  • If you add a new controller, I would kindly ask you to create a new pull request in the github project, so that I can add support for this new controller in the default config, and so that it can benefit other players.

Edited by Akeo
v0.9.1 release
Link to comment
Share on other sites

Hosting the files on my own server allows me to have some nice download stats, and also create symbolic links for the SharpDX DLLs and config file, which are the same for Debug and Release. If I were to use github, I'd have to make sure to keep all the files in sync, which past experience tells I'm bound to forget to do at one stage or another if they ever need to be updated...

Link to comment
Share on other sites

I'd like clarification on just one thing - can this differentiate between the axis of two separate controllers? The only reason I'm stuck using my X52 instead of my X55 is that the X52 connects as a single controller, and thus all axis are unique. However the X55 connects as separate throttle/stick so KSP (Unity really) thinks axis 0 on my throttle is the same as axis 0 on my stick

Link to comment
Share on other sites

I see nothing...

Do you have an XBox 360 or Microsoft SideWinder controller?

If not, then you will not see anything until you add a section for your controller in your config.ini...

This is because different controllers have different capabilities (some have a throttle, some haven't, same goes for POV or the number of buttons), so it's impossible to create a generate config that will apply for each controller.

This is the reason why I am asking for people to send me their config if they aren't using one of the 2 controllers that are currently supported.

If you do have an X360 to SideWinder controller, then you will have to provide a bit more information about what you did, and what the debug output from KSP looks like (when using the debug version of AltInput).

Link to comment
Share on other sites

Can this differentiate between the axis of two separate controllers?

AltInput can use 2 separate controllers simultaneously.

Please try to use the debug version with a config file that has a single [input1] section, without a 'Name = XYZ' line. AltInput should then report the names of all the controllers it detected. You should then see the names that are being reported for all the DirectInput controllers that Windows sees (which I expect to be separated as 2 controllers in your case), and you should be able to create a [input#] for each controller.

But it should really be the same as what you'll see for your game controllers when you check their properties in Windows: if the system reports 2 logical controllers under Device and Printers, then AltInput should report 2 controllers as well.

Link to comment
Share on other sites

How does this differ from the default Joystick menu on KSP?

Here's what I found when I tried to use my Microsoft SideWinder Precision Pro (which, as it comes with POV, throttle and Z-Rotation on the handle, is pretty much the ideal joystick to use with a flight simulator like KSP):

  • Couldn't use the POV :(
  • No matter how I tried to calibrate it, throttle handling was a catastrophe (could't achieve zero or max, and any increment was super-jerky) :huh:
  • No matter how I tried to set the dead zone, axes wouldn't rest at zero position :rolleyes:

Digging further made me discover that I wasn't alone experiencing this (see the very first link from my top post - it points to a thread on this very forum, that's dedicated to this issue). Unfortunately, this means that joystick input in KSP is pretty much useless, for the kind of game controllers you'd want to use with the game...

If you look further, you'll find that this behaviour boils down to a disputable choice made by the Unity developers (using raw input), which they have publicly indicated they have no intention of fixing.

Edited by Akeo
I accidentally a word
Link to comment
Share on other sites

Is there a way to configure a button to cut throtle to 0%?

Not yet, but I can add it. I've been reluctant to do so because this is a problem for people using Joystick with a throttle, as there will then be a discrepancy between the position of the physical throttle/slider, and the game one.

I guess I'll add a cut throttle to the next release, and if someone complains about the above, I'll point them to your post! :)

And I'm trying to use 2 buttons to incrementally change throtle... But I have to push it many times to change throttle... pressing it doesn't works...

Yeah, that's not supported yet. I'm planning to add such a feature for 1.0 (this is still BETA), but I need to figure out the best way to do it...

Link to comment
Share on other sites

@Akeo: The only thing I did to get it to work was name it T.Flight Stick X, and change the rotationZ axis back to default 0.1 deadzone. The POV button settings did not seem to work, but I was okay using those with the default KSP behavior. It may be because I don't rely on the timing of the other functions as much, but I am just using this for axises, and "toggleBrakes," because that doesn't appear to be mappable at the moment in default KSP, just "holding for brake."

For those wondering, I picked this up after KSP kept forgetting my x,y, and z axises on a joystick (Thrustmaster T flight X, cheap but has axis switching on-the-fly), that I thought was working just fine -- though I could still fly better with the keyboard, I chalked it up to two years of KSP pre-joystick. Well, I don't know if it was something more subtle, or just bad input lag I was too dumb to notice, but going from raw input to direct input (I think that this is what this mod is doing) changed things dramatically. It feels like a flight-sim now with FAR. I have far more ability to hug the terrain and make fine adjustments.

Long story short - my joystick input was apparently terrible before and this made it great, like night and day. Thanks Akeo!

Link to comment
Share on other sites

I'm having a hard time getting this to detect my wired 360 controller, it's just install then play, right? I've put the dll files into KSP/Plugins along with the PluginData folder that has the config.ini file.

I get this message when i launch a craft

It can't find the config.ini, mine didn't work till I moved it to Kerbal Space Program\Plugins\PluginData\AltInput

The docs are a little unclear on where things need to go.

I'm having an issue where it fails to find the joystick if there are certain plugins (maybe number of plugins?) present. When I remove B9 it usually works, B9 is pretty huge so that might be why.

I have mechjeb, ferram, procedural fairings, Texture Replacer and Raster Prop Monitor. Adding B9 to this means it doesn't find the stick.

For tweaking config it would be awesome if it re-read the file on entering flight mode, then you could just use "revert to launch" to test. Currently seems to reaquire the stick but changes to the config don't seem to reflect without going through the full slow re-loading process. Perhaps a key combination to scan and re-aquire the stick might solve both issues??

I'm using a Thrustmaster T.16000m, I've just edited your sidewinder entry but haven't got as far as testing anything beyond basic flight axes yet. Debuging different plugin configurations takes ages because of KSP's go make a cup of tea load times


[global]
; The version of the AltInput syntax used by this config file
Version = 1.3

[input1]
Name = T.16000M
Interface = DirectInput
Class = GameControl
DeadZone = 0.1
; Mappings for each game mode. For now, these can be 'Flight', 'AltFlight'
; or 'Ground'. If no mode section is specified, 'Flight' is assumed.
[input1.Flight]
; List of axes for this controller
AxisX = yaw
AxisY = pitch
RotationZ = roll
Slider1 = mainThrottle
Slider1.Inverted = true
; List of POVs for this controler
; When an axis is being used, as opposed to a button action, a number
; needs to be specified in brackets, indicating the value (-1.0 to 1.0)
; that the axis should take when this POV position is reached.
; You can also append '.Delta' to the action (on the right part) if you want
; to specify the delta by which the value should be increased from its
; current value, instead of an absolute value. See further for an example.
POV1.Up = Y [+1.0]
POV1.Down = Y [-1.0]
POV1.Left = X [-1.0]
POV1.Right = X [+1.0]
; List of Buttons
Button1 = switchMode
Button2 = toggleLights
Button3 = switchView
Button4 = toggleMapView
Button5 = Z [+1.0]
Button6 = Z [-1.0]
Button7 = toggleSAS
Button8 = toggleRCS
Button9 = activateStaging

; Alternate flight mode
[input1.AltFlight]
Button2 = toggleGears
Button5 = increaseWarp
Button6 = decreaseWarp
Button8 = toggleBrakes

; Controls for post landing/splashing
[input1.Ground]
AxisX = wheelSteer
AxisX.Inverted = true
Slider1 = wheelThrottle
Button2 = activateBrakes
Button5 = wheelThrottle.Delta [-0.1]
Button6 = wheelThrottle.Delta [+0.1]
Button8 = toggleBrakes

Link to comment
Share on other sites

I get this message when i launch a craft:

[FONT=arial]AltInput: Config file ignored due to Version Mismatch (Got 0.0, required v1.3)[/FONT]

I'd say that either you are missing a:


[global]
; The version of the AltInput syntax used by this config file
Version = 1.3

section in your config, or your config is not where it should be (IN \Plugins\PluginData\AltInput\, NOT in \PluginData\AltInput - In other words, everything needs to go under Plugins).

Link to comment
Share on other sites

I'm having an issue where it fails to find the joystick if there are certain plugins (maybe number of plugins?) present. When I remove B9 it usually works, B9 is pretty huge so that might be why.

I'll see if I can get a chance to look at the B9 issue, but don't hold your breath (Too little time, too many other FLOSS projects).

For tweaking config it would be awesome if it re-read the file on entering flight mode

Yeah, I though about trying to do that, but it seems like a lot of extra work, which I don't see myself having a chance to do in the near future for the same reason as above. I'll happily take patches though.

Link to comment
Share on other sites

I'll see if I can get a chance to look at the B9 issue, but don't hold your breath (Too little time, too many other FLOSS projects).

Yeah, I though about trying to do that, but it seems like a lot of extra work, which I don't see myself having a chance to do in the near future for the same reason as above. I'll happily take patches though.

Shiny, I'll take a look if I can get my customers off my back for long enough.

Link to comment
Share on other sites

Thanks for your hard work and offering this to the community. I'm confused however as to what advantage this provides over the stock input mapping, axis-binding functions? I've been using a 3GC Steelseries dual joystick controller (with POV) for over a year, and recently switched to an Xbox controller for Windows. Both of these seemed to work OK for all of the necessary game functions. What situations is this mod designed for?

Link to comment
Share on other sites

Can we please have this as an archive?

Also, we absolutely totally need the kill throttle button, and full throttle for 0.25.

In fact, I can see no reason why any command KSP has should not be bindable.

My X55 has 50 buttons total, and I intend to use every last one I can.

Thanks for your hard work and offering this to the community. I'm confused however as to what advantage this provides over the stock input mapping, axis-binding functions? I've been using a 3GC Steelseries dual joystick controller (with POV) for over a year, and recently switched to an Xbox controller for Windows. Both of these seemed to work OK for all of the necessary game functions. What situations is this mod designed for?

Stuff where XInput doesnt work properly.

For example:

  • More than 20 buttons on a joystick
  • Multiple joysticks, or a device that appears as multiple sticks
  • Devices Unity fails at (Saitek software)

My X55 ticks all 3 boxes, so I'm gonna try this out.

Edited by Taverius
Link to comment
Share on other sites

Hmm, my x55 saitek has a known bug with unity were all inputs are massively delayed, wonder if this plugin gets around that problem.

What about the name of the device? Readme doesn't seem to cover that, dxdiag and game controllers calls em "Saitek Pro Flight X-55 Rhino Stick" and "Saitek Pro Flight X-55 Rhino Throttle" but the syntax I see above seems space-less, any idea where to find the right name to use?

Nvm found that in the config, commented out the name, interface, class lines and now I get "no controller detected" in the top left, can't see anything relevant in the log, any ideas?

Edited by K3|Chris
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...