Touch Screen Controls Feeling Jittery

A place for people with an interest in developing new shmups.
Post Reply
Numnomnum
Posts: 6
Joined: Sat Jul 27, 2013 9:50 pm

Touch Screen Controls Feeling Jittery

Post by Numnomnum »

I've tried two different methods so far and I can't get this to feel "right", so I'm appealing to this forum for aid! :)

My first attempt was a simple 1:1 between the mouse's relative position and the player's position. You'd think this would be the most accurate, but it just feels off; worse, it's jittery.

My second attempt was primitive mouse smoothing/acceleration, getting the difference between the original position and new position, and adjusting it by a percentage based on how far it was. This feels smooth, but inaccurate.

Now I've been playing Deathsmiles on the Android and I can't pinpoint how it works when it comes to this. It feels smoothed but it's still fairly accurate, though not perfect, so I'm sure there's either some scaling or smoothing going on, but I haven't been able to replicate it.

Any ideas? I'd really love some suggestions on this one. :(
User avatar
trap15
Posts: 7835
Joined: Mon Aug 31, 2009 4:13 am
Location: 東京都杉並区
Contact:

Re: Touch Screen Controls Feeling Jittery

Post by trap15 »

All the CAVE ports are scaled. You can make it feel less jittery by doing some sort of rounding or another sort of precision reduction.
@trap0xf | daifukkat.su/blog | scores | FIRE LANCER
<S.Yagawa> I like the challenge of "doing the impossible" with older hardware, and pushing it as far as it can go.
User avatar
solycobre
Posts: 6
Joined: Wed Jul 05, 2023 12:45 am

Re: Touch Screen Controls Feeling Jittery

Post by solycobre »

Decade later but I've found testing several IOS games that the [lerp][https://en.wikipedia.org/wiki/Linear_interpolation] approach with a decent speed is the best one. just dont make it too slow because it will feel like it has inertia and it would be more difficult to control the player specially in the bullet hell genre.
User avatar
Lander
Posts: 1338
Joined: Tue Oct 18, 2022 11:15 pm
Location: Area 1 Mostly

Re: Touch Screen Controls Feeling Jittery

Post by Lander »

I'd err away from both of those approaches; precision reduction loses precision, so introduces a new kind of bad-feel. And a naive lerp-to-point approach introduces inertia relative to the interpolation speed / position delta.

Instead, I'd try a fixed-window smoothing filter; buffer pointer inputs in a list, pushing positions onto the front as they arrive, and popping elements off the back whenever it exceeds a given length. Then, calculate your actual input position by averaging the elements of the list; the longer the max length, the smoother (ergo less responsive) it'll feel.

That way, you retain the speed and precision of a pointer input, and keep the tightness / smoothness tradeoff controllable.

You could also extend the approach by giving each list element a timestamp, and popping them after they've been in the list for X units of real-time; that would probably be more robust if your input backend allows more than one pointer event to arrive in the span of one frame, and also scale better to arbitrary timesteps.
Post Reply