Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Front ends and 8-way digital joysticks: Use both axes?  (Read 2426 times)

0 Members and 1 Guest are viewing this topic.

DrakeTungsten

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 287
  • Last login:August 14, 2022, 06:36:45 pm
  • I effed with the wrong person!
    • No Quarter - a basic FE, WIP
Front ends and 8-way digital joysticks: Use both axes?
« 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.
« Last Edit: May 23, 2018, 10:05:25 pm by DrakeTungsten »
No Quarter - a basic FE, WIP

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9403
  • Last login:Today at 02:59:32 am
  • Designated spam hunter
Re: Front ends and 8-way digital joysticks: Use both axes?
« Reply #1 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
« Last Edit: May 23, 2018, 11:03:59 pm by PL1 »

paigeoliver

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10992
  • Last login:March 29, 2022, 06:10:15 pm
  • Awesome face!
Re: Front ends and 8-way digital joysticks: Use both axes?
« Reply #2 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.
Acceptance of Zen philosophy is marred slightly by the nagging thought that if all things are interconnected, then all things must be in some way involved with Pauly Shore.

DrakeTungsten

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 287
  • Last login:August 14, 2022, 06:36:45 pm
  • I effed with the wrong person!
    • No Quarter - a basic FE, WIP
Re: Front ends and 8-way digital joysticks: Use both axes?
« Reply #3 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.
« Last Edit: May 24, 2018, 09:52:45 am by DrakeTungsten »
No Quarter - a basic FE, WIP

DrakeTungsten

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 287
  • Last login:August 14, 2022, 06:36:45 pm
  • I effed with the wrong person!
    • No Quarter - a basic FE, WIP
Re: Front ends and 8-way digital joysticks: Use both axes?
« Reply #4 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.
« Last Edit: May 24, 2018, 09:39:22 am by DrakeTungsten »
No Quarter - a basic FE, WIP

Jakobud

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1940
  • Last login:March 11, 2024, 04:45:38 am
Re: Front ends and 8-way digital joysticks: Use both axes?
« Reply #5 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.

paigeoliver

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10992
  • Last login:March 29, 2022, 06:10:15 pm
  • Awesome face!
Re: Front ends and 8-way digital joysticks: Use both axes?
« Reply #6 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.
Acceptance of Zen philosophy is marred slightly by the nagging thought that if all things are interconnected, then all things must be in some way involved with Pauly Shore.

Titchgamer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4222
  • Last login:December 17, 2023, 08:05:48 am
  • I have a gaming addiction.....
Re: Front ends and 8-way digital joysticks: Use both axes?
« Reply #7 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.

DrakeTungsten

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 287
  • Last login:August 14, 2022, 06:36:45 pm
  • I effed with the wrong person!
    • No Quarter - a basic FE, WIP
Re: Front ends and 8-way digital joysticks: Use both axes?
« Reply #8 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.
No Quarter - a basic FE, WIP

paigeoliver

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10992
  • Last login:March 29, 2022, 06:10:15 pm
  • Awesome face!
Re: Front ends and 8-way digital joysticks: Use both axes?
« Reply #9 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.
Acceptance of Zen philosophy is marred slightly by the nagging thought that if all things are interconnected, then all things must be in some way involved with Pauly Shore.

Mr. Peabody

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 810
  • Last login:November 05, 2019, 02:30:42 pm
Re: Front ends and 8-way digital joysticks: Use both axes?
« Reply #10 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?

paigeoliver

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10992
  • Last login:March 29, 2022, 06:10:15 pm
  • Awesome face!
Re: Front ends and 8-way digital joysticks: Use both axes?
« Reply #11 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.
Acceptance of Zen philosophy is marred slightly by the nagging thought that if all things are interconnected, then all things must be in some way involved with Pauly Shore.