Python Engines for 2D Games and a Lot of Problems

For all my academic works, experiments, personal projects, tests or any other problems that I can solve by writing a program, I try to use Python. Well, Python is my main language and after 6 years of experience with it, I can say that I love this language. More yet, I’m only passionate for coding today because of it. Python is an easy language to learn and to program, intuitive and clear. Everything you can do with other languages, you can do in Python with half effort and double love. It has several useful builtin libraries and a lot of epic frameworks, being used for web development, scientific computing, networking and in several other areas. But and for games?

There are several frameworks used for game development, and I will talk about some of them here. Notice that, my focus is on 2D game development and does not mention any 3D engines.

Pygame is the most known engine for Python and it is a binding for the C++ SDL 1.x. The community of Pygame is huge and there is a lot of tutorials out there, and, like SDL, Pygame is very mature and stable. The downside is, Pygame is slow as hell and provides a poor support to hardware acceleration, making it nearly impossible to run a heavy game on old computers. I feel that it is pretty hard to optimize the code and when I do it, several other problems occurs such as tearing and unstable fps. Despite the community size, Pygame is rarely updated (the last release is from 2009).

Pyglet is the alternative to Pygame. It is built upon opengl and it is a lot faster than Pygame. The Cocos2D engine was created as a framework upon Pyglet. The problem is, Pyglet is unstable, with a lot of problems, mainly on Mac OS. The community is nearly zero, it is poor documented and is also rarely updated (with less activities than Pygame).

Any other library using Pygame and Pyglet (such as Spyral, Ignifuga and Cocos2D) have the same problems already cited.

Pygame and Pyglet are the main option for game dev in Python, but there is also an opengl binding called PyOpenGL, which can be used to low level development. As far as I known, there is no promising library using it as basis.

Together with all problems already cited, there is the difficult to distribute a python game. You can use py2exe or cx_freeze to do so, but is pretty easy to do the reverse engineering and access the complete code and resources. Moreover, games are heavy applications in all senses and require a lot of optimization to run fast (at least 30fps), and this scenario is for C++. The slow speed is inherent to the Python and is not really a problem for most of the applications, including scientific computing, but for games is a real concerning.

The only real use for Python in commercial games today is as a script language, and even this is more rare to see.

Your email address will not be published. Required fields are marked *