Search within Lanny's blog:


Leave me comments so I know people are actually reading my blogs! Thanks!

Friday, March 27, 2009

Kung Fu Tetris with Kinect and FAAST -- How To Tutorial

[Ignore the date stamp. I just have a lot of blogging to make up for...]

I love Kung Fu; I am very passionate about Artificial Intelligence; and I like playing the game of tetris. What happens if I put all three things together?

Here, I proudly present to you: Kung Fu Tetris!


If you can't view the video above, try this or this or this or download video here.

So what do you think? If you think this is fun and want to do it in your home, read on. It's probably much simpler than you expected. In this blog post I will explain to you step-by-step how you can set this up yourself. Everything is pretty much off-the-shelf, except a small configuration file, which you can download from my blog.

Required Components:

  1. The first thing you need is a Microsoft Kinect. Microsoft developed this depth-sensing device for Xbox game console. Thanks to the open source community for writing the drivers, now you can connect it directly to your computer and there's no need for an Xbox. You can buy Kinect from local electronics stores or order it from Amazon for $139. And if you are a student like me, you can get it shipped to you in two days for free.
     
  2. You also need to have a computer to connect Kinect too. It can be your desktop computer or your laptop computer, as long as it has a USB port. I used an Acer Aspire One netbook, which I bought for $179. Even with a netbook's slow processor and limited memory, Kinect runs just fine.
     
  3. It also helps if you have a large TV/monitor, so you can see the game better while not standing next to the monitor. Most large screen LCD TVs let's you connect your computer to it like it's an external monitor. I used a VGA to VGA cable (just like connecting to a regular LCD monitor) and set the LCD to RGB mode. Your miles may vary.
     
  4. Next thing you need is a bit of space in front of the TV/monitor. Because the game of Kung Fu Tetris requires the tracking of your full body, you have to stay a good distance away from Kinect so it can cover your entire body. Besides, I am sure you don't want to accidentally smash your nice TV with your fierce kicks. So a living room is a better environment than your study.
     
  5. You also need the tetris game to run on your computer. I just use free online flash version of the tetris game.
     
  6. In order to use Kinect with your computer, you need to install the Kinect driver and the following three Open Source Applications: OpenNI, NITE, and FAAST.
     
  7. Lastly, you need to create a small configuration file for the keyboard command and body gesture mapping. You can just download my version.
     

Step-By-Step Instructions:

1. Buy Kinect if you don't already have it. Amazon sells it for $130. No need to buy Xbox.
2. Connect your computer to a big monitor or TV.
3. Download and install the Kinect driver. Extract the msi file from the zip file and then double click the msi file to start the installation.
4. Download and install the latest version of OpenNI (NI stands for Natural Interaction). You can find the latest versions on this page. Unstable versions are just fine. The current latest 32-bit version v1.1.0.41 can be downloaded from this direct link. It's an msi file, so you can double click the file to install. Note that if you are running Windows 7, then you need the 64-bit version.
5. Download and install the latest version of PrimeSense NITE. You can find the latest versions on this page. Unstable versions are just fine. The current latest 32-bit version v1.3.1.5 can be downloaded from this direct link. Again, just double click the msi file to install. During NITE installation, use this free license key: 0KOIk2JeIBYClPWVnMoRKn5cdY4= when prompted.

6. Download and install the latest version of FAAST (Flexible Action and Articulated Skeleton Toolkit). You can find the latest version on this page. The current latest version 0.08 can be downloaded from this direct link. It's a zip file. All you have to do is to extract the zip file to a location on your local hard drive. Later, you just need to run the FAAST.exe file inside the folder. No other installation required.
7. Now plug the Kinect adapter into a power outlet.
8. Connect Kinect to your computer by plugging it into the USB port. You will be prompted to install three devices: Kinect Camera, Kinect Audio, and Kinect Motor. Since you have already installed the drivers, the system should automatically find the driver files for the installation. However if it fails to find the drivers, you can point to folder c:\Program Files\PrimeSense\SensorKinect\Driver\x86 (use \amd64 for 64-bit systems).
9. Sometimes the driver might not install Kinect Motor or Kinect Audio correctly. You can try the CL NUI Platform driver instead. The latest version can be found on this page. The current latest version v1.0.1210 can be downloaded from this direct link. The file is an exe file so you just have to double click to install. Drivers are installed to this folder c:\Program Files\Code Laboratories\CL NUI Platform\Driver.
10. Test if Kinect is working correctly by running the NiViewer program inside All Programs - OpenNI - Samples - NiViewer.
11. Open FAAST by running the FAAST.exe file. Click the Connect button to start the device. You should now see human shapes on screen.
12. Stand in front of the Kinect device and then hold a ‘Psi’ pose for several seconds until a stick figure appears, as shown in the image on the right.
13. Open a browser window and position it so it is side-by-side next to the FAAST application. Load the tetris game by going here (or here). I linked the flash file directly so you don't have to deal with the annoying flash ads on those web sites.
14. Right-click and then select save to download my configuration file from http://www.lannyland.com/download/KungFuTetris.cfg, and save it to a location you remember (such as your desktop).
14. In FAAST application, click Load button and then browse to where you saved the configuration file and load that file.
15. Click Start Emulator button, then select your tetris game so your browser is the active window. You might have to recalibrate by doing that ‘Psi’ pose again.
16. Start the tetris game and then start kicking. See if you can move the pieces. Remember the controls are: 1) front kicks rotate the pieces 2) side kicks move the pieces left or right 3) jump does fast drop.

Be aware:

1. Do your warm up routines before playing this game. I AM SERIOUS! Otherwise you risk injuring yourself.
2. Don't stand too close to anybody/thing, because you might kick that body/thing and cause damage to him/her/it.
3. Kick with good speed and good form, otherwise weird things might happen.
4. Jump sometimes doesn't work too well. Just jump more. It's good for your heart.

That's it! Leave some comments if you find this helpful. Hope you get it working and start kicking! Enjoy!!


Disclaimer: I will not be held responsible if you
1) smash your TV/monitor with your fierce kicks,
2) injure yourself because of excessive or improper kicking,
3) become so addicted that you stop doing your share of the housework and irritate your better half, or
4) develop a habitual involuntary kicking syndrome and find yourself always throwing kicks at people near you.

By the way, the Chinese character on the back of my t-shirt is Tao, as in Taoism, meaning the way of life. So here's the Tao of the day:







Workout should be fun and enjoyable instead of torturous.
And playing tetris can be productive too!






Videos of the Day:

I thought these two videos are very appropriate for today's Videos of the Day! You really have to finish watching the first video to really appreciate the humor in the second one.

The original Wii Fit Ad

The Wii Fit Parody

10 comments:

  1. wow!
    very interesting!

    ReplyDelete
  2. Anonymous1:07 AM

    We here in Germany cannot watch the first video because the music label from UMG is not allowed. The Video just shows "This video contains content from UMG. It is not allowed in your country".

    ReplyDelete
  3. I don't know how the copyright laws work in Germany. This is clearly fair use in the US. Anyway, here are three alternative options:
    1. Someone uploaded the video to a Netherland domain: http://www.zie.nl/video//m1gz55uf8eg2
    2. I've uploaded the video to Vimeo at: http://vimeo.com/23948994
    3. You can download the video directly here: http://www.lannyland.com/download/KungFuTetrisHiRes.mpg

    Enjoy!

    ReplyDelete
  4. Anonymous10:57 PM

    This comment has been removed by a blog administrator.

    ReplyDelete
  5. Anonymous3:55 PM

    This comment has been removed by a blog administrator.

    ReplyDelete
  6. Anonymous3:59 PM

    This comment has been removed by a blog administrator.

    ReplyDelete
  7. Anonymous9:29 AM

    This comment has been removed by a blog administrator.

    ReplyDelete
  8. Anonymous9:59 AM

    This comment has been removed by a blog administrator.

    ReplyDelete
  9. Anonymous10:23 AM

    This comment has been removed by a blog administrator.

    ReplyDelete
  10. Anonymous11:41 AM

    This comment has been removed by a blog administrator.

    ReplyDelete