3

I am a great python fan. Recently I got an idea to write RTS engine and/or maybe a simple RTS game based upon this engine. There are a couple of things I need to think about and maybe you can give me some advice on these:

  1. Performance. Most games are written in C++. Isn't python too slow for game engine? I am aiming only at 2D, but still it may be too demnading.
  2. Graphics. Are there any good graphics libraries for python? SDL/OpenGL bindings or maybe something more suitable for python?
  3. Game engines. Do you know of any existing RTS engine written in python?
  4. Any tools/libraries for python that maybe helpful in developing RTS

Thanks in advance!

pajton
  • 15,828
  • 8
  • 54
  • 65
  • http://pyopengl.sourceforge.net/ – Andrey Sboev Apr 04 '11 at 21:38
  • 4
    EVE Online is written predominantly in Python (actually a variant of Python called Stackless Python), with performance-sensitive components (such as the graphics engine) written in C++. If Python can handle the world's largest un-sharded MMORPG (which also happens to boast the world record for most concurrent online players) with all the entity tracking and network I/O that entails, I think it can handle an RTS... – Kromey Apr 04 '11 at 21:47
  • Thank you all for the answers! – pajton Apr 09 '11 at 20:38

2 Answers2

7
  1. Performance may be an issue with heavy graphics/math processing. If so, see Panda3D, NumPy, Cython, and PyPy.
  2. Use Pyglet, PyOpenGL with Pyglet, Panda3D (although you are writing in 2D, you can still use a 3D engine), or perhaps some other library.
  3. There don't seem to be existing RTS libraries, but there are definitely pre-existing generalized engines.
  4. Try searching for RTS-related libraries in general: you'll need AI, pathfinding, networking, and so on. Therefore, you may be interested in Twisted, for instance, since it helps with networking.
li.davidm
  • 11,736
  • 4
  • 29
  • 31
  • +1 for Twisted to do networking - its fast and scalable, and not too low level that its difficult to work with. – Tony Casale Apr 05 '11 at 13:40
3

I can answer your first two.

  1. Python isn't too slow for games. That all games must be written in C++ is a myth. Sure C++ (or C) might give you the best performance, but it doesn't mean you're unable to write a game in another language.
  2. Try PyGame: SDL bindings for Python.
Tony Casale
  • 1,537
  • 8
  • 7
  • 2
    Of important note (and often forgotten) is that most of the most performance intensive code in python calls into C libraries anyway. Obviously math and graphics processing should occur in pure python but there are libraries for this that consist of python bindings around a C library. – marr75 Apr 04 '11 at 22:00
  • That is the point. I want to do this in pure python! I.e. I do not want to end up replacing high-level nice lookoing python code with calls to some external API, because the performance is too bad – pajton Apr 04 '11 at 22:13
  • Not to try and disuade you from your goal, but "pure" python is a misnomer considering that python itself is written in C. At least consider numpy for number-intensive areas of your code. – Garrett Berg Apr 04 '11 at 23:30
  • @garett Sure, I know python is written in C. Thanks for numpy tip – pajton Apr 04 '11 at 23:55