Sunday, 21 June 2015

Play computer games through android wear using Magneto

I recently wrote an article called "Magneto = Gyroscope + Accelerometer + Geomagnetometer" where in I explained how to use Gyroscope, Accelerometer and Geomagnetometer to map your movements to mouse movements. In this article I will show you how to use Magneto 2.0 to play computer games using your android wear or phone.

Here is a video of me playing few computer games using my android wear

How to use it?


Unfortunately, I haven't made a simple way to do this YET. And this is available only for Linux and Mac. If you wan't to give a try you will have to follow all these steps. I am assuming that you have ADT setup.

Download Magneto apk

For android wear:
  1. Enable developer options on your android wear and turn on USB debugging. See this to see how to enable bluetooth debugging for your watch.
  2. After you are successfully able to connect to your watch from your computer, install the apk.
    adb install [location to the apk]
  3. You are done. Now go ahead and open it on your wear

For android phone:
  1. Enable developer options on your android device and turn on USB debugging or ADB over wifi.
  2. Install the apk like any other.
  3. You are done. Now go ahead and open it on your device.
Linux users have to install xdotool:

Ubuntu/ Debian users
sudo apt-get install xdotool
Fedora users
sudo yum install xdotool
Arch users
sudo packman -S install xdotool

Start Magneto on computer

Download this shell script and run it.

For android wear and linux
./nav -lw
For android wear and OS X
./nav -ow
For android phone and linux
./nav -lp
For android phone and OS X
./nav -op


Calibrate what is left, right, top and bottom.
  1. Hold your device in front of the computer screen. This will be your initial position.
  2. Rotate your hand to left position and click on L. So, this will mark the region beyond it as Left. Then rotate your hand to the right and click on R. This will mark the region beyond it as Right. Similarly, do the same for Top (T) and Bottom(B)

  3. If you feel that you have to redo it, press RESET button and click on the letter. When the letter becomes L (capital L), redo Step 2.


See the video where I am playing Temple Run Online, Tetris and Pacman using my android wear!


Fork me on github

There is a lot of scope for improvement. For instance, I haven't written the navigation script for windows. Pull requests are welcome.

You might have noticed the COMMAND button. It takes voice commands from the user and sends it to the computer. I will talk about that in another article.

No comments:

Post a Comment