Python for 2D games....

Miscellaneous Forums/General Discussion/Python for 2D games....

I've been playing with Python a bit lately, mostly for other things than games, but I like the language and was curious to know if people here have used it to make 2D games. Chipmunk physics has a python binding, and both pyglet and pygames look interesting.

I know it's possible to make games with it, but I have a couple of issues:
1. Deploying the games to users who may or may not have Python installed on WinXP/Vista, OS X and Linux.
2. Performance. Python, being interpreted, is not that fast. Is it fast enough for game work.
3. Protection. It's interpreted, so anyone can get the code. Fine for open source, not so nice for a game you want to sell. I guess there are ways around this though.

I like BlitzMax, but as I'm going to be using Python more and more at work, I figured I'd look if it was a viable alternative/addition to BlitzMax.

http://www.python-ogre.org/
[edit]Personally, I absolutely hate Python.[/edit]

I never like Python but good luck for those who like it :)

1. For windows there's py2exe (somewhere on the net), and for other platforms they usually come with python but you can just include the python interpreter in the installer.

2. It's fast enough for casual games, but nothing more.

3. You can distribute just the .pyc files, which are compiled for python's virtual machine. Lots of commercial software uses python, so there must be ways of protecting your code.

Its the language they are teaching in college, for the introductory stuff at least. I think its a good language, especially for text based games and apps, but my experience with trying to make a real game with it is pretty awful... but its really easy to learn...

You can use python for 2d games. Disclaimer being I haven't done it(yet). I've set up barebones little demos, and tested the waters ever so slightly.

I ran just an empty loop in pygame, and I was getting pretty pathetic framerates( considering it was doing nothing more than clearing the screen and pumping events ) If I recall, < 60 fps( off the top of my head ).

Same goes for the few pygame games I've looked at...all of them have been jerky. But I'm not convinced its a python problem, as much as people trying to do too much "heavy lifting" in python.

I wrote a module for glfw using ctypes not to long ago, and had some little gl spritey/quad thing going. Everything being done in python. Definitely can see the performance penalty...

...Buuuuuuut, I still think that python is totally useable if you do it right. The one idea that is really appealing for me, is being able to write whole damn thing in python. And then on an as needed basis, after all the design kinks are worked out, rewrite performance critical stuff in c.

In fact, thats the system I'd really like to use right now, only under .NET with IronPython and c#. But the startup time for ironpython is HORRIBLE when you start importing lots of assemblies( Compiling small c# programs is usually faster than trying to start and run interpreted ipy programs... a royal pita if you make lots of little changes and want to see results quickly.. )

Anyways.....Python is such nice language. I can't believe I'm seeing python haters in here. You can put me on record as one of those people who absolutely, love python.

Sorry if the above is a bit incoherent ramble. I shouldn't post when I'm this sleepy.. can't keep my eyes open right now.
Gotta go to sleep.

Thanks for the replies. It was kind of what I figured. I like the little I've learnt of Python, but it's less than ideal for games. I've seen benchmarks comparing it to other languages, and generally it does poorly (worse than Perl, Java and others).

As I use php, mysql, JavaScript, shell scripting, MEL and now Python, plus reading and doing minor edits to others Perl scripts and C code at work and BlitzMax at home, it was all getting a bit much. Frequently jumping between languages I tend to mix them up and get stuff wrong. :)

BlitzMax has all my points covered pretty nicely, so I guess I'll stick with that for future games. :)