2D Game Engines for Python
By: Jens in game development | pygame | python
Update: I posted a more extended list of python game and rendering engines.
I was searching for infos on how to do 2D game stuff with python and decided to blog about what i found so far. Maybe it's useful for others :-) Be aware that this is no indeep review of any of the engines. It's rather my view after looking into the docs and some examples of some engines.
What exactly was i looking for?
I'd like to write some simple 2D solo RPG to test out some ideas i have in mind. My language of choice is of course python and it must run at least on windows, better with mac and linux support too. Nice community, enough docs and a map engine would be nice additions, but are not mandatory.
What i found so far:
- PyGame Python binding for sdl and more
- Pycap The PopCap Game Framework for Python
- SpriteCraft Small game engine with python bindings
- ika RPG game engine with python scripting
PyGame
Pygame is a set of Python modules designed for writing games. It is written on top of the excellent SDL library.
LGPL and works where sdl and python run
Best known python 2d framework with plenty of information and code examples around. There are some existing sprite or tiled map engines around, but not directly distributed with pygame.
Pycap
the ultimate framework for the super slack programmer. Pycap wraps the sweet sweet PopCap Game Framework in a super friendly high level python interface. With Pycap you can start building pretty 2D games without installing a compiler or learning C++.
PopCap Games Framework Licence, Windows only, for Linux or mac take a look at TuxCap
Compilation of the PopCap Framework with embedded python. The mainloop is in native code and contains several callback to the python code.
The examples seem to be straightforward. The api doc is ok, but there are no further infos available. Neither a community. On the other hand it seems to be pretty new and still growing :-)
Didn't see a sprite or tiled map engine or some related basic functions.
SpriteCraft
The SpriteCraft is small and lightweight x86/DirectX 2D game engine for shareware/freeware game development. The engine distributed for free without any fee. You may use SpriteCraft in wide range projects without any fake restrictions.
Freeware, but not open source, Windows only
It's distributed in form of a dll which contains python 2.4 support, so one can directly import the dll inside python and use it.
There's not much documentation and only 2 samples and one (the mapeditor) didn't even work for me. But for game writing experienced people it's probably worth a deeper look.
ika
ika is a game engine designed to allow one to make a console style RPG with a minimum of code, while allowing one who is willing to code an impressive level of power over the look and feel of one's project, thanks to the embedded Python interpreter.
GPL, Windows and compile infos for linux
The core is written in C++ and the game logic can be written in python. There's also a map and a sprite editor included. I tried the precompiled
binary for windows and pretty much everything worked out of the box. The docs cover some basics which is fine for the first start, but there
are no informations on advanced feature and need some clean up imho. Not sure if its still alive, but who cares, its open source.
What am i going to use now?
On first sight ika looked like the ideal solution for me. Even the GPL license was ok in this case. But it has some drawbacks i noticed while testing out.
Theres no possiblity to use a debugger to debug the python code. At least i don't know how to debug python code embedded inside a c++ app. I mean real debuggin, not print statements.
Then i am bound to their tools and formats and if something doesn't work in the tools or engine i had to use C++, ugh. So it's out.
Pycap has the same problem with debugging, where SpriteCraft and Pygame do not. SpriteCraft and Pycap have the lack of docs and share the problem if something in the render part doesn't work, i can't even fix it or can't stand the language i had to use :-)
Yep, there remains Pygame with none of the problems above. A mature lib with a huge community and good resource sites. The only disadvantage is imho that i might have to code alot of the basic stuff like map handling alone if i don't find a proper solution.
But i can live with that.
Hope this short entry might help you in a similiar situation :-)

on 24 February 2008 at 21:41 Patrick said …
Same search, same dilemas.
Add Pyglet and Rabbyt to your game libraries and you've covered them all =)
For RPG work, the only thing lacking from pygame is tile engines so you can scroll around on screen ala Diablo.
on 26 February 2008 at 10:58 Jens said …
Thanks for the tip.
My Problem with most of the solutions out there is they just cover the basic rendering tasks and are far away from game engines.
PGU and Waldi are the only tile engines for pygame i am aware of. For PyGlet there are 2 in the svn, one abandoned and the other seems to be still worked on.
What kind of game do you want to code and which of those libs are you going to use?
on 14 March 2008 at 20:23 sonic said …
how to install ika?
please
on 16 March 2008 at 06:45 Jens said …
For testing purpose i downloaded the ika-62 zip for windows and just unzipped it in a folder. To start the inlcuded demo run ika.exe. Nothing fancy at all.
on 3 April 2008 at 06:44 mvBarracuda said …
How about FIFE? http://wiki.fifengine.de
on 5 April 2008 at 12:48 Marion said …
Thank you for doing the leg work! I have been going through this process and came to the same conclusion. Python + PyGame. Nothing else works.
on 5 April 2008 at 17:22 Jens said …
@mvBarracuda: Thanks, i was aware of fife, but for some reason i didn't look much into it. For the sake of completeness i should update the list in my next spare times.
@Marion: I am glad saving you some research time. Mind sharing the your reasons which led to the pygame conclusion? Where they similiar to mine?
on 6 April 2008 at 06:32 Marion said …
@Jens: One of the goals of my game is to be cross-platform so PyCap and SpriteCraft are out (there is TuxCap, but I don't want to have two code blocks, I chose Python because it is cross-platform and OOP). ika's post on 2008-02-05 said they are migrating to Python but I suspect that will take awhile. I also looked at some you didn't review. Waldi looks promising. It is entirely in Python and PyGame, and has a map editor. But it is young and only in alpha. Directicus is also pure Python and has some useful additions. pymage didn't offer anything I was interested in. I don't want to do isometric (too hard for me to draw).
Another goal of my game is to be multi-player over a LAN, so the game engine will reside on the server and the rendering will be on the client. This doesn't fit into the design of all of these libraries reviewed.
on 13 April 2008 at 11:38 Jens said …
@Marion: I did test waldi, but somehow it didnt convince me. Like a lot of pygame related code it looked like a hack, better then the average, but still a hack. Directicus and pymage are new to me, or at least i dont remember checking them out. Personally i like isometric game, but i wanted easy 2d graphics and as Kerim said he doesnt like isogames, we settled with a simple top down like view. And a big bonus was that i found nice looking graphics ;-)
Did you start coding your game already and might have something to show? :-)
on 25 April 2008 at 14:26 WIP said …
I stumbled upon this blog entry while googling ika. I'm one of the developers for ika, so I was pretty interested in your assessment of it.
Your main issue with it is debugging, so I'd like to hear what debugging tools you wanted to use with it and how you would use them.
on 2 May 2008 at 03:41 Jens said …
@Wip: sorry have overlooked your post due damn spam comments. But better a late answer then none :-)
I develop mainly with Eclipse and PyDev and use those debugging tools. Basically when you start a debugging session, eclipse starts the python app in debugging and connects its debugger to it. I didn't find a way to debug another exe which itself hosts the python runtime in which my app runs, as its the case with ika and some of the others mentioned.
on 7 May 2008 at 02:08 InstinctSage said …
It has been years since I programmed anything seriously (I have a background in java), but I'm trying to pick up pygame to create a few nice 2d action games before moving on to something a little more complex (within pygame).
I've got Rabbyt and Pyglet, but I've yet to learn how to use them very well.
Any hints on how to verse myself better in their uses?
on 10 May 2008 at 12:09 Jens said …
Personally i learn the most by examing other peoples code, checking the docs/mailinglists/groups and just playing around. Even i don't use Pyglet i found the addiditonal stuff in their svn very valuable.
on 15 October 2008 at 11:22 0x666 said …
For 2D games I suggest cocos2D framework-
http://cocos2d.org/
It has many features including, but not limited to: scene transition effects, fx effects on sprites and so on...
It has pretty good docs too ... and it is actively evolving.
on 17 October 2008 at 17:09 Jens said …
Thanks for the tip, i'll take a look into it.
on 24 November 2008 at 12:48 alfem said …
If you want to make your own 3d isometric game, we have just released Gente Guada.
It is an open source, python coded, isometric, online, multiplayer game build from scratch.
http://forja.guadalinex.org/webs/gent...
The only issue: doc is in spanish :-)