I attended Adam Pletcher’s GDC talk on Python at GDC this year. Before I attended the talk I’d only just heard of Python and I’d never tried using it in a production environment. In his talk, Adam did a great job showing just how useful Python can be, so I determined to start learning it. Upon returning from GDC, I spent about a week with the Python docs and with the helpful samples that Adam wrote. Then I started writing my own tools to help us on our project.
I’m sure there are lots of others out there with similar stories, so I started this thread so we can share our successes and talk about all of the time that Python has saved us in production. Here’s what I’m using it for:
Our animated characters use hundreds of animations, and each character has it’s own set. Not only that, but each animation also has a mark-up data file that goes along with it. That translates into thousands of assets to keep track of. I use Python to quickly build a list of all of the animations that are actually implemented and being used in the game. With that list, I can then compare the files in each animation directory to see if characters are missing animations, and to see if the dir contains anim files that haven’t been implemented yet. My Python scripts automatically find and repair animations that are missing, move unused animations to a separate folder, and check things in and out of our resource control library. I just click a couple of buttons on my script’s UI and in a few minutes our animation directories are sparkling clean.
Another script that I’ve written generates reports of animations that are missing for a particular character. That way, the animators always know exactly what has been done and what is still left to do.
Anyway - I’m hooked on how useful the language is. If you’re a TA, you really need to check it out.
Ok, now it’s your turn. Tell us about what cool stuff you’re doing with Python!
Great topic, I’ve been a python developer myself for quite a while and am pretty happy to see that it’s become more widely embraced. I have a few projects in the work, probably the biggest one is using Python .NET and Maya to access managed assemblies within Maya. Getting it up and running was the easy part, now it’s just seeing what kind of cool stuff you can do with it. My other project is porting all the plug-ins from the Complete Maya Programming books to Python just as a learning aid for anyone who might be interested. Fun for the whole family!
I wrote a simple python script to take any given directory, create a list of the meshes within that directory, and put the list in a format that can be loaded into the editor for our project. It’s pretty simple and I’m sure it could’ve been done in C++ fairly easily as well, but since I did it in python I thought I’d share it here. It’s been pretty useful so far, and really saves time versus listing them out by hand (especially considering sometimes the meshes to be listed ran into the hundreds).
I used Python to write a visual editing tool for a group of XML style files that we use to define many environmental settings in our game. These settings include stuff like, sky color, cloud color, front\back light color, fog\haze color, fog\haze depth, weather stages and about 50+ more settings.
Originally, the artist in charge of editing these settings would have to use an in-house tool that parsed these XML files and created on-the-fly UI elements for each setting. These UI elements were displayed in a top down fashion making it hard to navigate the UI because of the sheer amount of UI controllers that needed to be scrolled up\down in the tool’s window. Once an artist changed some settings, they had to go thru a sequence of steps to update the game to display the new setting, sometimes restarting the game. This of course was time consuming as it could take up to 5 minutes to see the changes.
The artists asked for a tool that laid out only what was important too them in a user friendly and easier to navigate UI. While creating the tool, I worked with a programmer to have him update a back end game feature that constantly checked for changes to these special files and updated the game with the new settings. The result was a much easier to use tool, that updated the game almost instantly (5 – 20 second delay). Over the life-span of the tool, I would constantly update it as new features were added to the game. The great thing about Python is no need to compile the program. I can easily check the file out of Perforce, make some changes to fix a simple and quick bug and have the artist sync the changes and be working again in a matter of minutes. In the end, I think the tool and process used to design, create and maintain this tool was a success for me and the team and can be repeated for future tools.
There were defiantly some cons about the tool, but that was due to my in-experience with Python at the time I first started the tool. There are many things that I think I could do better in future, but that’s part of the learning process.