PyCon 2008 - Day 2
Today was the second day of the PyCon 2008 conference in Chicago. There were quite a few noteworthy talks that I was able to attend. So without further ado, here is my rundown of day 2.
Keynotes:
Unfortunately I overslept and missed both the Twisted Announcement as well as the two keynotes.
Using Pygame and PySight to Create an Interactive Halloween Activity
John Harrison gave a nice demo of how he tied both Pygame and PySight together to make a kick ass Halloween game for the neighborhood kids. Using a PySight, John was able to “train” the iSight on his Mac to detect the presence of a laser pointer on a large screen (bed sheet). He did this with a rather clever algorithm. He first ran a test to check for the presence of any “red” colors (based on RGB values). Once a red caused the test to pass, he then ran an additional test that basically set the laser pointers red RGB value as the value to be used for detection in his game. He then created a rather simple PyGame where Marshie, a character from homestarrunner.com, bounced around on the screen. As users “shot” their laser pointers at Marshie the game checked for collisions. If the laser pointer collided with a part of the Marshie image, the image exploded. Pretty neat stuff! Oh yeah - he also added some sound effects for every laser shot at the screen.
Although the Marshie game was cool, the killer part of this presentation was John’s demonstration of how he created a game that uses head tracking. Using a Wii remote and a pair of safety glasses equipped with IR pointers John was able to show how he could navigate, jump and shoot through a game using nothing but his laser gun and by walking and looking around. I can’t wait for this video to hit the net so I can show everyone!
Managing Complexity (and testing)
This talk focused on code complexity, a topic I was not only unfamiliar with but one that I had never heard of. In a nutshell there are ways to determine how complex any given code is. For all code, complexity can be given a numerical value based on the number of conditions in the code at a function/method level. Any complexity rating higher than 7 indicates code that is too complex and that probably needs to be broken down.
Matt Harrison also brought up some valuable points in his presentation. He noted that in testing and development, you can only control what you measure. In other words, if you don’t do some sort of testing or validation around a certain unit of whatever you are coding, it is impossible to know or control how that given part is functioning overall. He also brought up the valid point that test coverage only tells you what you are testing. It doesn’t tell you how well you are testing. This is something that is good to keep in mind when putting together test strategies and plans. Coverage has no bearing on the quality of whatever you are developing.
Getting Started With Test Driven Development
This talk was by far the most enjoyable talk I have attended so far at this years PyCon. I have heard so much about TDD and read up on what it entails but without an overview and example it has been difficult to see the advantages of using TDD. Johnathan Hartley of Resolver Systems put it all into perspective for me. John outlined in detail all the steps of TDD with include:
- Write an acceptance test
- Start your product design
- Write a unit test (and make sure it fails - as it should)
- Start coding (finally)
- Run unit tests against code in 4
- Add more acceptance tests (unit tests)
- Integrate into build process.
It was beneficial to see here with an image re-sizer example of how this agile methodology works and how it causes developers to focus on producing code that meets ONLY the user story requirements without adding little features that could cause other stuff to break. This is also a great way to build up the unit test suite used in the build process.
Sights and Sounds with Pyglet
Going into this talk (especially after seeing the PyGame talk in the morning) I was pretty set in thinking that games should be developed using PyGame. After this talk however I can clearly see the benefits of using Pyglet, a much newer and more robust library. Richard Jones gave a nice overview of the features of Pyglet. Richard also explained the benefits of using Pyglet, which include it has no binaries, it is multiplatform, there is no compilation, and it supports many simultaneous windows and screens. Speaking from experience I have seen first hand how difficult getting everything working properly for a successful PyGame install can be, and I must say that Pyglets having no binaries/no dependencies is extremely appealing. Richard also gave a demo of a game created with Pyglet (I think it was called Delta V). This game rendered very nicely and was impressive (it was designed and coded in a week during PyWeek). I look forward to playing around with Pyglet sometime soon.
Tomorrow concludes PyCon, and there are only three sections of talks set aside (not including keynotes and lightning talks). I plan on attending the Consuming HTML talk by Ian Bicking as well as Jason Pellerin’s talk on Nose.

John Harrison said,
March 16, 2008 at 11:13 am
I’ll post video of the newer Marshie game on my blog as soon as I have some. I should have filmed some people playing it Saturday night.
I should note that the original Marshie game and the Missle Command game use PyGame. The 3d Marshie game with head tracking uses pyglet.
John Harrison said,
March 31, 2008 at 11:56 am
Dave,
As promised, I’ve posted videos of two of the laser and head tracking games on my blog:
3D Game with Head Tracking
Laser Missile Command