Wednesday, April 28, 2010

Camera Solitaire Pong

Last weekend I attended a small game jam co-run by a friend of mine, Darren Torpey. The scene was very laid back, and the weekend was fun. I ended up playing around with the openFrameworks C++ toolkit, a multimedia framework of which I had seen a presentation about it a week before. The feature set looked nice, and it was reported to be very easy to use. It had a lot of computer vision features built in, which seemed interesting and was something I hadn't worked with before. I decided to try my hand at writing a pong app using the camera on my laptop. "Camera Solitaire Pong" is the result.

The game is a heavily simplified version of 3rd person 3d pong, whereby the player views tge game world behind their paddle. The world is represented by a boxy corridor. Normally there'd be another paddle at the other end, however I ended up cutting that feature due to time constraints. Instead, the player's goal is to hit a ball of increasing velocity as many times as possible.

Control of the paddle is done through a video camera. The app will attempt to track an object of a player-specified color. Tennis balls work ok, as do many single color objects of similar size. Ultimately I found that a piece of colored duct tape on the hand worked best, and had a good feel (IMO).

The game consists of two screens. The first is a calibration screen, whereby the player clicks on the object they wish to use. Pressing the spacebar brings the player to the second screen, the game screen.

A Mac build is available at: http://alum.wpi.edu/~davidl/Camera_Solitaire_Pong/latest_mac_build

If I get around to it, I'll try porting to Windows. The only Mac specific code in the game involves loading and saving a few variables, such as the calibrated color. I may also try and add a few features to it. I've already tweaked a few settings since the game jam, and added a title and some basic credits.

Here are some screenshots. Clicking on them should bring up larger versions.

Calibration Screen

Game Screen

A big thanks goes out to Laurence Lee, game jam attendee and Berklee College of Music student, for creating several nice sound effects for the game using one of the tennis balls I brought. Special thanks also goes out to Vickie Wu for making tasty food during the event, and to everyone involved in running things or otherwise making for what was a fun weekend!