# Is it a good idea to develop non-trivial 2d game in python?

I am planning to develop 2D space RPG and i am facing the choice: what is the best language to write it in? My candidates are C++, Java and Python. Obviously, I want to write game in Python because of its expressiveness, speed of development and simplicity of adding scripting support. But I am worried:

• Won't Python be too slow? The game will be not trivial (like Tetris for example), it may be needed to calculate tasks for thousands of ships in universe (though their AI can be heavily simplified if those ships are not seen to the player). Of course I can write some critical parts in C, but it will instantly complicate building and deploying.
• Let's suppose that game became popular, and I became a superstar. Windows users rarely have Python at all (fortunately we have py2exe). Python on Mac OS X can be outdated and game may crash with obscure exception. Wouldn't it be hard to deploy game in Python?
• Because of lack of libraries for Python 3 I'll have to write game in Python 2. Wouldn't transition to Python 3 in couple of years be too painful and time consuming?
-
For your second question, I'm pretty sure there's also a py2app you can use to make deployment fairly easy. –  thedaian May 9 '11 at 14:10
If you do decide to do this in Python, you might want to see if you can do any of the "slow" parts using numpy (but it might not be neccessary). –  Brendan Long May 9 '11 at 18:36

Won't Python be too slow? The game will be not trivial (like Tetris for example), it may be needed to calculate tasks for thousands of ships in universe (though their AI can be heavily simplified if those ships are not seen to the player). Of course I can write some critical parts in C, but it will instantly complicate building and deploying.

It's hard to say, but most of the time the limiting factor for performance is one's ability/experience as a developer, not the language. Note that EVE uses Stackless Python (see here and here for downloads of a related presentation). I don't recall the exact details, but apparently most of their server cluster is running Python. I would thus imagine that it could handle your scalability requirements, although prototyping to be sure would be good.

Windows users rarely have Python at all (fortunately we have py2exe). Python on Mac OS X can be outdated and game may crash with obscure exception. Wouldn't it be hard to deploy game in Python?

Most users rarely have the appropriate binary dependencies for games, regardless of what technology those games were written in (even C requires a runtime component to be distributed). Deploying via py2exe or equivalent, or simply deploying the appropriate dependency, is something of a fact of life. While it's never the easiest thing (most installer technologies are painful), it's doable and shouldn't be a reason to eschew the language -- as I said, you'll likely need to handle something similar regardless.

Because of lack of libraries for Python 3 I'll have to write game in Python 2. Wouldn't transition to Python 3 in couple of years be too painful and time consuming?

This I don't know much about, never having really used Python 3. I don't expect Python 2.X will vanish any time soon, however, so I don't even suspect the lifetime of your game would be such that you'd need to transition over if you didn't want to, which makes this concern something of a non-issue.

As others have said, you're worrying too much about the language selection aspect of your project. Python is a powerful, useful tool for developing games and if you know it and like it you should develop with it. It doesn't matter how fast your game runs if it never gets finished because you worried too much about the language.

-
Having used python 2.7 fairly extensively, there's not much you can do with python 3.2+ that you can't do with 2.7. That will change over time, but also will library support. =) –  Kenneth Posey Jan 22 '12 at 3:06

re #3, Python 2.x will see distributor support for at least another 5-10 years. If you use a fairly recent version (2.7, or possibly 2.6) the migration path is fairly easy if you write future-proofed code (new-style object, unicode everywhere, etc etc). The pain is mostly for things that were relying on old, broken behaviors.

-
To help identify old behaviors that will bite you, run your game with python -3 filename.py, which will print out warnings for things that are no longer supported in Python 3 –  spiffytech Mar 18 '14 at 16:12

To your first point, you'll just need to build a prototype and see. Even if you told us all the details that wouldn't really change things.

As for the other two points, I kinda feel like you're putting the cart before the horse. From your question it seems like you are new to game development, in which case you really just need to pick a tool and go with it. Nitpicking over the pros and cons of mostly equally useful tools is a distraction from your real challenge: learning game development.

-
+1 for just getting your hands dirty. –  tenpn May 9 '11 at 13:56