Escape Artist postmortem pt 1 (of 3?): Is python/pygame feasible?
Posted by johnfn (twitter: @thedayturns)
August 23rd, 2011 3:23 pm
This post is about if python and pygame is feasible for LD48. But first… an action screenshot!!
![]()
So. How good is Python/Pygame for making games?
Good parts:
- Python is a lovely language, an absolute joy to program in compared to just about anything else. It is definitely superior to any brand of ActionScript. I never got bogged down in syntax or trivialities, and bug fixing/iterating flew by.
- Programming in Vim, favorite native text editor by far*, was orders of magnitude better than being relegated to some IDE, or worse, Flash’s cobbled-together editing environment.
- I was worried that a lot of the things that I loved about the rapid development cycle in Flash would be lost in python/pygame, but I turned out to be almost completely wrong. For instance, I liked that in Flash you could just draw something and instantly have it in game, but as soon as I wrote a nice abstraction layer I had that in Pygame too. In flash I really like how you get animated sprites for free with keyframes, but that was about 5 lines in Pygame. There was some oddness about text not being multiline by default, but I managed to fix that quickly by taking some open source code. Which leads me to my next point:
- Pygame has a fairly respectable community. Every time I have encountered a bug (so far), I have managed to fix it just with a simple Google search.
Bad parts:
- One big missing thing from pygame is the wealth of neat filers and effects in Flash. I really wanted to do some nice TV static or something over my game, and make some stuff glow, but I was simply incapable, and I felt like in general my graphics were a bit worse than they could have been in Flash.
- Another really nice thing in Flash: Tweens. And then even better is the open source Tweener library for AS3 which does a lot of really slick transitions and effects. I hand coded these in Escape Artist, and Flash could have saved me some time.
- Now for the absolute worst part about python/pygame: porting. Turns out not too many people are excited about taking your raw source code and compiling it. py2exe and py2app are the standard for Windows and Mac porting, respectively, but it was still really hard to get them set up, and in fact I’m hearing reports of really obscure crashes in the Mac port – something that I’ve never encountered in my Ubuntu testing.
- It actually took about 24 hours to port, which was really sad for me since it (understandably) got no votes during that period
So, is Python/pygame viable for Ludum Dare? Sure – if you plan out how to port beforehand.
Now that you’ve read my postmortem (the first part, anyway), you should go play my game! Tell me what you think.
* If you have never heard of Vim or Emacs, you absolutely must try them out. They have a steep learning curve, but you’ll soon be flying through code like you’ve never done before.
Tags: postmortem
Cool, I also used pygame for my game! I think your comments are mostly right on. I don’t know Flash, though, so it’s harder for me to compare. You’re right that porting is the biggest pain, especially since I usually run Ubuntu, and I find Windows so hard to use by comparison.
I’m pretty satisfied handling transitions and effects by hand, but if you’re interested, there are a couple common libraries that might make that easier if you feel like learning them. You might have seen this resource already, but if not, here’s a listing:
http://wiki.python.org/moin/PythonGameLibraries
+1 for Ubuntu dev – that’s where I live too
The Tweener library in Flash is really a helpful thing. You just say “object X, i want you to move from here to here, take this long, and ease in/out/whatever”. Then suddenly you have nice tactile buttons that grow bigger on mouse over, or patrolling enemies, or anything. Things with motion suddenly become so easy, and you wonder how you did it before.
Thanks for the link – I’ll definitely check that out.
Yep that’s cool, you definitely won’t get anything as smooth as the Flash capabilities with pygame. Hopefully some of the options would make things slightly easier, though.
My first ludum dare entry (8 months back) was also with Python/Pygame, and I can relate to the porting problem. I gave up on using py2exe and py2app though, and instead went for pyinstaller : http://www.pyinstaller.org/
Nice thing about it is that you can have a single installer script for Linux, windows and Mac OS. Saves a bit of time, and it works great with pygame.
I can’t really comment on the differences with Flash, but your first comment echoes my own feelings : coding in Python is very smooth, and it’s great how the language just “gets out of the way” and let you put things together really quickly!
(Also, congrats on finishing
)