View Full Version : Considering Java & Python
CoLSoN
12-15-2003, 05:10 AM
On the one hand I'm considering Java for making games because I think it has great benefits BUT it also has some things that are IMHO great problems for the shareware market.
Benefits:
- I like A LOT the Java programming methodology, OOP and so on.
- Java has IMHO the _best_ IDE I've ever used (IntelliJ IDEA).
- It has the web-game thing that's something great to demos or little games.
- Completely multiplatform
Problems:
- If the user has not the JVM, it's a huge download and IMHO not much user friendly.
- Even without the JVM it seems to be a huge download (I say that based on what I've seen in Alien Flux, and I don't think it has "a lot" of graphics and sounds)
On the other hand, as a better option (as the problems I've seen in using Java are not very acceptable in this market) I'm considering Python.
Benefits:
- It's a scripting language so it's higher level than Java or C++ and you don't have to recompile
- It has a lot of libraries available that make game development easy like PyOpenGL, Pygame, PyUI and others for networking
- Completely multiplatform
- Making a .exe independent from the interpreter increases about 2 MB (compressed, including pygame, that uses sdl and other libraries)
Problems:
- I don't know of very good IDE's. I'm currently using WingIDE but after using IntelliJ all the others seem to be crap :)
- Well, it's not as fast as C or Java but for 2D simple games (or not so simple) it's ok
I'd like to hear people's opinion on this topic, thanks
Siebharinn
12-15-2003, 06:36 AM
I like python. The speed issue isn't really that big of a deal, since you can write an extension library fairly easily.
If I were starting a new game from scratch, I would seriously consider python. Any reasonably up-to-date machine is fast enough to make scripting languages viable for most games.
ggambett
12-15-2003, 06:55 AM
Python is great.
By the way, I wouldn't choose a language based on what IDEs are available. I'm pretty comfortable writing C++ source in a very simple IDE (it's a text editor with syntax coloring but nothing else) and compiling from the command line. On the other hand, if an IDE is critical to you, why don't go all the way and choose a "game making system"?
patrox
12-15-2003, 07:07 AM
You might consider using the lwjgl, i don't know how princess does it but his game doesn't require the jvm.
pat.
princec
12-15-2003, 08:03 AM
Embedded JVM. Sun are seriously dragging their heels getting me a fecking license to use it though. I only tried it as an experiment to promote the JVM a little more (I was using Jet).
The Game That Should Not Be Named is broken down as follows:
Game code 1.4mb
Sound effects 1.4mb
Graphics 6.4mb
Java 3mb
and I'm hardly really scratching the potential of Java to anything clever like downloadable code.
It's quite hard to see how the Java bit gets such a knocking for its size when we remember all the various other advantages it gives us. It's still a meg or so larger than I'd really but 3MB really isn't a big deal in a 12mb game (remembering that the game code itself is only 1.4mb)
The LWJGL is what you need for any kind of decent performance or reliability. The standard AWT / Java2D / Java3D technology is either unreliable, complex, or too slow; and the upcoming JOGL / JOAL / JInput stuff from sun is.., unreliable, complex, or too large.
Cas :)
Siebharinn
12-15-2003, 08:33 AM
- patrox -
i don't know how princess does it but his game doesn't require the jvm
LOL!!!
patrox
12-15-2003, 09:41 AM
I meant princec :eek: sorry !
pat.
MiceHead
12-15-2003, 09:53 AM
I'm a rabid Python fan; I've had good experiences with it:
The Windows version of our best-selling Palm puzzle game was written in Python.
The graphical client and server for our persistent-world game were both written in Python.
Most of our CGI scripts (forums, utilties, registration scripts) are written in Python.
Our website is generated via Python scripts based on HTML templates.
If I have my choice of languages in a situation, I'll usually go with Python. :) The #1 reason for this is that it cuts time-to-market down over development in C, C++, or Java. Some other (corrolary?) reasons:
Python's syntax is straightforward, and easily accessible to someone with knowledge of C++/Java.
Its clean handling of advanced data types makes it easy to accomplish complex tasks; conversely, I feel that the C++ STL and Java handle lists and dictionaries clumsily.
The built-in libraries (http://www.python.org/doc/current/modindex.html) make larger tasks easier, (e.g., retrieving a web page via URL can be done in two lines).
It scales well with larger tasks, (it works well for small CGI scripts as well as complete games).
It's a stable, mature language.
The language is updated regularly.
There are many resources available for it, (e.g., libraries, modules, code snippets (http://www.vex.net/parnassus/)).
It is open source, (and can be modified or extended), but its license is tailored so that Python can be used in commercial applications.
I also think that Python's approach to OOP is cleaner than Java's or C++'s, (as its creator was informed by both Java and C++.) But that may be personal preference. And while I just work out of Visual Studio, there are a number of editors and environments (http://www.python.org/cgi-bin/moinmoin/PythonEditors) that include Python support.
The language's largest drawback is that it trades execution speed for ease-of-development. It is not nearly as fast as straight C. It's also not as widespread as Java or C/C++; the latter can be more games-centric, in that more libraries exist to support multimedia functions. One solution to both these problems is to simply to interface to C libraries, (e.g., there are Python wrappers for Fmod), but if you're not careful, that could tie you down to a single platform.
All in all, though, I think Python is a great language for game development. In our current project, using Conitec's A6 Gamestudio (http://www.conitec.net/a4info.htm), our only option is to use its proprietary C-Script language to describe the game's behavior. Were I given the chance, I would not hesitate to give this up for Python.
Jeff Greenberg
12-15-2003, 10:52 AM
If you are going to go ahead and develop in Python, be sure to check out the following:
Pyrex (http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/)
Psyco (http://psyco.sourceforge.net/)
Standalone Installer (http://www.mcmillan-inc.com/install1.html)
I have to say that, along these lines, my favorite "scripting" language is currently Ruby. It is an awesome language (somewhat supperior to Python, IMO), but its user base isn't nearly as large as Python's, and it has some speed issues for things like games because it is interpreted directly from a parse tree, not from bytecode. This creates serious performance problems for things like nested loops and other related constructs, many of which you are likely to use in game programming. It also means the source is almost always available as plain text.
Still, check it out if you are interested: Ruby (http://www.ruby-lang.org/en/).
It is similar to Python, but more purely OO. Still, Python is wonderful to use and has such great libraries available, it is clearly the most popular of these types of languages currently available.
CoLSoN
12-15-2003, 11:14 AM
Thanks for the replies, I take note (specially those links, Jeff!).
I've already decided I'll go with Python.
BTW, has anyone tried PyUI?
Jeff Greenberg
12-15-2003, 11:36 AM
Another aspect of programming with Python that I like is that creating cross platform tools (whether for game programming or other) is relatively easy with wxPython (http://www.wxpython.org/) , Boa Constructor (http://boa-constructor.sourceforge.net/) and Python Card (http://pythoncard.sourceforge.net/) . Used with Python's built-in libraries and the extraordinary number of available third party libraries, these tools make creating your own custom tools almost easy!
The main reason why i didn't choose python as my first option was because it was very easy to reverse engineer your code even if it goes as an .exe. Sure, i know you can't escape from that. You will always get cracked no mater what... but with python it is very easy to break any kind of protection.
MiceHead
12-15-2003, 12:55 PM
The main reason why i didn't choose python as my first option was because it was very easy to reverse engineer your code even if it goes as an .exe.
This is a big concern; one solution we used was to simply re-order the bytecodes. That would make any automated decompilation more difficult.
Sidenote: I've worked with, and like wxPython, though I think it's geared towards non-gaming applications.
Jeff Greenberg
12-15-2003, 01:12 PM
Sidenote: I've worked with, and like wxPython, though I think it's geared towards non-gaming applications.
I agree, in general, though I was focusing more on its potential use for game programming tools, map makers, IDEs, that kind of thing.
MiceHead
12-15-2003, 01:30 PM
Ah, yes, you had posted that. Mea culpa. :)
illume
12-15-2003, 01:40 PM
Python is nice. I used it for my game holepit(http://www.holepit.com/).
Opengl has been my bottleneck not python.
Some 2D games written in python run nicely on my pentium 166mmx. In those games it is SDL which is the bottleneck.
PyUi is not so nice. Most people who have tried it on #pygame seem to dislike it.
Cross platform programming is really easy as well. If you make a game with SDL/pygame you can probably run it on different platforms with no changes, or possibly a few little changes. With python and opengl, your main porting challenge is opengl.
You can also use python to script the Gimp, blender, poser, truespace/gamespace.
Python vs java for game development: the only advantage java has is that it can run on mobile phone platforms. Python through pippi(palm python, that can run in 64K of memory) could also run, however no one uses it for games.
Python is probably faster to start up. Java jvm is slower in comparison. Java will produce faster running code a lot of the time. Allthough with psyco more stuff in python runs quicker.
Python is probably a smaller size distro. It's also open source. So if you need to make it smaller you can.
Productivity wise some could argue python will be more productive(others java :). However that is really down to the programmer. Some programmers are 20 times more productive than others.
Probably best to choose a language which is the most fun. You will be spending months coding in it, so might as well have fun doing it.
Both java, and python have been used to make games. Shareware, open source and comercial/retail.
Jeff Greenberg
12-15-2003, 02:16 PM
PyUi is not so nice. Most people who have tried it on #pygame seem to dislike it.
I haven't used PyUi myself, but if it is not to your liking, you could always try to use GlGooey (http://nwaldren.bei.t-online.de/glgooey.htm) with the Boost.Python (http://www.boost.org/libs/python/doc/) C++ libraries.
closer2sky
12-15-2003, 07:54 PM
I like Python.
I'm learning Python and Pygame.
BaseGolf(http://www.alitius.com/) is made in Pygame. :)
CoLSoN
12-15-2003, 10:12 PM
The main reason why i didn't choose python as my first option was because it was very easy to reverse engineer your code even if it goes as an .exe. Sure, i know you can't escape from that. You will always get cracked no mater what... but with python it is very easy to break any kind of protection.
Well, I think it has been discussed here many times; that those who crack your game or get your game cracked are not likely to buy it. Also, I think 30-year-old women or children won't reverse engineer your game ^^
princec
12-16-2003, 04:29 AM
As the Java VM starts up in under a second it's a bit salty trying to swallow the claim that that gives Python an advantage... and even so, startup time is probably not something one need be too concerned about. The real issues are of deployment and availability here, I think (the biggest advantage C++ has over all this stuff is that you won't be reliant on bundling a runtime).
Cas :)
I too am using Python/Pygame. I'd rate it as being an eensie bit trickier to get used to than BlitzBasic(or other Basics), but otherwise is comparable in ease and favorable in power - it's a "heavy-duty" language that lets you do sophisticated things when you need them done, with lots of *good* ways to get there. (Perl also gives you many ways to get there, but they aren't all *good* ones if you hope to maintain sanity...)
Everyone says it's not as fast as C/C++....but really, it only becomes a problem if you code something wrong or really try to push limits with hundreds of large, complex objects on a parallax scrolling background or something. I coded up a bouncing ball test with a large ball sprite and a few other moving objects that runs at a smooth 60 fps just fine. If you aren't planning on much more than that, Pygame will serve you well.
Python also seems more stable than either of the Java VMs under Windows. That's just a guess though.
princec
12-17-2003, 02:45 AM
The Java VMs are absolutely 100% rock-solid stable. Unfortunately some of the AWT code isn't (mainly caused by some slightly misbehaving drivers). Good thing I don't use any AWT :D
Cas :)