Marshie Attacks: Halloween Interactive Driveway Activity

UPDATE: All Laser Pointer, iSight, and even WiiMote head tracking info is now located at

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.


20 thoughts on “Marshie Attacks: Halloween Interactive Driveway Activity

  1. I should add that I’d love suggestions for games that could be played using this interface. I’m thinking Missile Command won’t take too long to implement so anything more interesting would quickly take a place on the list

  2. I heard Kip singing “I love technology” in my head the whole time I watched the video. Sweet work arJ.

  3. I have been thinking along these lines since seeing GRL’s video last year, but never really got around to it until seeing your project got me off my butt. I ended up writing a spray paint app like GRL’s.

    You mentioned having to scan only every fifth frame, I had the same problem so I wrote a quick patch to the CocoaSequenceGrabber framework, that does it in ObjC and can scan every frame pretty quickly. If you drop me an email I’d be happy to send you the patch.

    Since a spraypaint app needs more samples per second I probably notice it more, but it looks like the iSight automatically changes the FPS due to light conditions to increase exposure time, do you know if it’s possible to disable this feature?

  4. Patrik,

    I’ve responded via email, but thanks for your comments. I do not know how to manipulate the details of the iSight. All of my iSight related code resides in a hacked PySightTest and basically consists of a big loop that looks for the reddest pixel in a frame.

  5. Any chance of letting the public take a peek at the code before PyCon? I’m fairly competent in Python, but have no experience with Cocoa or Objective C, and I’m wondering how you integrate the event loops of each. For now I’m thinking of just letting the camera go off in its own Cocoa-y thread while my Pygame app gets whichever frame was captured last on each iteration of its main loop, but that seems so inelegant.

    I’m really hoping that it’s possible to grab frames from the camera without spawning an NSRunLoop.

  6. Eamon,

    I’m presenting at the Utah Python Users Group on Feb 13 and as such I need to put the project up somewhere before that. I can email you the source as it currently is and you can play with it.

  7. That would be great! I’m also happy to share with you anything that I manage to do with it. I wish I could make it up to PyCon this year, but it looks like mid-March is going to be pretty busy for me.

  8. clark,

    I have not. The closest thing I’ve done is use Java to automatically generate OO.o document files. However my brother has used Python to generate Excel files for our current project. I’ll ask what it is we’re doing there and get back to you.

  9. Hi, I am beginning to do a project in which i would like to track IR lights. I would prefer to use Python, but I am still confused about how to pull frames using PySight. Would you be willing to share your code, or applicable parts with me.

    Best regards,

  10. Jesse,

    I’m sending source to you as well as an executable. Note that the source is also embedded in the executable, right click on it to open it up.

    If you want to track IR lights you should look carefully at Nintendo’s Wiimote. There are libraries on Mac, Linux, and Windows for the Wiimote. I purchased one (without a Wii) and it works great on my Mac and I can control my missle command game with it, without having modified the game (which is currently mouse controlled) at all.

Comments are closed.