UPDATE: All Laser Pointer, iSight, and even WiiMote head tracking info is now located at InsightVR.com.
This was the scene in our driveway yesterday evening. It took a few weeks worth of spare time to hack it together but I think the result was worthwhile.
We had our first ever interactive Halloween, with a queen sized sheet hanging in our garage as a rather large screen and a video game projected onto it. Players got to shoot Marshie with real lasers in order to earn their candy.There are a few sources of inspiration for this project. The first was the Graffiti Research Lab’s L.A.S.E.R. Tag project. This got me thinking about things that one might do with a computer, laser, camera, and projector. While drawing is cool, a game might be even more fun.
The next was that my brother Matt has been bugging me to learn the Python programming language for a while now. I figured that a side project might be the best way to get into the language and when I discovered that there was a project call PySight that gave access to my Mac laptop’s iSight camera it was clear that I was going to be in the market for laser pointers.
Finally, I used the Miro media player (which I highly recommend) to download some HomestarRunner cartoons for my kids. Purely by accident the Malloween cartoon was downloaded and it became a hit with the kids. So I decided to make a game with a Malloween theme in which you shoot Marshie with a laser in order to kill him. Because honestly, who doesn’t want to shoot Marshie?
So I began experimenting with Python and PySight in order to see what I could do with the camera. Scanning each frame for the laser was too slow, so it only scans every fifth frame. Once I had it consistently working it was time to write the game part. Being new to Python I enlisted my brother Matt who suggested modifying one of the demos that came with PyGame. So we picked the Aliens demo and began ripping it apart to suit our needs.
The cleverest thing that it does which the YouTube clip does not show is a auto-calibration step. The game blanks the screen and then shows a red dot in each corner. The camera captures the location of these dots and then uses that information to translate the laser location from camera coordinates to game coordinates. So you don’t have to line up the camera very carefully at all. Just make sure that it can see all of the screen (I usually check in Apple’s PhotoBooth application) and then run the game and press ‘C’ to calibrate.
The larger gun is just a bunch of PVC pipe and connectors from Home Depot with a laser pointer shoved in it. The button on the pointer is taped down so it is always on and I put a new button on the trigger area of the gun and wired it to the laser pointer.
I also had a second, unmodified pointer which people also used for a two player mode. One interesting aspect of the game is that the lasers are not connected to the system in the way traditional controllers are. So adding more players doesn’t require any coding, it just requires more lasers.
The game has several shortcomings. Right now there is no real end to the game, you just shoot (or don’t shoot) things coming down the screen. Also, it is pretty easy. I would like to modify it so that you can choose at the start by shooting either the left o right side of the screen whether you want to play Marshie Attacks or Missile Command. It seems to me that Missile Command would be both challenging and appealing in this format. Also, the crappy Radio Shack switch used for the trigger on the laser rifle kept getting stuck in the on mode. Which is better than the off mode, but still annoying.
As for the reaction, both kids and adults coming by for trick or treating really liked it. Some families came by twice, not for more candy, but to play the game again. At times we had a line 20 people long waiting to play. One set of brothers stayed for 15 minutes while their dad begged them to leave. It went off better than I had expected and I plan to have a bigger, better game ready for next year. Also, if I ever get the code into an acceptable state I’ll post it all as an open source project at some point.
At this point I’d like to thank my brother Matt for pushing me to learn Python and for helping out both with the coding and with the graphics for this project. He has posted on it as well at his blog.