I do a lot of my game prototyping in python. I love python. It is a beautiful, flexible, elegant language, it's quick to get things up and running in, and it has several libraries which are perfect for game making, with active communities working to make them even more awesome, every day. Sometimes it is amazing how close to home the members of these communities can be...
On and off over the past few weeks I have been rewriting an old game prototyping engine I wrote, which was built on top of pygame, an SDL based gamedev library. For snappier, blisteringly fast action, I have moved pretty much all the core code over to the OpenGL based pyglet, and a sprite rendering library called rabbyt. The end result has been much cleaner code that I am much prouder of, and significantly better framerates. An order of magnitude better.
Whilst there are some similarities, pygame and pyglet are structured very differently, which has meant a lot of my systems had to be stubbed out until I learned how to implement them in pyglet. It was a while before I got sound working again, and it was even longer before I cold implement my animation system. Last night, I decided to have a crack at joysticks.
I dived into the documentation to look for the API for the joystick module, but it didn't seem to be referenced. I did a search for joystick: No Dice. I went into the source and grepped for joystick - zero results. I took a few deep breaths and reminded myself that others must have come across this problem, and the Internet would help me. It had never failed me before.
There was some curious code on the pyglet svn repository site, which had an example, referencing joystick functionality in an 'input' module, which my pyglet installation (the recent 1.13 release) didn't have. My excitement was palpable as I checked out and installed the development version and fired up the example joystick demonstration, anticipating some sort of delicious operability.
I got nothing. It didn't work - at least not on my Ubuntu linux laptop. Maybe the code could coerce some sort of Windows machine to extract the signals from my gamepad, but for now I was stuck. I pressed on with my Internet search. There must be someone on the planet who has managed to get pyglet and joysticks talking. A python version of Henry Kissinger.
It turns out there was, and the interesting thing is that I already knew him. Simon Wittber (of Gamejam fame) wrote some code last year that does exactly what I want, and at the time he wrote it we were working together at the same job, in the same building, on the same project. A bit of joystick code is arguably a small thing, but I felt it was a real testament to the amazing gamedev community we have here in Perth: tight knit and supportive, brimming with talent and knowledge. I'll thank Simon when I next see him, doubtless at one of the upcoming Perth gamedev scene events.





I have a related story
I wrote a simple quick game for my job application at Interzone Games over 2 years ago. I wanted to use python because I knew they were using python at IZ. I wanted to do some basic 3D so I happened apon a simple python GL library called pyGL. Months later I found out it was written by a now-collegue, you guessed it folks, Simon again. /thanks
Cool, glad you found it
Cool, glad you found it useful.
-Sw.