Wiimote plugin: the second coming

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Tue Oct 20, 2009 7:22 pm

Download here! Contains plugins and a test .cap. Link Updated 15. Jun 2010

Source code here!

Earlier this year I made a plugin that enables using a Wii remote in construct applications via bluetooth. Mostly it worked well but there was also issues I couldn't overcome. In addition, the Wiiuse API I used stopped being updated.

I have started again, with cleaner code and a new API, Wiiyourself. It doesn't provide as nice readily-processed data as Wiiuse but has more functionality and is still in development. I didn't reuse anything from the old plugin so it's back to square one. No extra .dll is required any more.

Requirements:
- Wii remote
- A bluetooth adapter
- Wii sensor bar or similar infrared source for pointer functionality
(two candles should work... :))

I have a cheapo Billionton bluetooth adapter. It uses the Toshiba bluetooth stack. I can't give instructions for every adapter out there but the procedure is usually similar: Hold 1+2 on your Wiimote until the lights begin to blink and tell your adapter to look for new BT devices. It's a relatively painless procedure but must be done every time you start your PC. The connect command on the plugin itself takes only a second.

This first release has support for all the remote buttons (can be used as controls) and raw data from accelerometer + IR pointer. While gesture recognition (shaking, swinging) would be nice it's not trivial.

Known issues:
- Pointer does not correct for rotation
- Values could be smoother
Also worth noting: unlike the Xbox360 pad plugin, you need to add a new Wiimote plugin for each remote. This avoids have a controller number parameter in every ACE.

(ACE list in next post)
B
2
S
1
G
3
Posts: 71
Reputation: 1,142

Post » Tue Oct 20, 2009 7:24 pm

== Actions ==

Connect (connect to the first available remote)
Disconnect
Set report level (buttons only/+accelerometer/+infrared, higher settings use more power, balance board does not use this setting)
Set rumble (on/off)
Set LEDs (1/0 for each led)
Set joystick deadzone (0.0 - 1.0, default 0.03, 1.0 would filter out everything :))
Reset weight calibration (recalibrate BB at rest)

== Conditions ==

Connected
Connection lost
Button pressed
Button down
Button released
Nunchuk connected
Is balance board (checks if this remote is actually a BB)

== Expressions ==

Pitch (In degrees -180 to 180)
Roll (In degrees, -90 to 90, 0 is level, remote can't detect upside-down)
Orientation X
Orientation Y
Orientation Z
Acceleration X
Acceleration Y
Acceleration Z
Battery level (percentage)
IR X (interpolated 0-1.0 from all leds)
IR Y (same as above)
IR Z (Estimated led size, very rough)
Raw IR X (led number 1-4)
Raw IR Y (led number 1-4)
IR Report level
LED status (Sensor bar led groups seen, bar has 2 but remote can track 4)
Update age (in milliseconds, if age is too much orientation data might be
unreliable)
Joystick X
Joystick Y
Nunchuk pitch
Nunchuk roll
Nunchuk acceleration X
Nunchuk acceleration Y
Nunchuk acceleration Z
Nunchuk Orientation X
Nunchuk Orientation Y
Nunchuk Orientation Z
Nunchuk Update age
Nunchuk Deadzone X
Nunchuck Deadzone Y
Total weight (in KG)
Top left weight
Top right weight
Bottom left weight
Bottom right weight
B
2
S
1
G
3
Posts: 71
Reputation: 1,142

Post » Tue Oct 20, 2009 11:11 pm

Very nice! I'm glad you switched libraries; Wiiuse was slow as Hell. Do you have any plans to implement motion plus support since this library supports it?

Keep up the good work. :)
Moderator
B
98
S
36
G
19
Posts: 1,584
Reputation: 17,717

Post » Wed Oct 21, 2009 6:44 am

I can definitely expose the raw data from Motion Plus, though someone else has to test as I don't have a MP yet.
B
2
S
1
G
3
Posts: 71
Reputation: 1,142

Post » Wed Oct 21, 2009 10:42 am

Wow, this is awesome. I didn't try the first plugin because I didn't have a wiimote... But looking at this I'm probably gonna have to buy one just for the hell of using it in construct.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Wed Nov 11, 2009 4:18 pm

Oh man, this is really cool. :) I might have to give this a try.
B
5
G
4
Posts: 50
Reputation: 1,225

Post » Wed Nov 11, 2009 6:26 pm

nunchuck data would be awesome, also.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Thu Dec 10, 2009 7:58 pm

Brilliant, absolutely brilliant!
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Fri Dec 11, 2009 12:40 am

Hi, is it possible that someone would write a tutorial or walk through for this. It sounds really good... But it would be much easier if there was some sort of an example with explanation or tutorial how to use it in game. Many thanks if anyone will write it.
B
4
S
1
G
3
Posts: 85
Reputation: 1,234

Post » Fri Dec 11, 2009 12:57 am

[quote="Maciej":1rjumggj]Hi, is it possible that someone would write a tutorial or walk through for this. It sounds really good... But it would be much easier if there was some sort of an example with explanation or tutorial how to use it in game. Many thanks if anyone will write it.[/quote:1rjumggj]

There is an example included, which shows how it all works.
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Next

Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 0 guests