Sign in to follow this  
Ntvu

Python or C++ For Quick Game Development

Recommended Posts

Ntvu    100
I'm interested in developing some small to mid-size games that run on Windows. However, it would also be nice if they were cross-platform and I could port them to different operating systems with changing only a little code. I narrowed down my choices for game development to Python and C++. I've been programming for the last three years and I have used C++ before (it was my first language). I have also tried a little of Python and it seems like I'm a lot more productive with Python than I am with C++ and other languages. Recently I've started web development with PHP and MySQL and that's what I'm currently doing. However, I want to move into game development; more specifically, I want to be able to create a simple 2D sidescroller or shooter, and later (when I gain more experience) possibly a small 3D game. Anyway, choosing between C++ and Python is tough for me. If I use C++, then I'll use OpenGL for graphics and SDL for input and sound. I have some experience with SDL but almost none with OpenGL, but if I go down the C++ route, I will get started with learning OpenGL. On the other hand, if I use Python, I will use PyGame for graphics, input and sound. The problem is, I'm not sure which to choose. If I use Python I'll be more productive, but I might not have as much control over my program as I would with C++. With C++, I would probably have more control, but then I'll be less productive, one of the reasons being that I'll have more problems coding with C++ than I would with an interpreted language. So, which one should I choose? I don't have much time to spend in game development so the quicker I can finish my games, the better. But, I also want a good amount of control over my programs and be able to create larger and more complex games when I have more experience. Any advice or help would be appreciated. Thanks.

Share this post


Link to post
Share on other sites
oler1s    585
You keep bringing up the issue of control. Perhaps you could give us examples of control issues you would have in Python that you wouldn't in C++.

Share this post


Link to post
Share on other sites
daviangel    604
Python's a no brainer IMO.
Then again maybe I'm biased since I did do a tutorial on Python and Pygame a while back here.
Anyways, you can use OpenGL with Python so that's not an issue here.
PyOpenGL is the cross platform Python binding to OpenGL and related APIs.
See that's the great thing with Python is that you really have no excuses with all the existing bindings available and if there isn't one there is SWIG you can use.


Share this post


Link to post
Share on other sites
FritzMar    140
i would recommend using python for the 2d games and then c++ for the 3d, my work with python has been small but i've noticed the more math crunching that you are doing the slower its gets, you may want to end up using a mixture of python and c to handle graphics

Share this post


Link to post
Share on other sites
Ezbez    1164
Python and SFML no question about it.

Only hook is figuring out how to install PySFML. Bleck, I managed to get 1.3 working on Python 2.5 (I have a thread about doing so if you want to poke around in my history), but I couldn't get 1.4 working on any Python. :/ It's worth it, though! Outclasses PyGame pretty handily, IMO. And outclasses C++ in a blink for those sorts of projects (or nearly any projects, for that matter).

Share this post


Link to post
Share on other sites
hplus0603    11347
Actually, if you want 3D, I would recommend Panda3D, which comes with Python. It's a heavy duty 3D rendering engine with most of the bells and whistles you want. You can also write C++ extensions if you want. Disney uses Panda 3D for Pirates of the Caribbean, and a previous version for ToonTown Online.

The main problem when I looked into it a year ago was that the 3ds Max exporter wasn't quite up to snuff, despite having been re-written recently. Trying to export skeletally animated characters didn't work right. I see that they just released a new version (1.6.1) and that they claim COLLADA support, so that may be less of a problem now.

Share this post


Link to post
Share on other sites
Khado    102
Why don't you use Panda3D? It's Python/C++ (encourages Python but possible with C++) and if you're making quick games you'll want to use an engine.

If you're more interested in Engine programming then go C++.

Share this post


Link to post
Share on other sites
Captain P    1092
Quote:
Original post by Ntvu
I'm interested in developing some small to mid-size games that run on Windows. However, it would also be nice if they were cross-platform and I could port them to different operating systems with changing only a little code. I narrowed down my choices for game development to Python and C++.

Did you consider Flash? It's a viable option, and can be pretty fast to work with.

Quote:
Anyway, choosing between C++ and Python is tough for me. If I use C++, then I'll use OpenGL for graphics and SDL for input and sound. I have some experience with SDL but almost none with OpenGL, but if I go down the C++ route, I will get started with learning OpenGL.

You don't need to if you don't want to - there are various engines and frameworks out there that can do the heavy lifting for you. You still need to learn how to work with them, but you'll be up and running much faster. I'm currently using Ogre 3D (for 2D, actually), but Haaf's Game Engine is interesting too.

Quote:
On the other hand, if I use Python, I will use PyGame for graphics, input and sound.

Pyglet is another option you may want to look into. And Panda 3D is good for 3D games. Whatever you pick though, it'll allow for rapid development indeed.

Quote:
So, which one should I choose? I don't have much time to spend in game development so the quicker I can finish my games, the better. But, I also want a good amount of control over my programs and be able to create larger and more complex games when I have more experience.

Sounds like time is currently more valuable to you than 'control'. So go with Python for now. If your needs or requirements change in the future, then pick a language that suits those needs - when those needs arise.

Share this post


Link to post
Share on other sites
tufflax    504
Quote:
Original post by Ntvu
The problem is, I'm not sure which to choose. If I use Python I'll be more productive, but I might not have as much control over my program as I would with C++. With C++, I would probably have more control, but then I'll be less productive, one of the reasons being that I'll have more problems coding with C++ than I would with an interpreted language.


What do you mean by "control". What are you really after when you say that?

Share this post


Link to post
Share on other sites
Oluseyi    2103
Quote:
Original post by Ntvu
If I use Python I'll be more productive, but I might not have as much control over my program as I would with C++. With C++, I would probably have more control, but then I'll be less productive, one of the reasons being that I'll have more problems coding with C++ than I would with an interpreted language.
Quote:
Original post by oler1s
You keep bringing up the issue of control. Perhaps you could give us examples of control issues you would have in Python that you wouldn't in C++.
Quote:
Original post by tufflax
What do you mean by "control". What are you really after when you say that?


He means things like "I can manually allocate my memory," which gives him more "control." He means that he is scared that if he commits to Python, with its duck typing and automatic memory management and all the things that just seem to happen on their own, how does he know that his game won't randomly slow down? How can he be sure that it's efficient? You know, all the specious arguments that are fomented by years of hearing that interpreted languages are "slow" and C++ is "more powerful."

@Ntvu,
Don't Worry About It™. Write your game, playtest it, profile it, then worry about speed, control and optimization. Anything else is premature. Good luck! [smile]

Share this post


Link to post
Share on other sites
Anexa85    186
I know the options you were choosing between were Python and C++ but have you considered C#/XNA? That might be a good place to look as well. If you already ruled that out then ignore this.

Share this post


Link to post
Share on other sites
owl    376
Quote:
Original post by Ntvu
I don't have much time to spend in game development so the quicker I can finish my games, the better.


You might want to try some free game-making libraries, regardeless of the language you use, then. Othewise you'll have to code a renderer, a gui, data-structures, model/sprite handling and stuff by yourself. XNA is a possibility. There are other libraries, some of them are listed in the free-libraries sticky-thread somewhere on this site.

Share this post


Link to post
Share on other sites
Joshuad    100
I'm rather surprised no one has mentioned, but why not use both? I've purposely learned Python, C++, and C# so that I could use them together. Even though I have no intentions of ever combining C++ and C#, I do, however, intend to do a lot of my work once the learning process is a little more on the complete side by combining C# and Python, or C++ and Python. Use C++ for the more memory critical operations such as graphics and sound rendering, and use Python for the operations that have no meaning resource wise, such as menus, tool kits, etc.

Share this post


Link to post
Share on other sites
moff    100
It seems like starting out with something like Panda, and using Python for everything, would let you make a game much more quickly - assuming you know Python at least as well as you know C++ (or you know neither equally). Then you can reimplement components in C++ if they need to have higher performance, and you have the time, aptitude, and inclination.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this