Game Development Community

dev|Pro Game Development Curriculum

Wii Remote Control in TGE is Working

by Rob Terrell · 12/14/2006 (8:37 pm) · 31 comments

Hey, I've finally got something to blog about. So yeah, I got a Wii. You know, it's for the kids! It's not for me, honest, honey!

I was talking to a co-worker about the Wii, and we came up with a great idea for a Wii game. But, how to protoype such a thing?

When I got the Wii, I also got some extra controllers. One of those was for me. After following the progress of folks reverse-engineering and coding for the Wii remote I decided to try to hack some Wii remote support into TGE. You know, for the kids.

So far: it's working! And it's fun. Take a look at www.youtube.com/watch?v=o-5mlzf9KxQ
or a high-quality the screen capture movie (9 MB QuickTime). Ignore the dead-tired looking dweeb in the corner (he's actually having fun, that's how he shows it) and focus on the Wii remote in his hand. You can also see some of the console debugging in the background.

stinkbot.com/TGWii.jpg
I don't have the left-right control as fine as I'd like it, but it's just a matter of fooling with it.

Edit: added YouTube video link.

See, I'm serious about TGE. Now, finally, for the love of god, won't someone let me join the Constructor beta?
Page «Previous 1 2
#1
12/14/2006 (8:46 pm)
Radical!
#2
12/14/2006 (8:56 pm)
I was gonna try exactly the same thing [now, if only Wiis weren't sold out here every single damn time I go to look; even the controllers are entirely inaccessible]!

I presume you've attached it to the mouse since you're using OSX and joystick code doesn't work? Or did you write a separate joystick/wiimote handler?

Gary (-;
#3
12/14/2006 (9:00 pm)
lol coolness.

edit: After reading it again. There is a market for new controllers for pc's and consoles.

Wii has a problem with extending the carpel but it's new thinking. Just would be good to see some folks invent some new controllers other than the old kiddie plastic ones that have been around for a while.
#4
12/14/2006 (9:02 pm)
Wow, this went up quick. I just posted this on the Mac forum, sorry for the double post.

Right now it listens to the motion sensor for X and Y axis movement, and translates that into mouse movements: SI_XAXIS and SI_YAXIS events that are fed in via Game->postEvent(event). I've started support for the A and B buttons but I wasn't sure if I should make them into some new kind of keypress, or map them onto an existing keyboard character. Right now, A = space and B = return.

I thought about implementing the Wii stuff in the joystick functions, but I'm not sure how that all ties together. There seem to be assumptions throughout the code that Macs don't support joysticks. Now that the basic stuff is working, I'll probably migrate the code over and call it a joystick.

Also I'm planning on adding sensor bar support, so navigating GUIs is easier.
#5
12/14/2006 (9:15 pm)
one? you must be a mac user... ;)

I was thinking of getting a bunch and making a poor man's bone/skeleton motion capture rig with duct tape.
#6
12/14/2006 (9:16 pm)
That kicks butt!
#7
12/14/2006 (9:28 pm)
Wow this is awesome :) Now i have to go buy a wii controller :)
#8
12/14/2006 (9:40 pm)
Good job! It is fun to see new tech applied to TGE.

Rock on!
Hall Of Worlds - For Gamers
EdM|GPGT
#9
12/14/2006 (9:48 pm)
By far the coolest thing I have seen.
#10
12/14/2006 (9:54 pm)
Wow, now you can make TGE games that interface with both the XB360 controller and the Wii remote! (Plus the Guitar Hero controller let's not forget)
#11
12/14/2006 (10:44 pm)
Just curious but did this void your warranty? :D
Congrats anyways.
Regards,
Dreamer
#12
12/14/2006 (10:55 pm)
@Dreamer: no need -- the Wii remote is bluetooth. It just does a bluetooth discovery and searches the device list for the remote's unique device name.
#13
12/15/2006 (12:35 am)
@Rob

Cool, I almost bought a wii controller the other day, just to see if I could find a use for it in TGE. Now it looks like I have no other choice.

:)
#14
12/15/2006 (2:14 am)
Whoa! that is really cool! How long did it take to implement?
#15
12/15/2006 (3:13 am)
Very cool indeed. Just what I hoped would happen, if you get sensor bar working then even more awesome.
Then someone just have to make it work with TorqueX, so we can use it with the XBox 360 ;)

Regarding "the dead-tired looking dweeb", man, he should be a poker player....
#16
12/15/2006 (3:32 am)
I have a feeling Nintendo are going to be selling an unusually high amount of Wiimotes in comparison to Consoles in the future ;) - Having an official PC/Mac driver set for it would be a pretty awesome move for them imo.
#17
12/15/2006 (4:02 am)
Wow, this would be an awesome resource! Perhaps when the code has reached a more useable state you could release it??? If you can, drop me an e-mail: anthonybertolo@gmail.com . I would love to talk more about this implementation :)
#18
12/15/2006 (4:06 am)
Main issue for PC/Mac people buying WiiMotes might be to get the sensor bars. Sure people can use candles and so, but maybe there is a market for sensor bars also ;)
#19
12/15/2006 (5:05 am)
@Samuel Nova: I haven't looked through the APIs, but I kind of doubt XNA includes any kind of bluetooth discovery and device enumeration.

As for the sensor bar -- the current code doesn't use one, but I hope to add it today. I went to radio shack and bought a couple of infrared ($1.99 each) LEDs. Each is wired to its own a AA battery and taped to the top of my powerbook lid. Incredibly lousy engineering, but it should work well enough to get into the game.

@Tom: It took about two hours to get to this point, but I started from a working example (http://sourceforge.net/projects/darwiin-remote/). Most of the time was spent trying to figure out how to properly call the Cocoa bluetooth APIs from Carbon. Also, the Cocoa code throws a SIGALRM (you can see it in the console output) and I had to figure out why that was happening -- it was the innocuous timing out of the bluetooth discovery, Cocoa throws signals for all kinds of stuff -- and catch it.

Cocoa requires some initialization stuff (creating an allocation pool) that nothing else in TGE needs, so I'll probably switch the code to Carbon. I hope to make a more abstract bluetooth library that can be implemented on both platforms. Unless I get lots of free time, I'll leave the Windows implementation to somebody else. You windows guys are always leaving us Mac guys hanging on implementation of fun stuff, so now it's payback time. ;)

And I've got to get our TGB game finished. This freelancing from the project milestones is going to get me in trouble.
#20
12/15/2006 (6:28 am)
Very Cool
Page «Previous 1 2