Python vs. C++

Started by
16 comments, last by Max_Payne 18 years, 8 months ago
Hi everyone! It's my first post. Ph33r. Or something. Anyway, I know this question has been asked probably a thousand times, but I don't see any real clear-cut answer to it (and I don't know IF there's a clear cut answer...) but here goes. I saw someone asking questions previously about what language and graphics library would be best to design a 2d action-rpg, and that pretty closely nails what I want to do. (although I have some ambitious plans...but I realize the road is going to be a long one to travel) I'm pretty much a complete newbie to programming, so I've been studying C++ and more recently, Python. I'm pretty sure from what I've read that if I want to use DirectX (Direct3d is what I was previously thinking), I'd have to use C++. With Python, my options would pretty much be limited to SDL. I don't really know the advantages and disadvantages of either of these setups, and I feel rather lost. Any advice, thoughts, opinions? I'd like to know what C++ does better than Python, and vice versa, as well as with SDL/DirectX. I'd like my lil' 2d action/rpg multiplayer game to have an old-school kind of look, but with enough bang in the engine to produce some pretty flashy effects with those ol' sprites. Thanks in advance to anyone who responds, angrily or not. ;)
Advertisement
Quote:Original post by Arydrall
Hi everyone! It's my first post. Ph33r. Or something.

Anyway, I know this question has been asked probably a thousand times, but I don't see any real clear-cut answer to it (and I don't know IF there's a clear cut answer...) but here goes.
It's not the language that makes the game, it's the algorthms that make the game.

Making things look old skool but with modern flair is the artist's job, not the programmer. The tool is the paint program, not the language.

That being said, vs. topics are always pointless. The reason two simular things exist is because they both do the job somewhat equally well(i.e. Direct3D vs. OpenGL) and which one is better is a matter of religion.
C++ will result in faster, compiled code. However, it will obviously be more of an effort if you wish to port the program.

Python is oriented towards fast development. It will provide you more standard libraries, possibly greater portability.

As far as I'm concerned, C++ is more powerful, and more suitable for serious game development.

Looking for a serious game project?
www.xgameproject.com
One advantage of using python is that you can write your whole game in it, and later when you find out its too slow (it might not be), it shouldnt be a big deal to swap out the performance critical sections with C++ code.

Other than that I think SDL should be a good fit for a 2d rpg. Have you checked out PyGame?
C++ is faster and lower level than Python. Python is slower but easier to program in (and therefor writing programs takes less time). C++ is the industry standard for most types of programming (excepting scripting and some types of web programming), although of course many other languages are used as well. Python is well liked by many programmers, but for whatever reason, rarely used to make full-blown commercial applications or games. There are many other differences, but those are some important ones.

Direct3D is a graphics library which lets you take full advantage of hardware acceleration for a variety of graphics tasks, such as transforming vertices, drawing triangles, lighting, and much more. Direct3D is designed to be very, very fast and powerful if used properly. It is intended for 3D, but it is very simple to ignore the 3rd dimension and use it for 2D. In addition to a large quantity of 3D functions and classes, it includes various 2D ones which together allow D3D to be used as a full-fledged 2D API, if that is what the programmer wants. SDL is a graphics library which is for 2D only (it can also be used in conjunction with OpenGL for 3D, but then you are mostly using OpenGL, not SDL). It does most of its work in software (on the CPU), instead of in hardware (on the GPU). Although some people may point out that on very old hardware this is faster, it is significantly slower on any system bought in the last five years or so, and on many bought before that.

Lots of people like and use SDL; they believe it is easier to use than Direct3D. I find Direct3D pretty easy to use, myself, but some do not. Basically, either will do what you want to some extent. Direct3D is more powerful and faster. SDL is supposedly easier to use. You should also check out OpenGL, which is like Direct3D, but cross-platform and not based on COM; you might like the coding style better.

Quote:I'm pretty sure from what I've read that if I want to use DirectX (Direct3d is what I was previously thinking), I'd have to use C++.

Not entirely true. Managed DirectX has essentially the same capabilities as C++'s unmanaged DirectX, and is available through C# or Visual Basic .NET. However, if you are refering to Python, then I believe you are correct; I have never heard of Direct3D bindings for Python.

Quote:Anyway, I know this question has been asked probably a thousand times, but I don't see any real clear-cut answer to it (and I don't know IF there's a clear cut answer...) but here goes.

It has been asked a thousand times, and there is no clear-cut answer. If you choose C++, I would strongly recommend Direct3D (or OpenGL) over SDL, but other than that, you will have to make your own choices.
You guys are awesome. I wasn't expecting a reply for a day. :)

Yeah, I didn't think that there was a DirectX wrapping for Python, and I would like to apply whatever experience I gain from this towards future projects, so maybe C++ is the way to go.

Right now I'm just evaluating possibilities. I know what my goal is, I know it'll take lots and lots of time to really learn any language (I'm a slow learner)

But I appreciate your comments. Thanks. :)

Edit : Yeah, I've looked at PyGame, and I thought it was pretty nifty. Python itself is a pretty cool language setup, although I miss the compiler, to be honest. lol :)
Quote:Original post by Arydrall
I saw someone asking questions previously about what language and graphics library would be best to design a 2d action-rpg, and that pretty closely nails what I want to do. (although I have some ambitious plans...but I realize the road is going to be a long one to travel)


First it is impossible to design a game in a programming language, at least very hard, but you probably just meant which was better to develop a 2d action-rpg. If you have no previous programming experience, then it is gonna take a long time before you can create a 2d rpg, so you need to create other games before, games like pong, tetris, pacman, breakout, etc. If all you want to do is have fun and create your 2d action-rpg I'ld go with Python, but if you actually is serious about this and want to develop a lot of good (and advanced) games I'ld go with C++. Anyway what you choose wont matter that much, learning a language doesn't take a long time compared to everything you need to program a 2d rpg and most of the concepts are the same in both languages.
Yeah, that's what I'm discovering. :)

And I realize I'll have to take all the steps before I can tackle the project I *really* want to do. Tetris, here I come. ;)
Quote:Original post by mumpo
Quote:I'm pretty sure from what I've read that if I want to use DirectX (Direct3d is what I was previously thinking), I'd have to use C++.
...if you are refering to Python, then I believe you are correct; I have never heard of Direct3D bindings for Python.
bzzzt! Wrong.

All you need is PyWin32, which comes with the ActiveState ActivePython distribution or can be downloaded here. This is a set of Win32 bindings including COM, and, as we all know, DirectX is exposed via a collection of COM interfaces... Of course, you need to be fairly well versed in COM to use DirectX that way, but you can find a few examples on the 'net.

My recommendation would be to develop your game in Python for the productivity, then profile and optimize performance-critical portions in C++ as needed.

Happy hacking.
Quote:
Yeah, I didn't think that there was a DirectX wrapping for Python, and I would like to apply whatever experience I gain from this towards future projects, so maybe C++ is the way to go.

Nah, the experience you gain towards future projects isn't going to be C++ or Python or DirectX. It's going to be straight programming. And that's language independent.
You might as well start with Python, take advantage of its ease of learning and fast development to teach yourself programming.

Then you'll have the best possible start for later C++/DirectX projects.
Trust me, as a newbie, grappling with DirectX won't give you any useful experience. At best it'll make you realize how much you still need to learn. At worst, it'll just depress the hell out of you. ;)
What makes a difference, is your programming skills, your ability to turn a problem into code, whether that code is C++ or Python. Once you learn programming, you can pick up new languages in a day or two. Guaranteed. [wink]

Apart from this, making a 2d RPG shouldn't require either C++ or DirectX. Python and SDL should be able to handle this with ease.

Of course, once you get to the 3d MMORPG with Doom 4 graphics and 100k players per server, you might want to switch to C++. But don't bother with it yet.

This topic is closed to new replies.

Advertisement