Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Unknown Target on February 02, 2017, 11:23:29 am

Title: Request: Smoother Joystick Input
Post by: Unknown Target on February 02, 2017, 11:23:29 am
Hey all, I've heard that the controllers are getting a rework so sorry if this is a duplicate, but are there any plans to smooth out the joystick inputs? Right now flying in FS2 is just...not that much fun compared to games like Elite or even Star Citizen. The joystick has no input lag or smoothing applied so it's really difficult to make precise movements. It would be nice if the rate was smoothed out so instead of herking and jerking around it was more fluid. Is this already being worked on?
Title: Re: Request: Smoother Joystick Input
Post by: jr2 on February 02, 2017, 11:28:51 am
I think you'll get that, they are switching IIRC from MS directinput to SDL (right guys?), and MS DirectInput changed with.. Win XP? 7? and anyways it messed up the input somehow, I forget the story, but I'm sure someone here knows and will chime in.

Anyways, switching to SDL, so that won't be a problem. Correct me if I'm wrong.
Title: Re: Request: Smoother Joystick Input
Post by: AdmiralRalwood on February 02, 2017, 12:06:19 pm
Nightly builds have been using SDL2 for input-handling on all platforms for months.
Title: Re: Request: Smoother Joystick Input
Post by: Unknown Target on February 02, 2017, 02:03:39 pm
I'll try one of them out and report back on my feedback. I've only been using the latest FSOpen release.
Title: Re: Request: Smoother Joystick Input
Post by: chief1983 on February 02, 2017, 02:42:13 pm
On a related note, there was an experiment with different joystick curves done a while back, that might help with what you're experiencing.  I'd have to find it though.
Title: Re: Request: Smoother Joystick Input
Post by: jr2 on February 02, 2017, 03:00:58 pm
Admiral Ralwood bumped it: http://www.hard-light.net/forums/index.php?topic=87470.0
Title: Re: Request: Smoother Joystick Input
Post by: z64555 on February 02, 2017, 05:21:02 pm
Herking and jerking around? What?  :confused:

Each craft in FSO has their own handling, more "massive" craft turn slower and also have a slower turn rate acceleration, only the lightweight ships like the Perseus would have handling similar to what you're describing.
Title: Re: Request: Smoother Joystick Input
Post by: jr2 on February 03, 2017, 08:01:54 pm
Herking and jerking around? What?  :confused:

Each craft in FSO has their own handling, more "massive" craft turn slower and also have a slower turn rate acceleration, only the lightweight ships like the Perseus would have handling similar to what you're describing.

I know what he's talking about.  It's the inability of the joystick to smoothly transition.  You're either not moving or barely moving, and then your turning full force.  This makes it impossible to hit the broad side of a barn.
Title: Re: Request: Smoother Joystick Input
Post by: AdmiralRalwood on February 03, 2017, 09:12:25 pm
That is the exact opposite of how the deadzone code is supposed to work; it should rescale the joystick input so that the edge of the deadzone is 0 (of course, I don't know if that code in particular changed as a result of the move to SDL2). Can anyone confirm whether or not that's been a problem since the SDL Everywhere merge?
Title: Re: Request: Smoother Joystick Input
Post by: z64555 on February 03, 2017, 11:52:41 pm
The SDL code didn't modify the deadzone and scaling routine, joy_get_scaled_reading, all it did was move it into controlsconfig.cpp.

More likely what is happening is that folks are not used to the deadzone hystersis that FSO uses, which AdmiralRalwood described.

The result being that you have some amount of deflection in the joystick where the input does nothing, and then you have a significantly less amount of deflection on the stick coupled with a sharper gain. In other words, the larger the deadzone, the more sensitive the stick is outside of the deadzone.

Another thing that could be happening is that the response curve is ridiculously nonlinear:

Code: [Select]
// compute percentages as a range between 0 and 1
sensitivity_percent = (float) Joy_sensitivity / 9.0f;
non_sensitivity_percent = (float) (9 - Joy_sensitivity) / 9.0f;

// find percent of max axis is at
percent = (float) d / (float) rng;

// work sensitivity on axis value
percent = (percent * sensitivity_percent + percent * percent * percent * percent * percent * non_sensitivity_percent);

A sensitivity setting of 9 means you're getting the linear response, and a setting of 0 means you're getting an x^5 curve (http://www.wolframalpha.com/input/?i=plot+x%5E5).

The joystick response curve code gives you much more control over what the curve looks like, which is a strong reason to get it published soonish.
Title: Re: Request: Smoother Joystick Input
Post by: FrikgFeek on February 04, 2017, 04:57:06 am
The joystick has no input lag

Why would anyone want input lag? Is there a positive to having everything happen with a delay?
When comparing Freespace to things like E:D it's important to remember that Freespace is also a much faster game. ED ships are just way more sluggish and they're bigger targets, they're just naturally easier to hit, it has nothing to do with joystick curves.

There's no way to make turning both slower and more linear aside from picking a slower turning ship. I guess with a custom curve you could maybe set it up so that you have a linear and slow response line up to around 80% and then make it climb exponentially and reach full turning by 100% but that wouldn't feel very smooth.
Title: Re: Request: Smoother Joystick Input
Post by: Novachen on February 04, 2017, 08:14:52 am
Actually i do not think, that you should compare games like Freespace with Elite or Star Citizen that use both somekind of a WWII-style flight model.

In my opinion Freespace, and other games from that time, has more in common with a First-person Shooter instead of a flight simulator. The main difference is, that you have a much slower turning rate, and much more keys you can use, than in the general FPS-game.

The slower turning rate is the main reason, why you actually can play this games with a joystick without any disadvantages against mouse-players. I have never problems to fly precise maneuvers in the first place with the right sensitivity settings in the game.
Title: Re: Request: Smoother Joystick Input
Post by: FrikgFeek on February 04, 2017, 09:30:29 am
I really wouldn't compare Freespace to an FPS. Very few ships can strafe and the environments are wide open with almost no cover. And especially when you consider that 90s FPSs were all about circlestrafing and instagibbing.

In terms of gameplay Freespace is very similar to Tie Fighter, which is a rather serious sim trying to simulate very non-serious spaceship behaviour from a fictional movie. That's why ships have limited maximum speeds and very low inertia. Star Wars ships acted like spaceplanes so Tie fighter and after it Freespace have spaceplanes.

The reason you can(or could, I guess, FSO multi is dead)  compete with mouse users is because their turnrate is limited and doing some manoeuvres is much harder with a mouse. A mouse player will almost always have better accuracy than someone playing with a joystick. But the joystick player has more options in a knifefight.
Title: Re: Request: Smoother Joystick Input
Post by: z64555 on February 04, 2017, 01:10:11 pm
FreeSpace differs from other games from that time regarding mouse-joystick interaction, in that the mouse still respects the dynamics of the craft and thus has the same turn rate and turn acceleration constraints as the joystick has.
Title: Re: Request: Smoother Joystick Input
Post by: FrikgFeek on February 04, 2017, 01:52:03 pm
Theoretically, yes. But realistically you're going to have to lift your mouse when you turn which means you can't have smooth turning at the maximum possible turnrate  at all times.
Title: Re: Request: Smoother Joystick Input
Post by: z64555 on February 04, 2017, 08:53:12 pm
Theoretically, yes. But realistically you're going to have to lift your mouse when you turn which means you can't have smooth turning at the maximum possible turnrate  at all times.

Not being able to continuously turn smoothly is nowhere near a game breaker as is being able to snap to your target instantly. That's why the acceleration limit is on the mouse control.
Title: Re: Request: Smoother Joystick Input
Post by: Unknown Target on February 17, 2017, 07:50:02 pm
The FreeSpace flight model is based on the old Descent 6DOF shooters - that's why the speeds are low and the turning is so fast. It's about pivoting to an axis as quickly as possible.

Now, Freespace ships do have inertia, so when the dampening value is ramped up (like in BtRL IIRC), you can take advantage of that inertia to get your crosshairs on target - a slight understeer, but it never worked so well because Freespace's underlying system is not based on smooth input. My understanding of the system stops here, but I know it doesn't "feel" quite right - like I don't have accuracy when turning small amounts. Maybe the input ramps too much, or not enough?
Title: Re: Request: Smoother Joystick Input
Post by: z64555 on February 17, 2017, 09:35:49 pm
FreeSpace differs from other games from that time regarding mouse-joystick interaction, in that the mouse still respects the dynamics of the craft and thus has the same turn rate and turn acceleration constraints as the joystick has.

I'd like to add that the mouse also has a different sensitivity curve than what the joystick is subject to, the curve is pure linear. Also, the mouse is vulnerable to FPS spikes because its delta calculations use the frame time. (See playercontrol.cpp:536). Players with high framerates have a more sensitive mouse than those with lower framerates.

I'm not entirely sure why that is, perhaps it was something leftover when they were doing the first versions of time compression. I could make a test build with the framerate factors removed and have it available for testing.


[EDIT] Major correction! I did a quick test of this and can safely assert that you actually have _less_ sensitive controls for faster framerates. Also, this mechanism is most certainly intended to be used with time compression, the factor is there so that you can maintain a reasonably sane control rate during time compression.
Title: Re: Request: Smoother Joystick Input
Post by: Dragon on February 17, 2017, 10:59:41 pm
I can see a few better ways of achieving that. For example, basing sensitivity on time compression level. I have a HOTAS, but I guess many people rely on mouse these days, so consistent behavior of it would be welcome.

Also, is player-controlled time compression useful for anything other than breaking stuff and skipping through poorly designed missions? I never found that feature to be of much use. Slowing down time can come in handy, but has to be handled via SEXPs.
Title: Re: Request: Smoother Joystick Input
Post by: Unknown Target on February 17, 2017, 11:55:16 pm
If we're talking about mouse control it'd be nice to have something more like Freelancer or even Star Citizen. The way the drag-to-turn is implemented it's a lot easier to play (and doesn't require me to pick up my mouse and move it across the desk). Not sure if that's a monstrously huge project or not though.
Title: Re: Request: Smoother Joystick Input
Post by: niffiwan on February 18, 2017, 12:26:44 am
There's a LUA script around that implements Freelancer style mouse control.
Title: Re: Request: Smoother Joystick Input
Post by: AdmiralRalwood on February 18, 2017, 12:44:30 am
There's more than one released Lua script (http://www.hard-light.net/forums/index.php?topic=74435.0) to do exactly that, and they've been around for years.

EDIT: There was also more than (http://www.hard-light.net/forums/index.php?topic=89237.0) one attempt (http://www.hard-light.net/forums/index.php?topic=89486.0) to add the functionality to FSO itself, both from people who aren't members of the SCP, but I don't believe either ever got around to making a pull request.