• Advertisement
Sign in to follow this  

Pro's & Con's of Python, Java, C++?

This topic is 4673 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was wondering, what the general pro's and con's of Python, Java, and C++ were. Also, could someone post some examples of comerical games done in Python and Java?

Share this post


Link to post
Share on other sites
Advertisement
Pros:
Python: Easy to learn, generally a beginners language
Java: Very portable, and also quite easy
C++: very powerful, you can do almost anything with it

Cons:
Python: It's interpreted, so the user must have the interpreter and the game is automatically open source
Java: You can't access memory like in C++ (no pointers)
C++: Can be rather difficult to learn

Share this post


Link to post
Share on other sites
I think Vampire: The Masquerade was done in java (if I recall correctly, it's been awhile.)

And the recent Battlefield 2 uses python for some stuff, such as stat exporting.

Share this post


Link to post
Share on other sites
Pro's

Python: Easy to learn and code, it's OO, so it has the functionality of C++. Faster development time because of ease of code.
Java: Platform independant. C like, can be confusing. It is also OO. Also very internet capable. Can develop applications for the web.
C++: Very, very powerful. Can do anything Python and Java can (except internet capabilities of Java). You can do a lot Generally platform independant, you just might need to re-compile it. Lower level than Java and Python. Also more efficient. C++ is probably the most used language of any.

Con's

Python: Interpreted, so it's slower at runtime. Making it crackable so you can grab the source.
Java: Limited, no pointer access. No pointer access because of its internet applicability. Also interpreted.
C++: Hard to learn (not to me :/ ).Because of it's a lower level language, it requires more code. Because of the design reading the code can be mind boggling.

P.S.: People usually use Python as a Moding language for there game because of it's easiness. Plus it's OO and I guess would work well with C++.

Share this post


Link to post
Share on other sites
Quote:
Original post by sykonet
I think Vampire: The Masquerade was done in java (if I recall correctly, it's been awhile.)


Not true.. They used Java as a scripting language, while the core of the game was written in C++ Link

Don't get me wrong here, as I think that Java is the coolest language of them all. The only time I would recommend you to stay clear from Java is when writing a new OS...quite frustrating to do such tasks without pointers :) Java does have some performance issues when compared to languages compiled to native code (binary format), atleast when it boils down to raw computing power - but I feel more comfortable with Java. The only drawback is that I think it's easier to write bad (as in slow) code with Java.

Share this post


Link to post
Share on other sites
Quote:
Original post by Oberon_Command
Python: It's interpreted, so the user must have the interpreter and the game is automatically open source


The interpreter itself is a 1.78MB DLL, which isn't that big a burden.
You can distribute the .pyo instead of the .py if you wish.
And the application definitively isn't "automatically open source".

Share this post


Link to post
Share on other sites
Quote:
Original post by dbzprogrammer

Java: Limited, no pointer access. No pointer access because of its internet applicability. Also interpreted.


Technically, it's not interpreted! Java is compiled into bytecode and executed through a virtual machine (kind of a software CPU). It's not only running your code, but also trying to optimize it on the fly. In theory, a java application could perform better after n hours of execution because of this.. Sadly, it doesn't work that way..atleast not with Eclipse or Netbeans [smile]

Share this post


Link to post
Share on other sites
Quote:
Original post by dbzprogrammer
Java: Limited, no pointer access. No pointer access because of its internet applicability. Also interpreted.


I don't know why people list 'no pointer access' as a con. It's really not as big a deal as people think it is. You don't need pointers in Java, so you don't miss them at all. When you program in Java, think in Java. If you think in C++ while cranking out Java code you'll never be an efficient Java programmer. And for the millionth time - it's not interpreted anymore!.

My perspective of Java cons, for game programming:

* not currently available on consoles

* online distribution issues - Do you require the user to download the JRE if it isn't installed already, or do you bundle it with your app? For a budget game this could make or break you. For a packaged CD it's not an issue.

* lack of third party game dev tools - while there are some fantastic IDEs for Java, game-specific tools are lacking. There's are a handful of open source and commercial 2D/3D game engines being developed (I don't believe any of them complete), and some cross-platform native bindings for OpenGL, OpenAL, and JInput, but that's it. Contrast that with the plethora of C++ game tools available.

* bad reputation - most gamers know nothing of the tech used to create games, but I have seen on some gaming message boards that Java isn't as unknown as one would think. The problem is that those gamers who do know about it only have heard that 'Java is too slow for games'. They automatically dismiss any game they hear is made with Java.

* easy to learn, difficult to master - programming in Java requires a different mindset. Some things you might have learned through another language just do not apply in Java, and can hurt you rather than help you. For example, you have to learn to program for the GC, something you need not be concerned about in C++. Then there's some things that are Java-specific that you need to learn to handle. For example, many people have the misconception that because there's no pointers in Java you can't have memory leaks - not true.

Pros:

* reduced development time compared to C++ (not so much Python ;)) - generally, if you know what you're doing, you can be more productive in Java than in C++. I know C++ programmers who will dispute that, and that's why I qualify it with 'generally'. Java has a robust API that simplifies a lot of things for you, things that in C++ you would have to implement yourself or license a third party library for. And I have found that design implementation comes much more naturally when working for Java (but that's me, and others may disagree).

* superb development tools - there are some excellent tools you can use throughout the development cycle that blow away anything available in C++. While commercial versions are available, there's almost always a quality free alternative. IDEs (such as Eclipse, Netbeans, and IDEA) that are packed with features (refactoring, automatic compilation, semantics checking, etc...), comprehensive debuggers and profilers, GC profilers (these are great for fine tuning large apps to reduce memory consumption and improve performance). Lots of goodies (and they actually can be quite fun to play with).

* safety nets - there's quite a number of safety checks behind the scenes (such as array bounds checking and null pointers - Java doesn't have pointers like C & C++, but a similar, though safer, concept in that every class instance is a reference that is passed by value). C++ programmers would likely list this as a con for taking away control (i.e. not giving them a choice as to when to do bounds checking), but many Java programmers will tell you it's great not to worry about that kind of stuff. Let Java handle it all behind the scenes while you move on to other things (another step toward higher productivity). Plus, the runtime compiler can optimize away some of these safety checks when the program runs.

* no pointers - yes, I see this as a pro! There are several common mistakes that can cause hard to find bugs in C and C++ when using pointers. Sometimes you don't even know of it until you release the app inton the wild (buffer overflows anyone?). But it's not a panacea, as you can still have NullPointerExceptions thrown when the user runs the app (which is equivalent to an access violation or segfault), and you can still have memory leaks (via dangling references).

A lot of what's good/bad depends upon your perspective. Somone with no experience either way (a total newb!) has a clean slate with no bias. As you get familiar with one language or another, you'll start to develop preferences and dislikes. You'll find that what you think to be a great feature another may think is restrictive or asinine. One man's trash is another man's treasure, and all that. The best people to get opinions from, IMO, are those who have experience with multiple languages and know how to use them well. They often will have developed a balanced opinion and know when to use the right tool for the job. People who religiously defend one language over another generally can be ignored, as their opinions are horribly biased - and unfortunately you will find a lot of that here. I try to keep my opinions balanced, but I do favor Java over C++ so you can surely consider me biased. That's why I don't offer any opinions on C++ here (the cons list would be too long :)). As for Python, I enjoy using it and find it to be a more productive language than Java, but I haven't really used it much in game development (a bit of scripting, for which it is an excellent choice).

Some commercial Java games: Tribal Trouble, Puzzle Pirates, and a few titles from Puppy Games. All of these games were developed by indies, but Three Rings recently shipped a box version of Puzzle Pirates in a publishing deal with Ubisoft.

I don't know of any commercial Python games, otherwise I'd link some for you.

Personally, I've made the switch to D. I use it for all of my personal projects now, including game related stuff. I find it to be a nice middle ground between Java and C++. But it's not for everyone. It is still in development (not yet 1.0), and there are few resources available for learning it. Just as Java requires a different mindset, D requires you to think in D to be effective with it. So maybe it isn't the best language for beginners right now.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement