03.21.08

wiiPong (or, how to make a crappy games from exciting technology)

Posted in shiny, technology at 7:04 pm by coldclimate

I bought a wiiMote a little while ago because, well, they looked fun.  No other real reason.  Here’s how I got it up and running with my favorite programming environment, processing.org

Firstly, you need to make your laptop have “blue teeth” luckily my iBook came with these coloured nashers, which I’ve not really used and now wouldn’t be without.  The wiiMote talks via these blue teeth to the iBook, so long as it has something to connect to.

Step in Darwiin, which is a wiiMote client. Install it, turn on the teeth, and press 1 and 2 togehter on the wiiMote and it just connects.  Wave the wiiMote around in the air and you’ll see the wavey coloured lines representing it’s 3D velocity.  It just works out of the box, which is nice.

There is a Darwiin version which rolls in OSC.   OpenSoundControl is a protocol for communicating with devices.  One nice feature is communication via TCP/IP, so a device can be connected to one machine and controlling another.

This also means that if you get a library that talks OSC, it can communicate with devices it cannot natively speak to, and such is the way with processing.  Get the OSCP5 library and processing can now commuicate with Darwiin.

So far so good.  Add in the WiiController class (included in the oscp5 download), and you’re ready to rock (and roll, lets not forget pitch control).  Now you can access what the wiiMote is doing simply with wiiController.x, wiiController.y, and wiiController.pitch.

This was a good start, but moving a dot around the screen wasn’t that exciting. Poing however, now there is an adrenaline rush.  So, crack open the collision detection, switch all the mouseY’s for wiiController.pitch (with a scaling factor) and bobs you uncle, you have wiiPong.

Leave a Comment