Using Javascript to control the Nintendo Wii

The Nintendo Wii was released around the end of 2006. That’s a solid four years now; an amazing amount of time in the lifespan of a technological device these days. Often overlooked is the fact that the Wii has a web browser, which is in fact a build of Opera, offering support for canvas, CSS3, and more advanced aspects of HTML5. This should be incredible; why does nobody develop more for it?

The Ugly Truth

The chief portion is the target market; with so many internet enabled devices laying around these days, the Wii’s browsing experience is one that tends to fall a little short. This was further compounded by a small incident wherein, once the Wii’s browser was released, an article went up on Opera’s official website about responding to Wii remote commands in Javascript – Nintendo later demanded that they take it down, and to this date I’ve never seen any official reasoning put forth by either company.

With that said, I don’t think the Wii (and the browser therein) are 100% lost potential. One of my goals in life is to examine and improve the methods with which we teach programming to children, and I believe the Wii can work very well for these purposes. Typically, young children don’t have their own computers, and from what I’ve found the recurring issue here is that when they’re using their parents computers, they don’t have creative freedom to do something that carries with it the idea of being possibly “destructive”.

The Wii, on the other hand, is generally thought of as the “kids” device – it has a limited set of functionality that kids grasp pretty well right off the bat, and coupled with the concept of “ownership” they’d get out of this device it stands to reason they’re more likely to experiment on it.

There used to be various Wii javascript libraries/SDKs laying around, but most of them are woefully incomplete or no longer available. So with that all in mind, I set out to build a library that allows simple, easy, event-based interaction with the Wii’s browser, hiding away the somewhat insane complexities of reading the remote codes.

Enter: wii-js

You can check out wii-js over on GitHub; it’s entirely open source and released under an MIT-style license. While the repository has in-depth documentation of library usage, check out the example below and see how simple this has become:

This example showcases how to set up basic controller instances, and respond to events that they fire. Most button combinations are supported (check the docs on GitHub for up-to-date event listings), but sadly this library can only work with the actual Wii-remote. Nintendo (or Opera, it’s unknown who) opted not to provide controller mappings for anything else, be it classic controllers or Gamecube controllers. All Wii remote instances, with the exception of the first one, can get controller events from the nunchuk; there doesn’t appear to be a way around this, which is nothing short of a shame.

That said, even with these limitations, it remains a pretty versatile library. The next steps for it are bundling in some basic sound/game engine support to make it even easier for kids to jump in and create. Follow the project on GitHub to see updates!

A Note About Performance

Sadly, the Wii isn’t the most performant device. It has significantly less memory than most devices on the market today; due to this, it’s possible to get under-performant pretty quickly. While it does support the canvas element, it appears you can’t force a repaint any faster than in 100ms intervals – anything lower and the Wii begins to choke repeatedly. This isn’t really fast enough for games; canvas may be useful for other techniques, but for the most part any game engine that’s done outside of Flash needs to be using HTML or SVG. SVG seems promising in recent tests, and it has a side benefit of reacting to DOM events like HTML based scenarios do.

Opera on the Wii also appears to have some level of support for Server-Sent Events, which could possibly prove useful for enabling lightweight two player interaction. The performance considerations here are currently unknown at this time.

The Future

Nintendo recently announced their new console, the Wii U. Whether it will keep the Opera web browser is anyone’s guess; it’s worth noting that the new 3DS replaced the Opera browser used on previous DS incarnations with an engine similar to that of the PSP. There aren’t too many usage metrics which we can use to draw predictions from, either, so at the moment it’s a bit of “wait and see”.

I’m going to continue developing the library and concepts surrounding it during my free time, and ideally want to try teaching a small class or two once I’ve further refined it. If you’re interested in helping out, fork away on GitHub!

Tags: , ,

8 Responses to “Using Javascript to control the Nintendo Wii”

  1. [...] Read th&#1077 original: Using Javascript t&#959 control th&#1077 Nintendo Wii « Veno Designs [...]

  2. [...] Reading: Using Javascript to control the Nintendo Wii « Veno Designs This entry was posted in Uncategorized and tagged author, im-ryan-mcgrath, nintendo, open-source, [...]

  3. [...] the article here: Using Javascript to control the Nintendo Wii « Veno Designs This entry was posted in Uncategorized, Wii and tagged fact, the-fact, years. Bookmark the [...]

  4. very cool & good tutorial, thank you very much for sharing.

    Can I share this post on my JavaScript library?

    Awaiting your response. Thank

  5. Jony says:

    This lybrary still work? I open with Opera and don’t do nothing :(

  6. Ryan says:

    It should still work, yep. What are you seeing doesn’t work?

  7. Jony says:

    I don’t know if i am doing good, i connect my wiimote in computer by bluetooth. Then i open index.html with opera or other browser and nothing happened.

  8. Jony says:

    I open your library with google Chrome or other browser and still doesn’t work.
    On browser, i open error console to see the report , and show this :
    ————————————————————————————-
    Uncaught ReferenceError: Wii is not defined venodesigns.net:30
    (anonymous function) venodesigns.net:30
    document complete plugininjection.js:48
    Plugin embedded plugininjection.js:38
    Content script received 2: http://venodesigns.net/wii/
    ————————————————————————————-
    Can you help me with this problem ? What i need to do, to see your library working?
    I still wait for response.

Leave a Reply