Aug 30, 2010

Playing Pong on a Laptop Using Mobile Phones as Paddles

About a week back (while getting bored sitting in a java lab) me and Mudit were thinking of some simple project ideas to do over the weekend.So after some very wacky (when i say wacky i mean really over the top stupid) ideas we finally settled down on making pong but with a twist. We decided that instead of running it on one screen as it is usually done we will make the game area a lot larger buy using screens from various networked computers to make a very long but very awesome pong table.Next we decided to control the paddles not by using traditional keyboard keys but by making use of the accelerometer commonly available on most phones now-a-days.The idea was to control each paddle with separate phone by using the accelerometer on the phone to detect the motion of the phone and sending the data via a TCP socket over a wireless network to the computer running the game.




So we started working on the idea and after some time Mudit lost interest and gave up the idea so i went and asked Ankur (a.k.a OS) if he was interested in doing the project. He seemed pretty into the idea and so we stared first trying to narrow the choice of mobile OS we were going to use. We wanted to use android but left that as none of us actually had an android device (me having a Samsung Wave S8500 running bada OS, and Ankur having a Nokia E61i). As the E61i did not have a accelerometer we went for bada OS as the platform of development.I wrote the bada OS app part and ankur did the coding for the game running on the computer.

After some really silly mistakes like trying to load a x86 binary on an ARM architecture phone and trying to connect to a socket on another system without turning on the network we finally got something running.We were able to make a basic ping pong game using C++ and get some sort of rudimentary physics running on it.Also we were able to read the sensor values on the phone and device a simple algorithm to calculate on how to move the paddle using these values.Obviously this is in no way complete and loads still needs to be done like providing multiple monitor support and improving the paddle motion algorithm and making the sensor data error free.Here is are a few videos of the first demo.