About johnfn (twitter: @thedayturns)
johnfn's Trophies
johnfn's Archive
Escape Artist postmortem pt 1 (of 3?): Is python/pygame feasible?
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
Pygame Programmers!
How the heck are the pygame users among us planning to port your game to all platforms?
I’ve been trying with py2exe and py2app and having absolutely no luck; I’ve been seeing crashes everywhere. Any tips?
End of the First Day. 42 hours remain.
It’s the end of the first day, and I’m pleasantly surprised by how development has gone so far, especially considering pygame is something I’ve essentially never touched before.
My game has stuff like
- Decent collision detection
- Maps
- Patrolling enemies
- Dialog
- Super top secret gameplay element (not really, you can go play it on github if you want)
- Open source github repo https://github.com/johnfn/ld21
I’M IN!
After flirting briefly with Clojure, I’ve decided to be a little safer and do Python.
Here’s some code I’m declaring: http://www.megaupload.com/?d=RARFRZ6Z It’s a simple game engine on top of Pygame.
Tools I’ll be using:
- Python and pygame. I haven’t really used them before, so this ought to be interesting.
- Vim. All vim, all the time.
- Graphics Gale. To make the pixels. ALL OF THE PIXELS.
- FL Studio. For gorgeous background music. Or decent background music. Or…yeah.
- Maybe I’ll try my hand at sfxr. Didn’t have time last time but… yeah, we’ll see.
Watch me develop!
Here’s my repository. I’m coding in Clojure, which is going to be…interesting.
I have no idea what I’m doing with the theme yet. This is extreme writer’s block. According to the repository, it has something to do with a block moving around…
MiniLD! MiniLD! MiniLD!
A solicitation for help.
I’m thinking about doing the upcoming MiniLD. Yay! And I’m thinking of doing it in Clojure, a language I barely know. Anybody experienced out there want to chat about Lisp gamedev? Hit me up at johnfn at gmail. I’m particularly interested in how game state is conventionally kept in what is almost uniformly a stateless language. But any other tips or clues would be greatly appreciated. Clojure is shockingly different from the other languages I’ve used.
The Dreamer postmortem (and timelapse!)
So the Dare is over!
(It’s been over for a while, aye, but I was kinda dazed, and I started playing other people’s games for a while to restore myself.)
I think that this is where I mention the major problems that I had. But I really feel like I lucked out this time, because the creation went off without major hitches, and I even managed to adhere to a schedule (!!!)
Still, some notes:
- I’m still not exactly sure what kind of starter code we’re allowed to have. My starting code put me at about the same level as Flixel (but without map support), but that still disadvantages us to people who use things like game maker and get stuff like map support and room support built in. I don’t think I had all of that until halfway in!
- This was the best I’ve done with abstraction, I think (at least up until the last few hours where I was just cramming in fixes). It really paid off, too – the latter half of development was relatively breezy.
- I was insanely productive. This kind of game usually would take me around 2 weeks to make.
I’ll stop patting myself on the back now:
- My biggest problem by far was the lack of a good map editor. If you look at the timelapse, you might notice that it took me something ridiculous like an hour or so to develop a single map. Going back to make changes (of which I had to do several times) took a while too. Editing the raw data in Flash was atrocious because Flash just dies with that much text – I eventually switched to FlashDevelop, which is lightning fast. The good news out of all of this is that I have finally discovered how to solve this problem, and with it, another problem that I’ve wondered about for ages. Essentially, the tile editor must handle ALL of the output. My current setup was just outputing the raw map data, which I had to put into a class and hook up with exits to other rooms (which later led to nasty bugs). Editing maps and writing code should be completely separate activities. I really wish I could have made a more expansive world, and perhaps played around with the alternate world idea a little more. Ah well. I’ll be taking a few days to make my tile editor better (again)
- I never made a sprite for the main character and eventually just had a stupid smiling pixel. I need to learn how to do art better. I did some tilesetting a few months ago, but I never made characters. This needs to change.
- I didn’t have any animated things. I wanted to make the flowers move around, for instance, but I was preoccupied with other things, and worse, I wasn’t sure I knew how. Now, come to think about it, it’s not that hard, but it requires some more abstraction (yay!)
- The worst bugs in the game were related to collision detection and map transitions, two things that I should have (and could have) done before the Dare. Next time!
All in all, LD was a good experience. Makes me wish I could work at that efficiency all the time…
Halfway or so!
Yup, it’s your stereotypical discovering platformer!
What do I have so far?
- A working engine!
- 1 sided dialog!
- A power up!
- Lame pixely graphics!
- A soundtrack!
- You can jump!
- A screenshot!

- Insightful dialogue! (Obviously!)
- Yeah!
What don’t I have so far?
- Hopefully less than 50% of the finished product!
- Levels!
- Sufficient amounts of sleep!
Declaring some code
This is essentially the collision and camera code that flixel gives you, without flixel. If you have an allergic reaction to flixel, this could alleviate your pain.
http://www.mediafire.com/?8s233o16y181868
Oh man Ludum Dare!
This is my first time doing a Ludum Dare, but not my first time doing a 48 hour contest. I really thrive on competition, so I’m expecting to have all sorts of fun!
Hardware: An old ASUS laptop… ah, my best friend. And a mouse. Sadly, my external monitor is back at college. Ah well
Development: Flash for sure. I started learning Flixel the other day, so I’ll probably end up using that. I could also end up getting really frustrated with the dumb thing and just doing it all myself (I’ve come dangerously close already!
. Course the other (huge) advantage of Flixel is that you get to use FlashDevelop exclusively, which is orders of magnitude better than plain old Flash (kinda embarrassing for Adobe, imo). I’ve been working on an old tile editor I made recently, trying to bring it up to speed so I can use it over the competition. It’s here if anyone is interested in using it or hacking on it. I can’t imagine why you would want to, though (it’s pretty far from a generally usable state).
Art: Probably some lame pixel editor. Graphics Gale looks promising. I’ll have to get around to learning how to use it sometime before the competition…
Sound: FL Studio. I hear a lot of talk about sfxr, so maybe that too.
Not sure if I should team for the Jam or go solo for the Dare. Anyone out there have thoughts? Was thinking about Jamming initially, but I would like to have people vote on my submission, and 72h seems a bit of a slog compared to 48.
Good luck, everyone!


