WiiCade Labs
WiiCade Home | Forums | Blog
Home
Wii Remote API
Overview
Download
Documentation
F.A.Q.
Multiplayer API
Overview
Download
Documentation

Frequently Asked Questions

1. Technical

1.1. What features are supported by the API?
1.2. What features are not supported by the API?
1.3. How do I use the API with my project?
1.4. I heard that there was support for the Nunchuk attachment?
1.5. onClipEvent doesn't work! What can I use instead?
1.6. What is the difference between the Client API and Server Components?
1.7. What is the WiiCade sandbox?
1.8. I'm using the Javascript API and Events don't fire!

2. Licensing

2.1. Can I get the source code?
2.2. What license is the code under?
2.3. What does the LGPL mean by a "suitable shared library mechanism"?
2.4. Is it possible to license the code under a non-GPL license?

2. Miscellaneous

3.1. Who wrote the WiiCade API?
3.2. Who is Mario Klingemann of Quasimondo?

1.1. What Features are supported by the API?

A: The API supports:

Motion sensing is only supported through the IR Sensors on the remote.

1.2. What Features are not supported by the API?

A: The API does not currently support the accelerometers of the remote. In simple terms, this means that the API cannot provide motion information when the remote is facing away from the screen. The API is also incapable of providing support for controller attachments, with the exception of limited support for the Nunchuk. (See: 1.4)

1.3. How do I use the API with my project?

A: Before you begin, you will need to download the Client API zip archive. This archive needs to be extracted into the exact same directory as your Flash FLA file. You will need to extract the archive for each movie you wish to work on.

Once the code is extracted, you're ready to begin modifying your Flash movie. The first step is to place the following statement at the top of each code file you wish to use the Wii Remote features in:

import com.wiicade.*;

For example, if you have a code file for Layer 1 Frame 1 and a separate code file for Layer 2 Frame 1, you will need to place the statement at the top of both files in the Flash Studio "Actions" editor.

Once you have the necessary import statement in your code, you can begin using the advanced features of the WiiCade Remote API. Here's an example to get you started:

import com.wiicade.*;

function onEnterFrame() {
    var remote = Wii.getPrimaryRemote();

    if(remote.isDown(WiiRemote.BUTTON_B))
    {
        var x = remote.getCursorX();
        var y = remote.getCursorY();
        //Shoot something!
    }
}


Futher information can be obtained in the documentation section and from the examples on the download page. If you have any difficulties, feel free to visit our forums and ask for help!

1.4. I heard that there was support for the Nunchuk attachment?

A: This is correct but with a few caveats. Officially, neither Nintendo nor Opera supports the Nunchuk through any published API. However, we here at WiiCade have discovered that it is possible to read the buttons on the Nunchuk through an unpublished method. This method only supports the buttons (C & Z) and only on remotes 2, 3, and 4. It is not currently possible to read the nunchuk on the remote that is browsing the site.

While this support is obviously of limited utility, we feel that it is important to provide you with any and all features that we have access to. The API is already setup to provide access to further Nunchuk features should they become available in the future.

1.5. onClipEvent doesn't work! What can I use instead?

A: The Wii browser has no concept of what a keyboard is. As a result, any events intended for keyboard activity (e.g. onClipEvent(keyDown)) will fail. Frustratingly, these events appear to work on a Desktop computer. However, they are unavailable on the Wii and should not be used.

The WiiCade API provides a replacement in the form of the WiiRemote.addEventListener function. It supports a wide variety of events, including Wii Remote button presses and releases. Here is an example: import com.wiicade.*;

//First remote
Wii.getRemote(0).addEventListener("buttondown", onButtonDown);
//Second remote
Wii.getRemote(1).addEventListener("buttondown", onButtonDown);

function onButtonDown(event)
{
    if(event.buttonCode == WiiRemote.BUTTON_B)
    {
        trace("Button B was pressed on controller "+event.identity+"!");
    }
}


Please see the documentation for more information.

1.6. What is the difference between the Client API and Server Components?

A: The Client API is the part that is important to Flash developers. It is the actual code you need to use to make your game or movie Wii compatible.

The Server Components are only needed if you're going to host a Wii game on your own website. These components need to be deployed into the same directory as the game. They will not function without a webserver, so their use during development is somewhat limited. The best option for development is to use the WiiCade sandbox.

1.7. What is the WiiCade sandbox?

A: WiiCade provides a feature that allows game developers to upload a game without sharing it out for everyone to see. This feature is known as the "sandbox". It's useful for developers who wish to test their code on a Wii, but don't want to setup their own web server to do it.

1.8. I'm using the Javascript API and Events don't fire!

A: The Javascript API updates the state of the button presses in a fashion that's different from the Actionscript API. Rather than running a loop that chews up cycles, the API updates remote values whenever you call Wii.getRemote() or Wii.getPrimaryRemote(). Unfortunately, this creates a minor problem if you do not access these functions in your program.

Add this loop to your program and the problem should go away:

function gameUpdate()
{
    for(var i=0; i<4; i++) Wii.getRemote(i);
}

setInterval("gameUpdate()", 100);

2.1. Can I get the source code?

A: Absolutely! The client API is distributed in unobfuscated source form under the terms of the LGPL license. The source to the server components required to activate the API on the Wii can be downloaded under the terms of the GPL license.

2.2. What license is the source code under?

A: The source code for the client API is distributed under the terms of the Lesser GNU Public License (LGPL). This license provides you with free access to the source code to use in your Flash programs and movies. It does not require that you give up the source to your Flash movie, but it does impose conditions intended to keep changes to the API open for all. See the text of the LGPL for more information.

The source code for the server API is distributed under the terms of the GNU Public License (GPL). This license provides you with free access to the software and source code, but requires that the source to any and all modifications or derivitive works be shrared. Please keep this in mind before making modifications to the server components. See the text of the GPL for more information.

2.3. What does the LGPL mean by a "suitable shared library mechanism"?

A: Most operating systems provide a mechanism whereby APIs can be shared in files separate from their executable programs. These are called DLLs on Windows, Frameworks on Mac OS X, and Shared Objects on Unix. Flash lacks a similar mechanism, so you may ignore this requirement for binary code.

2.4. Is it possible to license the code under a non-GPL license?

A: We understand that the GPL may not be suitable for all sites. WiiCade may be willing to establish a business relationship with your site that would allow you to use the code under terms more in line with your needs. Feel free to contact us by email if you have such a need. Please include the details of your site along with your exact licensing needs.

3.1. Who wrote the WiiCade Remote API?

A: The WiiCade Remote API was written by Jerason Banes to provide a means by which Flash programmers could target their games for the Nintendo Wii game console. His work is based on a combination of original research, information published by Nintendo and Opera, and research published by Mario Klingemann of the Quasimondo website.

3.2. Who is Mario Klingemann of Quasimondo?

A: Mario Klingemann is one of the unsung heros of the Wii homebrew movement. When it was found that information about the Wii was available through Javascript, he developed an ingenious method of communicating that information to Flash movies.

Unfortunately, Mr. Klingemann's attempts at creating an interface based on his research produced code that was beset by a variety of technical issues stemming from the Wii Internet Channel's design. As a result, his research has been mostly forgotten by the community.

However, we here at WiiCade have not forgotten his contribution and feel we owe a debt of thanks to Mr. Klingemann for his hard work in advancing the state of Wii homebrewing. We salute Mr. Klingemann and will continue to remember his efforts in the days to come!