As I said before (and I repeated), if I start a new project, I prefer to work with Python, 'cause I like its huge standard library, its portability and its syntax and this is true for every new project I do for work: such as "building netcdf files", "analize meteorological datas", "manage databases". But I had a big problem for a personal project, a long dreamed chimera never really realized: a videogame. I thought to build a simple shooter, something like the old "galaga" or "space impact", using hardware accelerated graphics for great effects, such as particles and flashes. There are many schools of thought on game development under Python: there's PyGame ones, Pyglet, Pandas, ecc. I would like to talk with you about actual game development in python and reflect about my needs
Actual SituationLet's take a look on Python libraries for gaming.
- PyGame is a simple 2D library based on SDL. Good for 2D graphics and integrable with PyOpenGL for 3D. It's still the library with biggest community for Python game development.
- Pyglet is a 2D library built upon OpenGL. It's fast, "pythonic" and very pleasant. But it stand still since 2010. No news, few words from devs and, back in 2010, no support on windows 2000. Very bad. I don't ask a lot, just a simple «we are here» from Pyglet developers, some guidelines, a vision for next releases and ports.
- Panda3D is simply great. A full featured 3D framework written in C++ and strictly binded to Python to realize 3D games. Great. A bit heavy and maybe a bit much for a 2D engine, but still good.
- Cocos2D: yeah! You know Cocos2D as a iOS (and probably its multiplatform C++ 'sister' project, Cocos2D-x), but it started as a Python library based on Pyglet. It's still developed, but being based on Pyglet I am a bit hesitant to suggest it
So, what I miss?When I started using Lua Löve I feel confortable, even if I don't like Lua very much. With Löve I realized a simple interactive program in few lines of code. Easy and fast, both in writing time and in effective speed. It was also small, 'cause Löve executable is less then a megabyte and it's easy to deploy: just bundle Löve executable and your program zipped and you can give it to every desktop OS.
More frustrating is thinking Python games could do this too. If you try to realize a Visual Novel, with Python you can use Ren'py. Ren'py it's great because it's not just a library, but a full framework where you can manage your projects, add sounds and images, use Ren'py Domain Language to write your visual novel. It cames even with an embedded text-editor (JTextEdit) and offers you many usefull features (take a look here for more info). So, what I really miss for Python game development is a environment, with
- a text editor
- a packaging system to deploy my programs, without thinking if my users have Python installed or how to bundle all files
- a easily way to manage animations
- easy to use accelerated 2D graphics. Something like Löve's
myImage=love.image.newimage('test.png') love.graphics.draw(myImage,x, y, r, sx, sy, ox, oy, kx, ky )
- A consequenting animation class whom works with image functions just seen
- Managing projects as entities (something like eclipse)
- Have a "main" file such as
import TheFramework as tf class Game(tf): def __init__(self): ... def Update(self): ... def Render(self): ... x=Game() x.Run()
- a way to export such games to mobile platforms
- Reduce final program only to really used modules
- Game configuration as python dictionary
- Save/Load system