Programming in Python is fun!October 10, 2008 at 5:04 pm | Posted in Game development, Programming | 4 Comments
Tags: productivity, Python, tools
The last few months I’ve been doing more and more with Python. While the games I work on are mostly written in C++, there’s still a lot of room for me to use Python. For example, when dealing with file conversions, data checking, automating processes, and so on.
Two weeks ago, I wrote a tool that packs smaller images into larger ones. I first prototyped the packing algorithm in Python and then translated it to C#, which I used for the tool itself.
Last week, within a few days, I was able to process, verify and preview almost 2000 files for one of our games, converting them from XML into a tight binary format, all packed into custom archive files to keep things easy for the file-system. I spent most of my time thinking about the file formats and the required checks. Writing the tools took little time.
Just today I set up a few automation scripts for one of our artists. I introduced him to SVN, but, considering he’s an artist, I decided to make things as easy as possible. I wrote a few batch files that took care of updating and committing the files he needs to work with, and another batch file for converting the art. That batch file calls a Python script that generates some information based on the new art, and another script that checks for new files, which are automatically added to SVN. All he has to do now is make art, click a few batch files and press a few Ok buttons.
I’ve also been using Python to prototype a collision system for a spare-time project and to solve some logic problems, as I recently discovered a site called Project Euler.net. Quite fun! Someone also pointed me at the Google Code Jam, that also contains some interesting problems. How about path-finding with portals?
In other words, I’ve come to like Python more and more. It’s still just one of several languages that I use and it’s not the best for every situation, but I do notice how much more productive I’ve become by embracing it.