Programming in Python is fun!

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. Continue reading “Programming in Python is fun!”

Advertisements
Programming in Python is fun!

Surprizes and tools

Here’s a small image hinting at the surprize I wrote about in my last post. It’s a puzzle game, it’s almost completely finished and it includes an editor. I’ll post more info about it later, once it’s fully playable and polished.

Surprize

Meanwhile, I’m finishing up AI Wars – it’s almost done now, except for a few communication issues. I’ve also written a few additional Python tools. Since I’m painting quite a few tilemaps for Aural Fighter, I figured a few tools wouldn’t hurt. Today I added one that takes an image, asks for the desired tilesize, and outputs a serie of unique tiles as separate images. It’s using Python Imaging Library (PIL) to load, compare and save the images. It then optimizes them, using PngOptimizerCL, the command line version of PngOptimizer. The tool took me about an hour or two to create, and it’s less than 100 lines of code. And, except for the optimization phase, it’s quite fast, too. smile.gif

Surprizes and tools