Jump to content

  • Log In with Google      Sign In   
  • Create Account

Java vs Python


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
22 replies to this topic

#1 CaptainKraft   Members   -  Reputation: 266

Like
0Likes
Like

Posted 25 June 2012 - 10:16 AM

I did a quick search on the forums and didn't see a relevant post about my question. The articles that were almost what I was looking for were at least 5 years old, so I figured it couldn't hurt to see what people think today.

First, a little background:

I'm a Computer Science student with most of my programming experience focused in Java and I've started learning game development by screwing around in Eclipse and trying to figure out some stuff on my own, as well as following some simple tutorials online to get me moving in the right direction. I also have a bit of experience with Python and I love the language.

And now for my question...

Basically I'm looking for opinions about using Python vs using Java for 2d game development. I'm really hoping to get people on both sides of the fence so I get hear the best and worst of both languages.

I won't be using any engines for my games (now or in the future) because I'm a bit stubborn and want to build all the engines I use myself. The most I would think about using would be Slick2d with Java or PyGame with Python.

Anyway, I hope you guys can give me some great insights on both languages. Thanks for reading

Sponsor:

#2 Serapth   Crossbones+   -  Reputation: 5485

Like
6Likes
Like

Posted 25 June 2012 - 11:11 AM

There is a reason both language and libraries exist. If one was universally better than the other, the other would no longer have any users and would fade away into obscurity.

Frankly, all we can give you is opinions. I can give you one small factoid, Java+Slick will be faster. If Python+PyGame have an Achilles heel, it's speed. Also, Java has much better tooling support. Python's IDEs mostly, well, suck. Or people just use a text editor. Java on the other hand has Eclipse ( which I hate, but others love ) and NetBeans ( which I love and others hate ), a good IDE will really help when you are starting out. Python does however have a much faster compile cycle, as well as an interactive mode, where you can basically type and interactive with code live, which is invaluable to a beginner.


Now for a matter of opinion. I don't like Python. I can't really get over that fact, I find it difficult to structure large programs in and I have been a member of the cult of the curly brace for far too long, so Pythons white space based program structure is anathema for me. That said, that is 100% opinion and applicable to only me.

In these threads we always say language doesn't really matter, and that C#, C++, Java and Python have all been used to make commercial games, but truth of the matter is, this really isn't true for Python. Python has been used *IN* commercial games, such as Civilization 4, but that was as an embedded scripting language, which is a much different task. The other often cited example is Eve Online, but there are two major caveats there too. First off, its actually stackless python they used and second... it's server side only I believe. There are some games, such as those from Disney using the Panda engine, but again, the engine itself is C++, and performance critical sections are written in C++, so Python is effectively being used as a scripting language in these situations. Once you take these examples off the table, I really cant think of a published game written in Python. The Blender Game Engine is powered by Python, but again, the engine is C++ and more to the point, I can't think of a single shipped BGE game either.

Not that the ability to publish a game matters when you are just starting out. Use what is most comfortable to you.

Edited by Serapth, 25 June 2012 - 11:17 AM.


#3 CaptainKraft   Members   -  Reputation: 266

Like
0Likes
Like

Posted 25 June 2012 - 11:56 AM

Thanks a ton for the input. Even though all the answers will be opinions, it will still help me out... especially because that is what I am looking for.

Python does however have a much faster compile cycle, as well as an interactive mode, where you can basically type and interactive with code live, which is invaluable to a beginner.


This sounds a lot like running a Java program in debug mode. You can change your code while the game is running and immediately see results. Is that the same function you mentioned above, or does Python do something different?

Once you take these examples off the table, I really cant think of a published game written in Python. The Blender Game Engine is powered by Python, but again, the engine is C++ and more to the point, I can't think of a single shipped BGE game either.


That's a really good point. I have heard these examples quite a bit, but I'm more concerned about indie games. I don't ever plan to work for a AAA gaming company. My goal is to own my own indie company someday with myself and maybe (not likely) one or two other people working with me. The examples given to argue for or against most programming languages are huge AAA commercial games.

I guess what I'm getting at is: Do you think Python (as well as Java) can handle what it takes to create a successful game like Meatboy, Braid, Castle Crashers, etc?

Thanks again for the input. More like this would be awesome!

#4 6677   Members   -  Reputation: 1058

Like
1Likes
Like

Posted 25 June 2012 - 12:33 PM

You can change your code while the game is running and immediately see results. Is that the same function you mentioned above, or does Python do something different?

Python is interpreted, java is compiled (in reality it is far more complex than that once you start discussing bytecode etc). Java's debug mode is recompiling that section of script each time. Python you can launch the interpreter on its own without a .py file and just type print "hello world" hit enter and it prints hello world. It is very very different but incredibly useful, you claim to have had experience with python yet have never used this???

Do you think Python (as well as Java) can handle what it takes to create a successful game like Meatboy, Braid, Castle Crashers, etc?

Java will probably do that without any issues that I can think of.

Python will also be capable but its frame rate would be pretty miserable. Python IMO is the second most powerful language in existance (first would be either C or C++) because it can do just about anything, apart from games, its framerates are miserable. Even most of pygame is actually written in C and C++, pygame is a wrapper of SDL, basically you call a function from python, pygame takes that and calls the relevent sequence of functions into SDL which is for C and C++. Even then it isn't particularly quick although that might be something todo with how pygame was implemented, py-ogre I have seen get perfectly adequete frame rates and thats 3d so should be more demanding than pygame, only explanation might be that ogre uses hardware accelerated video and sound whereas pygame doesn't (I think SDL itself can support it but pygame doesn't use it)

I really cant think of a published game written in Python.

http://en.wikipedia.org/wiki/Frets_on_Fire < Ok open source, I'll give you that
There was also an old roll playing game made entirely in python but I can't remember its name.





I might not have shone a bright light on python for games but it does have its place in the game industry, writing things like scripts for how a level in a game should flow could be done as an external .py file to be loaded later.
Of the 2 I would look at using java. There is also jython (python running on the JVM) but I don't know if any graphics libraries work with that.
Also there is ironpython for .net and mono but good luck finding documentation on how to integrate .net/mono graphics libraries with it. I have seen someone using XNA with ironpython but as XNA is meant for use with C# most tutorials are also C#.

#5 Serapth   Crossbones+   -  Reputation: 5485

Like
1Likes
Like

Posted 25 June 2012 - 01:07 PM

Python will also be capable but its frame rate would be pretty miserable. Python IMO is the second most powerful language in existance (first would be either C or C++) because it can do just about anything, apart from games, its framerates are miserable.


Nicely enough 6677 answers all of the questions for me. :)

That said, in regards to this comment, I really cannot think of a single metric by which I would rank C++ as the most 'powerful' language. If you mean in terms of speed you can achieve, that is remarkably arbitrary, as when it comes to parallel systems for example, erlang will spank it. When it comes to optimized code, assembly has it beat. You could mean "powerful" in terms of being able to express ideas as code, but even in this regard I wouldn't say so. The lack of a meaningful runtime will always handicap C++, so languages like C# can do things at runtime that C++ can only dream of, while languages like Ruby can express things that C# would have trouble with.

That being said, I will leave it there as I don't want to derail things further.



To directly answer the question "Do I think python could make Super Meatboy, et all.", probably not, at least not with PyGame. Someone could prove me wrong, I am by no means all that experienced on the subject, but I have yet to see a sophisticated PyGame game with good performance on moderate hardware.

#6 smr   Members   -  Reputation: 1653

Like
1Likes
Like

Posted 25 June 2012 - 02:40 PM

I will just say that any performance considerations aside, it IS very difficult to manage a large python application. With Java or any other compiled language the compiler will find many of your errors for you. With python you will loath to change any interface or the signature of any function. Those changes will affect many different source files and you'll be debugging those changes instead of just fixing them before you can build it.

#7 6677   Members   -  Reputation: 1058

Like
1Likes
Like

Posted 25 June 2012 - 04:01 PM

it IS very difficult to manage a large python application.

Oh yeah, its horrific. IDLE is a real poor IDE, and there aren't really any better ones. Your pretty much forced to have your entire project in 1 single file. Or you can split it by using modules but if your distributing a python game your already requiring the end user to install python, do they want to install pygame and manually install any custom modules your using? probably not.

The only IDE I've found that I like is SharpDevelop when I'm working on an ironpython project, I can split into multiple "class" files then which just isn't possible on CPython (The true name for the regular version of python) although it just doesn't seem to like being split up as much as C#/VB.net projects do, seems a little more prone to "this thing that you wanted, yeah I couldn't find it" when its right there infront of you. At least its a .exe I get out at the end of it, maybe the odd .dll



So thats pretty much a -1 on project management in python aswell. Nice language, excellent feature set, uber flexible. But stupid slow when you make games and its probably easier to arrange the specks of dust on your keyboard into the shape of your name than keep track of a python project with more than a handful of pages of code (unless you put giant ASCII logos in comment lines which then gets a bit ridiculous)

Edited by 6677, 25 June 2012 - 04:03 PM.


#8 return0   Members   -  Reputation: 444

Like
0Likes
Like

Posted 25 June 2012 - 06:09 PM

Eve, the space mmo uses python. For sane development, TDD is required. Jetbrains do a decent IDE if you like that sort of thing, called pycharm.

I've just reread this thread and a lot of the criticisms of Python are clearly from a position of total ignorance. All the code in one file? CPython makes module distro hard? Ugh.

Here's some quotes from people worth listening to;
http://www.python.org/about/quotes/

#9 jbadams   Senior Staff   -  Reputation: 18734

Like
0Likes
Like

Posted 25 June 2012 - 09:37 PM


it IS very difficult to manage a large python application.

Oh yeah, its horrific. IDLE is a real poor IDE, and there aren't really any better ones.

Komodo IDE is a pretty good option with a pretty decent feature set including code completion, debugging and profiling facilities. In addition to Python it also supports PHP, Ruby, JavaScript and others. At US$295 for the cheapest licence it isn't a cheap option, but I'd advise anyone working (or planning on working) extensively with the supported languages to give the free trial a go, as it's really is a solid offering.

Those looking for a free option might try Komodo Edit -- a free and open-sourced version of the above IDE -- obviously the free version has a significantly less impressive feature set (comparison), but it does still provide a good editing environment (syntax highlighting, code completion, etc.) which will probably be a more pleasant editing experience than IDLE.

There are some games, such as those from Disney using the Panda engine, but again, the engine itself is C++, and performance critical sections are written in C++

That's certainly true -- but is it really relevant that the underlying engine is written in C++ if the programmer only needs to use Python? In the case of Panda3d the lower-level C++ coding has already been done for you, and unless you're pushing the capabilities of the engine you should not have to resort to writing any C++ yourself.



Python definitely does have performance concerns to be aware of, but I don't think that they're necessarily the deal-breaker someone might believe having read through this topic.


Another thing to keep in mind when considering Python is deployment of the final product; there are various solutions to this, (mostly involving wrapping your project in an executable in some way) but you need to keep in mind that you would probably have trouble finding players if they were expected to sort out installation of the Python interpreter and required modules for themselves. This is a solvable problem, but it should be considered. Note that Java does also require the end users have a JVM installed.


All that being said, I'm firmly in the "it doesn't really matter" camp: you should pick whichever of the two you're most comfortable with, and you should be able to make games of similar quality and scale to the ones described using Java or Python ('though as mentioned, perhaps not using PyGame).

#10 CaptainKraft   Members   -  Reputation: 266

Like
0Likes
Like

Posted 25 June 2012 - 10:45 PM

@jbadams

Your response has been the most helpful so far. Ever response in this thread has been, pretty obviously, biased and I appreciate your objective outlook. I expected a ton of subjective responses but it looks like you gave some much-needed input that really helps.

I'm still leaning towards Java, but you have definitely opened my eyes. Thanks for your time.

#11 smr   Members   -  Reputation: 1653

Like
1Likes
Like

Posted 25 June 2012 - 10:48 PM

Those looking for a free option might try Komodo Edit -- a free and open-sourced version of the above IDE -- obviously the free version has a significantly less impressive feature set (comparison), but it does still provide a good editing environment (syntax highlighting, code completion, etc.) which will probably be a more pleasant editing experience than IDLE.


There's also PyDev, an eclipse plugin. I've used it quite a bit and it's not terrible. At least the debugger works.

#12 smr   Members   -  Reputation: 1653

Like
1Likes
Like

Posted 25 June 2012 - 10:56 PM

Ever response in this thread has been, pretty obviously, biased


I'm not sure that's fair. While I said it is difficult to manage a large python application, that's my subjective opinion that I have formed after writing large python applications. As a language I am a big fan and I use it as often as it makes sense. Python is an awesome tool well suited to writing games as well as tools and in-app scripting. But I'd be a zealot if I ignored its weaknesses, the largest one being that is difficult to manage breaking changes in a large python application because there is no help from the compiler which in Java would be making sanity checks for you.

#13 jbadams   Senior Staff   -  Reputation: 18734

Like
0Likes
Like

Posted 25 June 2012 - 11:30 PM

Ever response in this thread has been, pretty obviously, biased and I appreciate your objective outlook.

To be fair, your question was very difficult to answer without any bias, and I think people have done a good job of expressing why they feel a certain way about each language rather than just stating an unexplained preference.

I think Serapth said it very well in the first reply:

There is a reason both language and libraries exist. If one was universally better than the other, the other would no longer have any users and would fade away into obscurity.

Frankly, all we can give you is opinions.


If you're comfortable with Java, then you should proceed with that option. Java is definitely capable of what you want to achieve, and in many cases people are better off just getting started even if their initial choices aren't necessarily optimal. Once you have some more experience you'll probably be able to re-evaluate your decision to see if you're still happy to stay with Java, but in the meantime it's a great starting point, and one that you certainly could continue using in the long run if you so wish. Posted Image

#14 SabreMan   Members   -  Reputation: 504

Like
0Likes
Like

Posted 26 June 2012 - 02:27 AM

I will just say that any performance considerations aside, it IS very difficult to manage a large python application. With Java or any other compiled language the compiler will find many of your errors for you. With python you will loath to change any interface or the signature of any function. Those changes will affect many different source files and you'll be debugging those changes instead of just fixing them before you can build it.

This is a case for automated unit testing, which should be carried out in any "large" application. Not that it always is, of course. The point is that process and procedure is just as significant to project success as is choice of technology.

Oh yeah, its horrific. IDLE is a real poor IDE, and there aren't really any better ones.

Eclipse + pydev is better.

#15 DvDmanDT   Members   -  Reputation: 897

Like
0Likes
Like

Posted 26 June 2012 - 03:54 AM

Just out of curiosity, has anyone tried the Python Tools for Visual Studio? [1] I haven't as I've never really had a chance to work with Python, but the feature set looks nice (supports CPython and IronPython, local and remote debugging, intellisense and signature help, refactoring, profiling, REPL, cluster support, Django support, ..) and can be used for free with the Visual studio shell.

[1] http://pytools.codeplex.com/

#16 smr   Members   -  Reputation: 1653

Like
0Likes
Like

Posted 26 June 2012 - 06:50 AM

Just out of curiosity, has anyone tried the Python Tools for Visual Studio?


I tried them and my initial impression was that they were very good, but I did not use them very much.

#17 Shippou   Members   -  Reputation: 1548

Like
0Likes
Like

Posted 26 June 2012 - 07:38 AM

Python's IDEs mostly, well, suck. Or people just use a text editor. Java on the other hand has Eclipse ( which I hate, but others love ) and NetBeans ( which I love and others hate ), a good IDE will really help when you are starting out.

Python can be ported to Eclipse ( I have Python 2.6 and Jthon on it ), and if you want a good independent IDE for Python, try Pyscripter.

My opinion on the subject at hand:

** Bad things about Python **

Language differences. Python 2.x and Python 3.x are quite different.

Most helpful addonns to Python are * very * outdated.

Python community is almost dead.

Most python tutorials are very outdated.

Python runs slower than Java

Completed Python programs are frustrating to compile and distribute

Integrating Python into * anything * is difficult

Python does not naturally support very much, were as Java does. You'll spend weeks trying to find relevant addons for Python so it has the functionality you want. Good luck finding addons that are compatible with whatever version of Python you desire to use - most are very outdated, and not maintained.

** Bad things about Java **

Java language is abstract, and can be frustrating to figure out. Knowledge of how the language C works is very helpful.

Most java community are very unhelpful, referring questions to incomprehensible tech documents

Hard to find relevant information on specific programming questions

** Good things about Python **

Very easy to learn language.

Very fast program development

** Good things about Java **

Can do almost anything in Java with out addons

Can be integrated into almost everything

Edited by Shippou, 26 June 2012 - 07:42 AM.

 Reactions To Technologies:
1. Anything that is in the world when you’re born is normal and ordinary and is just a natural part of the way the world works.
2. Anything that's invented between when you’re fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it.
3. Anything invented after you're thirty-five is against the natural order of things.

- Douglas Adams 2002


 


#18 CaptainKraft   Members   -  Reputation: 266

Like
0Likes
Like

Posted 26 June 2012 - 08:32 AM

Ever response in this thread has been, pretty obviously, biased and I appreciate your objective outlook.


This probably sounded much worse than I meant it too haha. Biased was poor choice of words. I didn't mean to say that I don't appreciate everyone else's help, because I really do.

Thanks a ton for the input. Even though all the answers will be opinions, it will still help me out... especially because that is what I am looking for.



#19 Serapth   Crossbones+   -  Reputation: 5485

Like
1Likes
Like

Posted 26 June 2012 - 09:19 AM

I have tried using the Python addon for Eclipse; I don't particularly remember the experience being pleasant. That said, I dont like Eclipse, it is far too over engineered and could use with a thousand layers of usability polish. Plus, it is fragile as hell for a plugin based IDE. If I recall, the best IDE I found for python development was Komodo. I used the plugin for Visual Studio with Iron Python on one project, but I dont really remember the outcome.

As to Java, there is one GIGANTIC flaw. It is a language rooted in academia and consulting, and it shows. Everything is just too over engineered. Far too often logic is moved out to an XML file, which is wonderful if you are a consulting firm redeploying canned solutions and paid by the hour if something breaks, but is a right pain in the ass for normal developers if something breaks. Beyond that, as I mentioned earlier, Eclipse is almost laughable in the everything and the kitchen sink approach. This is why I like Netbeans far more, it is by an order of magnitude simpler. Then we could get into ANT and even worse, Maven... my god do I hate Maven. Again, it is a horrifically over engineered build system, and if something goes wrong... have fun! On top of that, there are 10 competing windowing systems, and 9.5 of them are complete crap. Finally, Java is quickly suffering from cruft, paying the price for some early on seriously boneheaded decisions in the standard libraries and it shows. C# suffers from this to a small degree ( and C++ to a GIGANTIC degree ) with non-generic datatypes for example, but in Java, its like fully half of the class libraries are crap that have been supplanted

#20 6677   Members   -  Reputation: 1058

Like
0Likes
Like

Posted 26 June 2012 - 11:32 AM

Just out of curiosity, has anyone tried the Python Tools for Visual Studio?

Yes, I don't know why but I didn't enjoy the experience much, intellisense is supposedly claimed but on 3 seperate installations its not worked properly either A) not being able to detect functions I've written (the code worked fine when compiled with ironpython) or B) when it does find it it might take so long to pop up with the little drop down box of stuff that I've already written my entire line of code. Cpython support seemed to consist of you opening your documents and manually running the .py file which is fair enough as I used to do that with GEdit and IDLE (idle used to irritate me, I wanted to see what my program looked like in the command line not in what looks like another text editor).

Pydev I haven't tried (but I do actually have installed, I should try it)

My preferred python IDE now is sharpdevelop, technically its for ironpython not CPython but I prefer ironpython anyway so for me thats not an issue. Its intellisense equivelant works very well and I get access to most .net libraries including XNA if I wanted (its been done although I've not tried it), I believe it is faster than CPython but I think it is still meant to be relatively slow, the only major irritation for ironpython for me is the tab vs spaces argument. Sharpdevelop insists on tabs or gives an error (whether iron python on its own does this I don't know), CPython it is common practise to use spaces not tabs (although its always worked fine with tabs for me, yes I did have tabs to spaces turned off when I tested this). Means loading external .py files written for CPython or copy paste jobs often don't work without manually swapping all the spaces for tabs (I should really find a tool for that)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS