Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Test Builds => Topic started by: Achillion on May 03, 2014, 01:28:12 pm

Title: Joystick response curves
Post by: Achillion on May 03, 2014, 01:28:12 pm
Greetings and salutations.

A few months ago, I bought a new joystick and discovered that I don't feel very comfortable with the joystick response curve in FSO. After digging through old threads, I discovered there have been a few requests in the past for curve editing, or at least, alternative response curves. So I thought I'd make a few myself.

First of all, there are two existing response curves in FSO: The original (retail) curve and an alternative curve that was added by Wanderer in 2009 (https://github.com/scp-fs2open/fs2open.github.com/commit/dbd42fca7cafaa1db3dca96057af21e0b6b1551b). As far as I can tell, the new curve by Wanderer was only implemented in the Windows version, while the Linux version of the game used the original, retail curve.

I have now added, with the help of z64555 and HerraTohtori, 5 new joystick response curves, which give us a total of 7. This is a bit overkill. At least one of the curves is redundant, being simply a subset of the existing curves. What we've attempted to do is provide response curves that have different shapes from the existing ones. Both the existing curves were based on power functions, so we added an exponential, a sigmoidal and a "mixed" curve, which can act either as a positive power curve (Xn, n > 1), or a fractional one (Xn, 0 > n > 1).

The new (and old) curves are all neatly demonstrated in this wonderful markdown document on github (https://github.com/achilleas-k/fs2open.github.com/blob/joystick_curves/joy_curve_notes/new_curves.md). If no curve is specified, the game defaults to the retail curve. A joystick curve can be selected using a command line argument
Code: [Select]
-joystick_curves n where n is the number of the curve you want to use (see the glorious github document mentioned above (https://github.com/achilleas-k/fs2open.github.com/blob/joystick_curves/joy_curve_notes/new_curves.md)).

The code is based on the Antipodes branch and can be found on my fork on github: joystick_curves branch (https://github.com/achilleas-k/fs2open.github.com/tree/joystick_curves).

Grab your builds here:
Windows (https://copy.com/bsPuMvthIXfP) / Debug (https://copy.com/aOlhWlyyQtiT)
Linux (https://copy.com/hfXpZN8VQxCL) / Debug (https://copy.com/fEyq9ucEd2fB)


Would be nice to get some feedback on which curves feel better. I suspect that different joysticks or gamepads will have different preferences. I'm also accepting suggestions for other curves, if anyone has any ideas.
Title: Re: Joystick response curves
Post by: CountBuggula on June 02, 2014, 03:01:25 pm
Wow, thanks for putting this together!  I've actually been wondering about how the curves work in FSO recently.  I hope to put this to good use.
Title: Re: Joystick response curves
Post by: GunHed on July 29, 2014, 07:40:33 pm
I keep getting "The program can't start start because SDL2.dll is missing from your computer. Try reinstalling the program to fix this problem." Am I doing something wrong?
Title: Re: Joystick response curves
Post by: Nuke on July 29, 2014, 09:40:59 pm
ive always been a fan of linear curves (and the graphs certainly help me find that). but the power curve 6 (or any of the j curves, 0,1,4) would give you more precision towards the middle which might improve aim. these curves seem like they would work best on joysticks that are fairly linear, such as sticks with the gimbals shafted directly to potentiometers. s-curves (2,3) are somewhat useful if you have a non-linear stick such as saitek or any form of gamepad. it would allow you to flatten out an other wise crooked curve. some gamepads are very weak near the center of their range and i guess thats where #5 comes into play. or anywhere where you need to overdrive towards center, of course higher sensitivity settings form a j curve. all in all, very good work. would be awesome to be able to select a curve in game though, because its going too take a lot of tweaking to find one that works for you.

I keep getting "The program can't start start because SDL2.dll is missing from your computer. Try reinstalling the program to fix this problem." Am I doing something wrong?

i take it this was based off antipodes. you need to install sdl, or at least find the dll and stick it in your fs2 directory. sdl2.dll comes with the antipodes builds so it might just be easier to download those and extract the dll.
Title: Re: Joystick response curves
Post by: niffiwan on July 29, 2014, 09:46:24 pm
Yep, see this post (http://www.hard-light.net/forums/index.php?topic=86206.0) for the builds Nuke mentioned.
Title: Re: Joystick response curves
Post by: GunHed on July 30, 2014, 06:57:36 pm
OK I install sdl, how do I adjust the curve?
Title: Re: Joystick response curves
Post by: niffiwan on July 30, 2014, 06:59:29 pm
I believe you use this command line argument:

Code: [Select]
-joystick_curves n

Where n is a number that corresponds to the curves described here: https://github.com/achilleas-k/fs2open.github.com/blob/joystick_curves/joy_curve_notes/new_curves.md
Title: Re: Joystick response curves
Post by: Achillion on July 30, 2014, 07:10:19 pm
OK I install sdl, how do I adjust the curve?

In the wxLauncher, add -joystick_curves followed by a number in the "Custom Flags" box of the "Advanced Settings" tab. See the document linked in the first post for a description of what curve each number corresponds to and it is affected by the sensitivity setting.

EDIT: Redundant post on a 10 minute delay. My internet is being weird!
Title: Re: Joystick response curves
Post by: GunHed on July 31, 2014, 06:21:24 pm
How do I to wxLauncher, it doesn't appear when I start the game.
 
Edit: nm I got to work and 3 works best for me i use the T flight hotas x, appreciate everybody who helped me.
Title: Re: Joystick response curves
Post by: Achillion on August 02, 2014, 05:20:32 am
Glad to see you got it working. Happy to see the alt. curves are getting some use! :)
Title: Re: Joystick response curves
Post by: CountBuggula on September 23, 2014, 03:11:41 pm
Would this need gui support before it could be merged in trunk?  If not, is there any instability issue that would preclude merging?
Title: Re: Joystick response curves
Post by: Achillion on September 23, 2014, 03:23:59 pm
I've been using it quite a bit and there are no instabilities (that I've seen). I can't really claim that I've tested all curves exhaustively. I can't say whether a GUI would be needed before adding it - I'll let the devs answer that.

The only reason for not merging is that it's hard to make clear what the flag does (which curve is which) without reading some documentation. Perhaps I could add a wiki entry for it (the descriptions are already written, anyway).

In a perfect world, it would be great to have a curve editor, where people can adjust their own curves however they want. That's where this idea started, but ended up getting simplified to a few common curves that can be switched. I don't expect something like that (a curve editor) to happen soon (at least, I don't think I'll be making it), so a few alternatives to switch between is the next best thing, in my opinion. The only thing I'm worried about is whether there are specific curves that are more appropriate for specific types of controllers (gamepads, different joystick types/brands, etc). It would be cool to be able to recommend to people what curve would give the best response given the controller they are using, but that would require testing each option for a while with each different controller type.
Title: Re: Joystick response curves
Post by: jr2 on September 23, 2014, 10:19:14 pm
Perhaps have one of the curve options be to read a customizable curve from a file?  e.g., define your own custom curve if you know what you are doing.  Dunno if that would be hard to code or not but at least it would make it possible to swap good curves with other users of same / similar controllers.  I dunno, just an idea.
Title: Re: Joystick response curves
Post by: CountBuggula on September 24, 2014, 10:35:38 am
I've been using it quite a bit and there are no instabilities (that I've seen). I can't really claim that I've tested all curves exhaustively. I can't say whether a GUI would be needed before adding it - I'll let the devs answer that.

The only reason for not merging is that it's hard to make clear what the flag does (which curve is which) without reading some documentation. Perhaps I could add a wiki entry for it (the descriptions are already written, anyway).

In a perfect world, it would be great to have a curve editor, where people can adjust their own curves however they want. That's where this idea started, but ended up getting simplified to a few common curves that can be switched. I don't expect something like that (a curve editor) to happen soon (at least, I don't think I'll be making it), so a few alternatives to switch between is the next best thing, in my opinion. The only thing I'm worried about is whether there are specific curves that are more appropriate for specific types of controllers (gamepads, different joystick types/brands, etc). It would be cool to be able to recommend to people what curve would give the best response given the controller they are using, but that would require testing each option for a while with each different controller type.


How about a dropdown in the settings gui with icons showing the curve, so even if you don't know exactly what each one might be ideal for different controllers, you at least get a visual representation and make make a semi-informed decision from that?  I'm pretty sure I've seen similar functionality in other games/sims using joysticks.
Title: Re: Joystick response curves
Post by: Achillion on September 24, 2014, 11:01:04 am
How about a dropdown in the settings gui with icons showing the curve, so even if you don't know exactly what each one might be ideal for different controllers, you at least get a visual representation and make make a semi-informed decision from that?  I'm pretty sure I've seen similar functionality in other games/sims using joysticks.

That would be pretty cool, actually. Solves the issue of having to look up what each option represents and also makes the availability of different curves obvious to a player who hadn't considered it.

I've been thinking a bit about what jr2 said about custom curves. I'm too busy these days to implement user-defined response curves. The current curves are purely functional (response = f(input), where f is the curve function), but I've seen games which let you define the response sensitivity based on input bands/ranges. IL-2 comes to mind, which basically lets you draw your own curve using a series of sliders (see here (http://img.photobucket.com/albums/v289/HH_Beebop/Mission%204%20Today/InputCurve.jpg)).

First thing that comes to mind for implementing this is just shoving a sequence of numbers at the command line, or through a file and then populating a lookup table so that response = lotable[input_int]*input, where lotable would just be an array that holds the user-defined response values and input_int is some integer representation of the input percent (e.g., input_int = (int)(length(lotable)*input) --- I'm sure there's a better way to do this).


EDIT: Might give it a shot next month, when things are quieter work-wise.
Title: Re: Joystick response curves
Post by: Nuke on September 24, 2014, 07:39:05 pm
lua defined curves perhaps. but i dont think games should make players do math. it would be more robust to pick a curve function from a gui and tweak its parameters. might also roll in deadzone and sensitivity adjustment as well. how are things on the in game interface overhaul front?
Title: Re: Joystick response curves
Post by: Achillion on September 24, 2014, 07:42:58 pm
lua defined curves perhaps. but i think it would be more robust to pick a curve function from a gui and tweak its parameters. games shouldn't make players do math.

There's no math involved for the user the way I described a user-defined curve. It's just sliders (see IL-2 screenshot). Any reference to math in my last post is just my thoughts on implementation details.

The current curves will remain as is; no need to remove them. I was just considering maybe adding a extra option that lets a user define a curve using sliders. If the devs are considering merging this into trunk, I'd suggest merging as is and we can see about user-defined options in the near future.
Title: Re: Joystick response curves
Post by: Nuke on September 24, 2014, 11:14:15 pm
its also possible to swap math based curves with graph based curves. players edit the points on the graph to create their desired response curve. the game finds the nearest two graph points to the input and interpolates between them to find the output. each two points define a bezier curve and you can create both s and j cuves and linear gradients with them. you can also define dead zones with such a system. definitely considering something like that for my game engine.
Title: Re: Joystick response curves
Post by: z64555 on September 29, 2014, 03:29:07 pm
Problem: Where is the interface for editing said curves?
Title: Re: Joystick response curves
Post by: Nuke on October 01, 2014, 05:36:27 am
freespace still doesn't have a customizable interface? headdesk. maybe i shouldn't have stopped working on nukeui (an attempt at writing a gui class that runs in lua and makes use of freespace's lua graphics library).
Title: Re: Joystick response curves
Post by: m!m on October 01, 2014, 06:49:20 am
freespace still doesn't have a customizable interface? headdesk. maybe i shouldn't have stopped working on nukeui (an attempt at writing a gui class that runs in lua and makes use of freespace's lua graphics library).
There is experimental support (http://www.hard-light.net/forums/index.php?topic=87130.0) for embedding the chromium rendering engine which means that creating an UI with HTML will be possible once that gets integrated into the source code.
Title: Re: Joystick response curves
Post by: Achillion on October 09, 2014, 03:11:19 am
Problem: Where is the interface for editing said curves?

What? I was waiting for you to make it. What have you been doing, zee?!
Title: Re: Joystick response curves
Post by: z64555 on October 09, 2014, 09:21:47 pm
Problem: Where is the interface for editing said curves?

What? I was waiting for you to make it. What have you been doing, zee?!
:warp:
Title: Re: Joystick response curves
Post by: Achillion on October 10, 2014, 06:20:38 am
Anyway, I'm going to be taking a few days off from my "real work" this week, so I might take a stab at improving the joysticks and the curves and the joystick curves.
Title: Re: Joystick response curves
Post by: Erroll on November 04, 2014, 08:08:14 pm
Thanks! This seemed to help me. I still find the joystick to be frustrating but less so with this build. I tried 3 and that seemed good.. I will experiment with others.

Its a pity really. To me using a joystick "makes" the game with the space sims but it just doesn't work very well with this one.

Using a T-Flight HOTAS X.
Title: Re: Joystick response curves
Post by: Achillion on November 05, 2014, 05:05:37 am
Editable curves aren't a thing yet. I didn't get any time to work on it after all. Nice to see it's getting use, though.
Title: Re: Joystick response curves
Post by: CountBuggula on November 12, 2014, 11:07:22 am
Slightly related note - what is the status of support for multiple joysticks?  What is the specific blocker for that?  I have a nice HOTAS setup but it's separate from my joystick, so in order to use them I have to use a 3rd party program to merge them into a single stick.  Which besides being an overall inconvenience and pain in the butt, also means I can only have one HAT switch.  And if I ever get rudder pedals, that's a 3rd device I'll have to merge in.  It'd be really nice to be able to just identify and accept input from all attached devices.
Title: Re: Joystick response curves
Post by: z64555 on November 12, 2014, 01:00:26 pm
Slightly related note - what is the status of support for multiple joysticks?  What is the specific blocker for that?  I have a nice HOTAS setup but it's separate from my joystick, so in order to use them I have to use a 3rd party program to merge them into a single stick.  Which besides being an overall inconvenience and pain in the butt, also means I can only have one HAT switch.  And if I ever get rudder pedals, that's a 3rd device I'll have to merge in.  It'd be really nice to be able to just identify and accept input from all attached devices.

Backlogged until after the SDL code goes in. There's an issue with the mapping system that FSO currently has that doesn't particularly play well with the multiple controller scheme, so it may be some time before you get to see support for them.
Title: Re: Joystick response curves
Post by: CountBuggula on November 13, 2014, 10:23:55 am
Slightly related note - what is the status of support for multiple joysticks?  What is the specific blocker for that?  I have a nice HOTAS setup but it's separate from my joystick, so in order to use them I have to use a 3rd party program to merge them into a single stick.  Which besides being an overall inconvenience and pain in the butt, also means I can only have one HAT switch.  And if I ever get rudder pedals, that's a 3rd device I'll have to merge in.  It'd be really nice to be able to just identify and accept input from all attached devices.

Backlogged until after the SDL code goes in. There's an issue with the mapping system that FSO currently has that doesn't particularly play well with the multiple controller scheme, so it may be some time before you get to see support for them.

Thanks.  Not exactly the answer I was hoping for, but at least I know what to expect.
Title: Re: Joystick response curves
Post by: harj0 on May 04, 2015, 01:52:35 pm
Sorry for "necroing" this thread, not sure if there is somewhere better to post, if so please let me know.

When I try to launch this build (or the debug version) I get an error as soon as I select it from wxLauncher. Have only tried it with windows (Win7 64), probably about to try it from Arch, so I'm not sure if this is a SDL error or not. Anyhow, heres the error that pops up in a window when I try to select this build from wxLauncher:

    The application was unable to start correctly (0xc000007b).
     Click OK to close the application.

Thanks alot, you guys are awesome and have inspired me to start getting back into game dev.
Title: Re: Joystick response curves
Post by: jr2 on May 04, 2015, 02:04:54 pm
Perhaps you are trying to use this build with MVPs 2014?  You need 3.7.2 for MVPs 2014, or you can use MVPs 3.6.12 with an older build.

(Not sure if that's your problem or not.)


Also,

Please post your fs2_open.log file.  Instructions on how to do this can be found in this post.
Title: Re: Joystick response curves
Post by: Achillion on May 04, 2015, 02:18:52 pm
Try what jr2 said and let us know. I'll see if I can recompile some new builds with the latest master of fso when I get the time.
Title: Re: Joystick response curves
Post by: harj0 on May 04, 2015, 03:12:33 pm
Yeah, it doesnt seem to make any difference what mod I try to activate, even if its no mod at all. Also, nothing new is generated in the log since the error occurs before the EXE is even launched..... which gives me an idea... the error must be from wxLauncher (?) I'll try another wxLauncher build and report back, thanks alot for your quick replys, by the way.
Title: Re: Joystick response curves
Post by: jr2 on May 04, 2015, 04:03:08 pm
Log should still be generated even if it's an immediate CTD.  Should be in <FS2dir>\data ( or, if it's installed to a Program Files directory, %localappdata%\virtualstore\Program Files (x86) (or Program Files)\<FS2dir>\data )

EDIT: Wait, you mean you don't even see the wxLauncher settings before trying to launch FSO?  If so, yeah, you need to get a debug log for wxLauncher, not sure where that, but download a debug version here (http://www.hard-light.net/forums/index.php?topic=67950.0).  Alternatively, maybe the latest wxLauncher when (re)-installed will fix the crash?  Dunno.
Title: Re: Joystick response curves
Post by: AdmiralRalwood on February 02, 2017, 02:46:10 pm
:bump: Could we get this in the form of a pull request? Even though we're currently not looking to add new features, it would be nice to have this on the main repo.
Title: Re: Joystick response curves
Post by: OverDhill on February 02, 2017, 06:07:27 pm
Well there is a solution to the joystick curve issue as well as being able to combine controllers with a new app being worked on by WhiteMagic on the Star Citizen forum. It really is shaping up to be a nice utility.

https://forums.robertsspaceindustries.com/discussion/237458/joystick-gremlin-joystick-configuration-tool/p1

Title: Re: Joystick response curves
Post by: AdmiralRalwood on February 02, 2017, 06:13:18 pm
Using an external app is not a "solution" to "the joystick curve issue"; at best, it's a workaround.
Title: Re: Joystick response curves
Post by: jr2 on February 03, 2017, 07:57:57 pm
Using an external app is not a "solution" to "the joystick curve issue"; at best, it's a workaround.

He's talking from an end-user perspective.
Title: Re: Joystick response curves
Post by: Achillion on February 06, 2017, 04:31:13 am
:bump: Could we get this in the form of a pull request? Even though we're currently not looking to add new features, it would be nice to have this on the main repo.

I neglected to do a PR then (oh god, it's been almost 3 years) which means the branch needs a rebase. I kinda forgot about it to be honest and now I feel bad. I'll find some time this week or some weekend to fix it up and do a proper PR.

The question is whether the current state is adequate or if it would be preferable that some of the ideas mentioned in the thread (custom curve, launcher dropdown option) were implemented before it was merged.
I suppose I could PR the current state and see about extending in any way later.
Title: Re: Joystick response curves
Post by: OverDhill on February 12, 2017, 06:57:22 pm
Using an external app is not a "solution" to "the joystick curve issue"; at best, it's a workaround.

Well until Freespace 2 is updated to handle more joystick devices then some people are still going to be using workarounds. I was using PPJoy and Xpadder for years until this new app came out that takes the place of PPJoy and Xpadder and tosses in Joycurves as well. One of the nice things is that it has a auto profile loader so any game can have its own curves of any axis remapped from your joysticks and any button remapped to vjoy or the keyboard.

So one thing it can do is to combine your joystick, throttle and rudder pedals into one virtual joystick that can have the curves adjusted and 32 buttons remapped.
Title: Re: Joystick response curves
Post by: AdmiralRalwood on February 12, 2017, 07:22:12 pm
Using an external app is not a "solution" to "the joystick curve issue"; at best, it's a workaround.

Well until Freespace 2 is updated to handle more joystick devices then some people are still going to be using workarounds.
...And you know the post you originally replied to was me wanting this in PR form so that we can do just that (update FSO), right? This will probably not get merged until the aforementioned update to handle multiple devices comes along.
Title: Re: Joystick response curves
Post by: OverDhill on February 12, 2017, 08:51:38 pm
Yes I understand but that is something that has been talked about for a long time. This is for those that need something right now.