Build Your Own Arcade Controls Forum

Main => Main Forum => Topic started by: DrakeTungsten on May 23, 2018, 10:00:45 pm

Title: Front ends and 8-way digital joysticks: Use both axes?
Post by: DrakeTungsten on May 23, 2018, 10:00:45 pm
I'm developing a front end, and have been testing it mostly with analog joysticks or a keyboard. Having tried it with an 8-way digital joystick, I immediately noticed that I often register movement along one of the axes which I didn't intend. For example, if I push the joystick up, my front end will register it as up+left or up+right unless I'm very careful to go straight up. The cause of this behavior is obvious, and I frankly should have expected this. I'm not asking how to eliminate the cause, but I'm curious how other front-ends avoid this. Do most of them make use of only one axis? If they do make use of both axes (that is, they have two separate groups of things which may be scrolled through, depending on which axis is engaged), does anybody have any idea how they would determine which axis to use when both are engaged by the joystick at the same time? I guess it would have to be with timing ("in the last half-second, the user spent 14 more milliseconds on the x-axis than the y-axis, so I'll say he meant to scroll along the x-axis"), but that seems unreliable, but at least you'd only get one axis acted upon.
Title: Re: Front ends and 8-way digital joysticks: Use both axes?
Post by: PL1 on May 23, 2018, 10:59:57 pm
Not sure how the various front ends handle it, but it seems like comparing timing is needlessly complicated.   :dunno

Wouldn't it be easier to ignore diagonals?

i.e. Up + not Right + not Left ==> move Up.


Scott
Title: Re: Front ends and 8-way digital joysticks: Use both axes?
Post by: paigeoliver on May 23, 2018, 11:33:46 pm
What stick are you using, you should not be accidentally hitting diagonals. Seems to me that the problem is with the stick, not your front end.
Title: Re: Front ends and 8-way digital joysticks: Use both axes?
Post by: DrakeTungsten on May 24, 2018, 09:26:34 am
Not sure how the various front ends handle it, but it seems like comparing timing is needlessly complicated.   :dunno

Wouldn't it be easier to ignore diagonals?

i.e. Up + not Right + not Left ==> move Up.


Scott

Perfect solution. Thank you.
Title: Re: Front ends and 8-way digital joysticks: Use both axes?
Post by: DrakeTungsten on May 24, 2018, 09:33:33 am
What stick are you using, you should not be accidentally hitting diagonals. Seems to me that the problem is with the stick, not your front end.

IDK what joysticks they are. I bought them 10 years ago for $15 or $20 each. I thought 8-ways had a square range of motion which would naturally guide you into physically hitting the diagonals, thus make precision 90° directions more difficult than a 45° direction.

Based on this perhaps faulty understanding, I wasn't at all surprised once I saw the 8-ways behaved this way.
Title: Re: Front ends and 8-way digital joysticks: Use both axes?
Post by: Jakobud on May 24, 2018, 01:25:31 pm
Another solution instead of ignoring diagonals is just keeping track of which direction happens first. For example, when you move the joystick up and accidentally hit the diagonal, you are not hitting both up and right at the EXACT same time. One of them is getting hit first, most likely UP in this case. So just set your event listener for keypresses to first check to see if another direction is already being pressed before doing anything. So some pseudo code:

Code: [Select]
let keyBeingPressed = false
...on('keydown', function (e) {
  if (keyBeingPressed == true) {
    return false
  }

  .... // do whatever you want to do here

})

...on('keyup', function (e) {

  keyBeingPressed = false

})

The idea is that when you move your joystick in one of your 4 directions, it's going to register that keypress and first and if you accidentally then move the joystick into one of the two diagonals then it will ignore that direction because you are STILL pressing in the original direction you intended.
Title: Re: Front ends and 8-way digital joysticks: Use both axes?
Post by: paigeoliver on May 24, 2018, 02:51:39 pm
There is no way you should triggering unwanted diagonals in a frontend situation. You either have the worst sticks in the world, maladjusted sticks, or something is wired or interfaced wrong. If they are doing this in the frontend they will be unplayable in a game.
Title: Re: Front ends and 8-way digital joysticks: Use both axes?
Post by: Titchgamer on May 24, 2018, 05:40:36 pm
There is no way you should triggering unwanted diagonals in a frontend situation. You either have the worst sticks in the world, maladjusted sticks, or something is wired or interfaced wrong. If they are doing this in the frontend they will be unplayable in a game.

This ^

Something is wrong if you are doing this on any sort of regular basis unless its user error.

The motion of the sticks is decided by what gate you have fitted.

Round, Square or octagonal.

All give motion as you would expect accordingly.

As for what other front ends do with different axis that can usually be changed.

But I have always set mine up to scroll through games with up/down and jump letters alphabetically with left/right.

Makes scrolling much quicker IMO.
Title: Re: Front ends and 8-way digital joysticks: Use both axes?
Post by: DrakeTungsten on May 25, 2018, 01:56:25 pm
So consistently staying within 1/8 sector of a circle without any visual representation of said sector is really considered child's play? I'm not getting defensive about my sticks (I know I cheaped out on them and plan to replace them), and I admit my hand-eye coordination (or whatever you want to name the skill involved here) is not impressive, but either the hyperbole is out of control, or we're not talking about the same things. Anyway, thanks for opening my eyes to the fact that the sticks might be partly to blame (but I assure you they are not unplayable).

Quote
Another solution instead of ignoring diagonals is just keeping track of which direction happens first. For example, when you move the joystick up and accidentally hit the diagonal, you are not hitting both up and right at the EXACT same time. One of them is getting hit first, most likely UP in this case. So just set your event listener for keypresses to first check to see if another direction is already being pressed before doing anything
I'll likely give this a try after I see how well implementing Scott's suggestion goes. Maybe some combination of these will be best. As I learned the hard way, I really need to see the end results of a design change in regard to this issue before I know how it's really going to work. Thanks.
Title: Re: Front ends and 8-way digital joysticks: Use both axes?
Post by: paigeoliver on May 25, 2018, 07:04:42 pm
You probably have either cheap Chinese sticks that favor the diagonals or have poorly adjust actuators that are pushing you into the diagonals. You should be able to press up, down, left or right on any stick over and over and over again without triggering an angle. You might also have the stick put together wrong in some fashion.

So consistently staying within 1/8 sector of a circle without any visual representation of said sector is really considered child's play? I'm not getting defensive about my sticks (I know I cheaped out on them and plan to replace them), and I admit my hand-eye coordination (or whatever you want to name the skill involved here) is not impressive, but either the hyperbole is out of control, or we're not talking about the same things. Anyway, thanks for opening my eyes to the fact that the sticks might be partly to blame (but I assure you they are not unplayable).

Quote
Another solution instead of ignoring diagonals is just keeping track of which direction happens first. For example, when you move the joystick up and accidentally hit the diagonal, you are not hitting both up and right at the EXACT same time. One of them is getting hit first, most likely UP in this case. So just set your event listener for keypresses to first check to see if another direction is already being pressed before doing anything
I'll likely give this a try after I see how well implementing Scott's suggestion goes. Maybe some combination of these will be best. As I learned the hard way, I really need to see the end results of a design change in regard to this issue before I know how it's really going to work. Thanks.
Title: Re: Front ends and 8-way digital joysticks: Use both axes?
Post by: Mr. Peabody on May 29, 2018, 06:32:32 am
I don't know what the hubbub is about. Any 8-way is designed to go diagonally pretty easily, and register zone is pretty big, outside of Competitions. Not infrequently have I moved in game list when changing game in the list.

I as well thought of first occurrence, but the basic MAME-style key selection should be sufficient. Do other fronts ends take this into account?
Title: Re: Front ends and 8-way digital joysticks: Use both axes?
Post by: paigeoliver on May 29, 2018, 11:53:49 am
My Candy cabinet had some el cheapo chinese joysticks in it that favored the diagonals. 90 percent of my deaths in Contra were coming from slipping into a diagonal from a primary. I replaced them with whatever Sanwas everyone here was suggesting and the problem instantly vanished.