Build Your Own Arcade Controls Forum

Main => Main Forum => Topic started by: jhuie on April 20, 2009, 02:09:18 am

Title: Analog guns with U-HID ---- configuration options?
Post by: jhuie on April 20, 2009, 02:09:18 am
I am in the process of converting a Lucky & Wild game to Mame.  It has analog (potentiometer) guns which I have mapped to a U-HID device so they appear to be analog joysticks on a game controller.  I downloaded the latest version of Mame and they seem to work ok except two things:

1) When you move them near the center of the screen, the cursors will jump or snap to the center and stick there until you move quite away from the center again.  So the center of the screen is basically "sticky".  I'd like the movement to be smooth from one side to the other without jumping to the center each time.

2) The guns aren't quite pointing exactly at the cursor.  They are off by maybe an inch.

Has anyone out there done this who can explain how to calibrate these and fix these issues?  I've looked around quite a bit but haven't found much on the subject.  At least nothing recent that is using a current Mame version.

Thank you!

John
Title: Re: Analog guns with U-HID ---- configuration options?
Post by: TheShanMan on April 20, 2009, 12:28:09 pm
What you're running into sounds like a joystick's dead zone. I don't recall off hand, but you might check the windows joystick configuration to see if there's a setting there. I know there's a setting in MAME, but I don't know what the ini setting is off-hand. Someone may chime in with that, or you can always run MameUI and set it in the options dialog there, and then see what it corresponds to in the ini file.
Title: Re: Analog guns with U-HID ---- configuration options?
Post by: Neverending Project on April 20, 2009, 12:48:52 pm
I haven't used the U-HID before, but I did come across the following page on it's website:
http://www.u-hid.com/index.php?option=com_content&view=article&id=4&Itemid=9

Basically, it says there is an Offset setting in the second page of the GUI of the U-Config program. This may help with your offset of an inch that you are seeing.
Title: Re: Analog guns with U-HID ---- configuration options?
Post by: u_rebelscum on April 21, 2009, 05:41:44 pm
1.  Set mame's deadzone to a lower number.  Mame's default is 0.3 (aka 30%), which is fine for gamepad thumbsticks, but too big for a high quality analog joystick.  Depending on the game and how "clean" your pots are, I suggest between 0% and 5% (0.0 - 0.05 in mame.ini).
Title: Re: Analog guns with U-HID ---- configuration options?
Post by: jhuie on April 22, 2009, 12:54:20 am
Oooooh, I get it now.   The dead zone is intended to make an analog joystick work like a 4-way or 8-way stick by having a region in the middle that's blanked out.  That makes sense.  But since I'm using it for guns I don't need (or want) it to work that way so I should set it to zero.  I'll try it.  Thanks guys!

Now to figure out how to better align the guns with the screen.....
Title: Re: Analog guns with U-HID ---- configuration options?
Post by: TheShanMan on April 22, 2009, 01:17:47 am
No, it's not really to make it work like a 4 way or 8 way joystick. Take the game Spy Hunter for example. If you let go of the steering wheel, you should go perfectly straight. How about if you're holding it and therefore it's not exactly centered. It might just be a hair away from being centered. It would not play that well if that meant the car started turning left or right, and it isn't how the original game was designed to work. So a dead zone means even if it moves a hair left or right, the game will still see it as centered. But once you go out of the dead zone, normal analog action takes place.

As for alignment, I would think that could be accomplished via the windows joystick calibration app (or if the u-hid handles it's own calibration, through its app) by carefully tracing around the edges of the screen.
Title: Re: Analog guns with U-HID ---- configuration options?
Post by: jhuie on April 22, 2009, 02:01:59 pm
I see what you are saying.  Since Lucky & Wild is both a driver and a shooter I'll need to set up a dead zone on the steering wheel.  But there's no reason to have one on the guns, gas pedal or brakes.  I'll tinker more with the gun calebration and report back!

Thank you again.

John
Title: Re: Analog guns with U-HID ---- configuration options?
Post by: u_rebelscum on April 22, 2009, 05:28:55 pm
To tell the truth, the current use of mame's deadzone isn't the same as it was earlier.  It used to be designed to do both the analog-2-digital 4/8 way conversion point, and to stop accidental just off center drift.  Currently -joystick_map has mostly taken over the analog-2-digital conversion, with more flexiblity; however deadzone still has effect (if the deadzone is bigger than the joystick_map's center.

Still, mame's default value is the same as it was, and IMO 30% is much higher than needed to just cover wandering or off centers, even for the worst cases.  Something all people using analog joysticks 270 steering wheels, and joystick (positional) guns should decrease. 

I usually recommend setting the deadzone between 0.0 to 0.05 because I don't know how off center the user's hardware is that the deadzone has to cover.  If the hardware is perfect, zero is fine, but even the best devices sometimes need a little deadzone.  (A setting of 0.05 will get a 12x12 square deadzone around the center in positional gun games.  edit: 12 out of 256 input values per axis that is; it has nothing to do with the resolution.)
Title: Re: Analog guns with U-HID ---- configuration options?
Post by: jhuie on April 23, 2009, 03:16:21 pm
Thanks guys...this has been great info.  Changing the deadzone fixed the one problem.  However, I've still got tracking issues. 

Gun #2 tracks really well, but gun #1 doesn't.  If I point it at the extreme left then the cursor will be at the correct position horizontally.  But as I move across the screen to the right, the cursor moves faster than the gun and gets way ahead of it.  The further I move to the right the worse it gets until I get to about the middle and then it starts closing the gap again until I get to the extreme right when it's right on target.  And the same thing is happening vertically with that gun.

I've tried recalibrating through windows several times with the same results.  Anyone else have any ideas?
Title: Re: Analog guns with U-HID ---- configuration options?
Post by: KissMyWookie on June 27, 2009, 04:55:43 am
Check that the pots are the same in the left gun as in the right gun.

It's possible that it was repaired some time in the past and an incorrect pot was used (either in resistance value or log/linear types).

Steve

Edit: Also, it could be that the pot is worn out and giving a higher resistance as the wiper sweeps across.