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: Fixing wiimote light guns on the PC.  (Read 4611 times)

0 Members and 1 Guest are viewing this topic.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:April 21, 2024, 11:59:54 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Fixing wiimote light guns on the PC.
« on: November 13, 2018, 09:36:21 pm »
So I've got this long abandoned program on my HDD.  It's a wiimote interface app I was working on for light gun use.    I can read buttons and the ir sensor ect so in theory I could write anything we need but I just need help devising whatever hardware/software we need.  Like right now I find the center of the two ir points and then add a vertical offset to determine the position and it works ok, but you have to be far enough back so that the IR bar is always in frame.  I've got some very simple "guess" code for when only one is in frame, but it isn't super good. 


So what do you guys think?  Do I need to experiment with more IR beacons?  Any logic suggestions for the code?


I think we can do something fairly good this way, but most people that wrote wiimote apps didn't really bother to go any further than reading the IR data and spitting out an uncalibrated position.  While we wait for other solutions I'm more than willing to give it a shot. 

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:Today at 09:51:46 am
Re: Fixing wiimote light guns on the PC.
« Reply #1 on: November 14, 2018, 12:41:33 am »
I think that this is the cheapest way possible to have a working light gun for our cabinets. Positional guns are another solution, but extra hardware is needed. New solutions in development are exciting, but closed hardware it seems.
I say: go for it Howard and give moderators a new reason for opening a lightguns/arcadeguns subforum.

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: Fixing wiimote light guns on the PC.
« Reply #2 on: November 14, 2018, 01:58:44 am »
I think the only way to make IR lightguns more viable is to add extra IR bars around the screen to get a better position.

As for the forum Saint agreed to give us one agggeessss ago just still waiting for him to make it....

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:April 21, 2024, 11:59:54 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Fixing wiimote light guns on the PC.
« Reply #3 on: November 15, 2018, 01:20:36 am »
As if the fates were aligning I found a Kinect at a goodwill today for 3 bucks.  So I'm going to throw that into the mix.....  they do tend to track motion pretty well. 


There are actually a few ways to increase accuracy, some of which I think Nintendo uses themselves.  The standard sensor bar alone can only do so much but if you combine it with some of the other sensors in a wiimote things get a bit better.  You can use the accelerometers to guess how much the wiimote is moving once the sensor bar is out of range.  I don't like this idea because quite honestly those sensors are crap and they flicker around when the wiimote is sitting on a frikkin table.  Now the gyro sensors on the wii motion plus, on the other hand, are quite good.  You use the sensor bar when it's in range to re-center the readings and go from there.  It's used to perfection in wii sports resort and the sword fighting game has maximum waggle. 


I do want to experiment with multiple ir points though, but I think I need someone to help me with the design.  The wiimote can only see so many points at once after all so just adding a bunch more isn't going to help.  Flashing groups might work, but I'm not sure if it would need to be synced to the reads or not. 

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: Fixing wiimote light guns on the PC.
« Reply #4 on: November 15, 2018, 01:49:33 am »
You could probably do something interesting with a Kinect but I have no idea what exactly lol


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:April 21, 2024, 11:59:54 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Fixing wiimote light guns on the PC.
« Reply #5 on: November 15, 2018, 02:05:06 am »
Well I could use it to track leds mounted to the end of some guns.... each gun uses a different color and the led turns on when the trigger is pulled.  There are a ton of drawbacks to a method like this, but the Kinect does have a rather wide viewing angle so it might work better for close-up play.  I have to make a power adapter before I can play with it though.  Nothing you buy at goodwill ever has the cord.  *grumble*

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: Fixing wiimote light guns on the PC.
« Reply #6 on: November 15, 2018, 02:23:27 am »
I think you would be likely to have problems with that.
Due to light radiation etc think you would have the same problems as IR.

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:Today at 09:51:46 am
Re: Fixing wiimote light guns on the PC.
« Reply #7 on: November 16, 2018, 12:42:06 am »
There are some example of head-tracking with multiple light sources as tracking point on the net. You can use IR to avoid reflections on surfaces, but anyway one drawback i can see is the distance lights must have with each other. Aestetically is a mess.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:April 21, 2024, 11:59:54 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Fixing wiimote light guns on the PC.
« Reply #8 on: November 17, 2018, 01:00:33 am »
So apparently windows 10 doesn't officially support the xbox 360 Kinect due to Microsoft being a butt.   There are ways around it, but the point is to make an easy light gun solution, not a convoluted mess. So it's out.... maybe the xbox one Kinect, but those are still fairly expensive. 

I did lug out the 360 and try some Kinect Sports season 2.  It's just like Wii Sports, only not fun at all!  I'm going to have to get all the Kinect games now just for the sheer humor I can get out of playing them. 


Anyway, tomorrow, time permitting, I'll take my app and make a quick demo app that you can all try using my current code.  It will just move the mouse around, but that should be enough to get an idea of accuracy. 

ark_ader

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5645
  • Last login:March 02, 2019, 07:35:34 pm
  • I glow in the dark.
Re: Fixing wiimote light guns on the PC.
« Reply #9 on: November 18, 2018, 03:26:04 am »
So apparently windows 10 doesn't officially support the xbox 360 Kinect due to Microsoft being a butt.   

They seem to work fine for me.  I have two connected up.  You need the power adapter to make them work but maybe you are not doing it right.

They work like a webcam with a mic.  You could possibly use the software compatibility mode for Windows 7.  They show up in device manager ok.
If I had only one wish, it would be for three more wishes.

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: Fixing wiimote light guns on the PC.
« Reply #10 on: November 18, 2018, 07:29:22 am »
So apparently windows 10 doesn't officially support the xbox 360 Kinect due to Microsoft being a butt.   There are ways around it, but the point is to make an easy light gun solution, not a convoluted mess. So it's out.... maybe the xbox one Kinect, but those are still fairly expensive. 

I did lug out the 360 and try some Kinect Sports season 2.  It's just like Wii Sports, only not fun at all!  I'm going to have to get all the Kinect games now just for the sheer humor I can get out of playing them. 


Anyway, tomorrow, time permitting, I'll take my app and make a quick demo app that you can all try using my current code.  It will just move the mouse around, but that should be enough to get an idea of accuracy.

Sounds interesting howard look forward to seeing what you can come up with :)

On the subject of the Wii would motion + controllers be any easier to work with?

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:April 21, 2024, 11:59:54 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Fixing wiimote light guns on the PC.
« Reply #11 on: November 22, 2018, 12:00:45 am »
Ok here is a little do-dad that will serve as a proof on concept.  None of the dot correction I mentioned has been added, but this will just show that I'm  reading wiimote data correctly and that hot swapping accessories in the expansion port works.  Please note that this does NOT do anything useful yet... it's just for fun.  I will hook up a cursor for P1 and virtual joysticks as things progress a bit further along. 

Note that this also doesn't help your wiimote pair with your pc, it merely communicates with it once you do.  I highly reccomend a dolphin bar (set to mode 4) as it will allow for a true plug and play experience. 

Anyway while in the demo you can test all of your buttons and axis, ect.  It will also show a rendering of the wiimote camera and a simulated cursor if you have your wiimote pointed at a sensor bar.  You can adjust the vertical offset of the cursor with the up and down buttons on the d-pad. 

I will add in some more functions to better track a two dot bar after the holiday.  After I get that as good as I think I can, I'll experiment with some multiple dot permutations.

SammyWI

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 457
  • Last login:August 16, 2022, 07:58:00 pm
Re: Fixing wiimote light guns on the PC.
« Reply #12 on: November 23, 2018, 09:02:11 am »
Interesting project.  Always good to have more options.  I use a Wiimote for a different PC project that does not use a light bar so I've never looked at the Dolphin bar.  How well does it work for the bluetooth connection?  Some bluetooth PC dongles seem to work better than others.  With the best one I've found, I still always need to press the red connect button on the Wiimote for two cycles before it connects with the PC. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:April 21, 2024, 11:59:54 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Fixing wiimote light guns on the PC.
« Reply #13 on: November 23, 2018, 05:33:36 pm »
It works great.  Basically it behaves like a wiimote does on the wii…. hold the power button and it connects and lights the appropriate player number.  Hold it again and it turns off.  The only problem is the built in mouse emulation modes kind of suck, thus me playing with the bar set to raw data mode so I can make some new functions. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:April 21, 2024, 11:59:54 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Fixing wiimote light guns on the PC.
« Reply #14 on: November 25, 2018, 11:40:30 pm »
I worked on this tonight.... made a little guesstimating code for when only one ir dot is visible.  It seems to track pretty well save for an occasional glitch.  Next I need to add a calibration routine so that the cursor position is calculated based upon the bounds of the screen as opposed to the camera resolution and use distance calculations to scale the motion in case the player moves forwards or backwards slightly. 


That would be about as good as I can get it with a vanilla wiimote with two ir dots.  I'll then work on adding the gyro code for wii motion plus and see if that's enough data to get an accurate read even close up.  If and only if that isn't acceptable I'll work on a multi dot solution.  No sense in doing work that isn't needed after all. 

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:Today at 09:51:46 am
Re: Fixing wiimote light guns on the PC.
« Reply #15 on: November 26, 2018, 12:37:23 am »
Howard, what is in the need to interface the wiimote to the PC? Would a cheap cinese bluetooth dongle suffice? Just to be ready for when some preliminary code will be released...

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:April 21, 2024, 11:59:54 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Fixing wiimote light guns on the PC.
« Reply #16 on: November 26, 2018, 02:50:27 am »
You can use a Bluetooth dongle, but depending upon the OS, the dongle and the Bluetooth stack it can be a major pain to quickly and easily connect and disconnect wiimotes.  The people that make the dolphin emulator probably have some info on their forums. 

Or just spend an extra 15 bucks or so and get a dolphin bar.  Then wiimotes behave EXACTLY as they do on the Wii.  (Pressing any button on the wiimote with the bar plugged in automatically syncs... The power button turns it off...  The proper led lights up ect…)


Like I mentioned though, the built in mouse functions included with the dolphin bar are inadequate, thus why I'm doing this. 


One thing I haven't mentioned is that due to hardware limitations I probably won't be able to get both guns to show up as mice.... joysticks are better for 2p mode anyway. 

gstav

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 212
  • Last login:April 19, 2024, 01:40:48 pm
    • forum.arcadecontrols.com/index.php/topic,157861.0.html
Re: Fixing wiimote light guns on the PC.
« Reply #17 on: November 26, 2018, 03:54:10 am »
nice thread  :applaud: Is this the same take as the sinden light gun project?
"One coin to rule em' all"

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: Fixing wiimote light guns on the PC.
« Reply #18 on: November 26, 2018, 07:03:13 am »
nice thread  :applaud: Is this the same take as the sinden light gun project?

Nah the Sinden gun is a totally different animal.

No IR or bar.

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:Today at 09:51:46 am
Re: Fixing wiimote light guns on the PC.
« Reply #19 on: November 27, 2018, 01:45:22 am »
Sorry for the dumb question: is this "dolphin bar" the Wii official sensor bar or a specific product? Would a generic wired cheap cinese sensor bar work?

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:April 21, 2024, 11:59:54 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Fixing wiimote light guns on the PC.
« Reply #20 on: November 27, 2018, 09:53:13 am »
No, the dolphin bar is a product by mayflash.  It's a bluetooth receiver built into a sensor bar that handles the pairing of wiimotes and makes them show up as mice and/or joysticks. 

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:April 22, 2024, 09:54:06 am
  • ...
Re: Fixing wiimote light guns on the PC.
« Reply #21 on: November 27, 2018, 10:54:30 pm »
Jeri Ellsworth put out a video today divulging some of the workings of the Cast AR VR glasses.  Skip to about 14:30 for some interesting things on tracking.



Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:April 21, 2024, 11:59:54 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Fixing wiimote light guns on the PC.
« Reply #22 on: November 28, 2018, 12:39:24 am »
Thanks.  I'm going to try to avoid a timed blinking pattern if I can help it, mostly because syncing it to the wiimote could require hardware that might things more convoluted than it's worth.  See that seemingly random placement pattern she had on that board?  I'm thinking that might be enough.  The idea I had would be using three leds on each corner, with the orientation and relative distance between the dots becoming the identifying factor.  In situations where that many leds are needed, the camera would most likely never have more than a 4th of the screen in the camera at a time.  If you are far enough away to see more, you could most likely get away with just the sensor bar anyway. 

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:April 22, 2024, 09:54:06 am
  • ...
Re: Fixing wiimote light guns on the PC.
« Reply #23 on: November 28, 2018, 10:22:58 am »
Yeah with the dolphin bar or most other methods of connecting, the data coming in is what you have to work with.

The flashing to identify the IR LEDs is how the Sega arcade systems work at close range.
Looking for interference to ignore between the flashes is friggin brilliant.
Shame nobody is incorporating these techniques into a home light gun.
They could sell dozens, maybe even a hundred.  ;)

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:April 21, 2024, 11:59:54 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Fixing wiimote light guns on the PC.
« Reply #24 on: November 28, 2018, 01:30:22 pm »
I agree, it's smart.  Clever software is definitely the thing we are missing with the wiimotes.  Too bad I'm such a crap programmer. 


I actually think if game developers were willing to invest the time and money a lightgun would sell quite well, assuming games were also made for it.  The Wii and PS Move gun games sold really well considering how hit and miss the accuracy was and how relatively cheap it is to make a gun game.  I think the key would be to do like the wheel manufacturers do and just make it usb based so it would work on the pc and potentially multiple game consoles.