Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

2D RTS in Python?

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!

like image 601
pajton Avatar asked Jun 13 '26 08:06

pajton


2 Answers

  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.
like image 192
li.davidm Avatar answered Jun 15 '26 21:06

li.davidm


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.
like image 20
Tony Casale Avatar answered Jun 15 '26 22:06

Tony Casale