Archive for the ‘Exergaming’ Category


Exergaming FTW

September 11, 2008

Another night of updating the code, and fixing a few small bugs. After restarting the ‘Swing Recognition’ script that I wrote, I’ve had better success, but for some reason it won’t trigger if, say, you swing a Wiimote left for 45 ms.


Here is an example of the code I wrote for the Down swing.

//Swing script Sept 10

//Amount of time allowed between sequence actions
PIE.SeqReadGap = 50ms

//Amount of accelation required for action to occur
var.AccelerationThreshold = 1.5

//Amount of time between a flick action
var.ActionGap = 150ms

//Amount of time to hold key press
//Used in example functionality (Delete if unused in custom functionality)
var.HoldKey = 50ms

if var.WiimoteFlick = false

//Swing Down
If Wiimote.RawAccY <= -29 m per s per s and Wiimote.Roll < 45 and Wiimote.Roll > -45 then
var.WiimoteFlick = true

//Custom script functionality starts here
say “Wiimote down”
wait var.HoldKey
//Custom script functionality ends here

wait var.ActionGap
var.WiimoteFlick = false

Basically, what it does is checks to see if the Wiimote is not tilted more than 45 degrees in either direction from the face-up position, and if it’s Y Acceleration is going down (is negative). As far as I know, there is no temporal function in GlovePIE aside from detecting velocity since the last script frame. Because GlovePIE is not a linear programming language (which means, I think: it simply repeats itself over and over as fast as it can) it can’t read something like “If Wiimote does X movement, for Y amount of time, then execute Z.”


Is that correct? Do any of you programming/coding people want to comment? I’m lost with that one. I mean I’d love to figure out how to do Gesture Recognition, because then I could implement it into other programs like World of Warcraft where you have like 30 separate battle skills. So if you traced a circle shape in the air, you would use the Intercept ability (or whatever).


I don’t think you can achieve accurate gesture recognition with GlovePIE unfortunately.


Tonight I’ll work on the Diagonally Up Swings that you receive at later levels. I actually could run around Hyborea last night and do some rudimentary swings fairly effectively (albeit awkwardly), but I think if someone got used to this, it would be possible.


Obviously as I mentioned before, some things would be extremely difficult such as selling/buying at the auction house.

Off-Topic: Check out what this guy did with the Wii Balance Board! This would be pretty cool to use. Too bad it’s all in a different language.


Ok so, update from last night. I got the movement script for the Dance Pad finished. I’d really like it if you ran in place your character would move, like the video, but that would be difficult to do (I think) with a DDR pad and I don’t own a Wii Fit. Maybe I could write a script that makes your character run by jogging with a Wiimote in your pocket? Once again, any suggestions of coding/scripting would be helpful, the last time I wrote any script before this was when I was 8 on my mom’s commodore 64!

Oh yes, and I’d like to add I found this little gem on Youtube. Very interesting idea, but a treadmill is kind of expensive and takes up a huge amount of space. Plus, what if you wanted to stop fast?