Game Programming in Java
Miscellaneous Forums/General Discussion/Game Programming in Java
Hey Guys,
I was wondering what you guys thought about programming games in Java. There haven't really been (m)any commercial games in Java, besides Runescape and Puzzle Pirates, neither of which were particularly fast. Java has a history of being notoriously slow, though I've read many articles that disagree.
Also, Java seems to be kind of a dead language. All game programming in Java references I can find date back to 2004 at the latest (for that matter, most C++ game programming references date back to even earlier, even though most game companies still use it). Is there something about Java I'm missing? Any easy-to-learn alternatives (besides Blitz, which I know everyone will suggest)?
Thanks in advance.
I considered it a while back but never really went into it because I always thought Java was painfully slow.
Well you ask about easy-to-learn alternatives but you don't really say what it is about Java which attracts you. So I don't really know what features of Java you would want the alternative to include. The obvious alternative to Java is C#. C# is really Microsoft's take on Java. However, C# is nowhere near as portable as Java, so if that's your attraction to Java, you won't be interested. If the main attraction is publishing to a webpage, then perhaps Silverlight or Flash ( either Flash10, which is 3d accelerated and has a new version of ActionScript, or possibly with Haxe ) would be more suitable.
I don't think I would agree that Java is either dead or slow. It's not the latest new thing, but it's perfectly viable as a game development language. I've always found it a bit flaky compared to Flash, and a bit fiddly compared to BlitzMax or C# but it's perfectly viable if it suits your requirements.
I agree. I don't think Java is dead: it is updated frequently. Java isn't slow, and you can make applets with it, so you can play your games in a browser. An alternative is Flash, but Java is free.
I have only really used Java for mobile phone development via
http://mobile.processing.orgFor online Applets Java does well:
http://www.falstad.com/mathphysics.html
Thanks for the replies.
To clarify, Gabriel, I currently like Java because a) it's portable (but in my mind not as portable as something like BlitzMax, which doesn't require that the user install the runtime environment, even if it theoretically can't run on as many OS's as a Java program) and b) I'm currently taking a class in it, so it's like I'm learning a new programming language without having to find my own time to do so. It's also (relatively) easy to do something like a GUI application or a graphical program, compared to a language like C++, in which to the best of my knowledge extensive libraries are usually needed.
What I don't like about Java? The fact that it's slower than something always gets to me. Still, that gets to me when I compare C to assembly, so I guess I'll always have that factor. I also don't like in my head the fact that people must have Java installed to run programs, but I'm not sure if that's much of a restriction nowadays.
I'm not looking to make applets, only applications, so I don't care about usage within browsers.
I also hate how bigger Java programs usually have fairly long loading times, though some things like Runescape manage to display their own loading screens (prefereable to either the Java icon or an endless white screen).
Does anyone know of any other commercial games written in Java?
Law and Order was written in Java. Maybe all the games in the series, but definitely the first one. Tribal Trouble is written in Java. Bang Howdy is another one. Bang Howdy is freeware, but it's commercial quality.
feel free to explore JME engine...its really beauty and modern features thing, java powered..
Thanks a ton, Gabriel. Glad to know I'm not alone.
Naughty Alien, thanks a lot! Beautiful screenshots; gives me new hope!
you welcome man..JME is incredible engine and very very fast..give it a try and you will see for yourself...and its really really features rich and modern..
and try to use it with Eclipse IDE...you will fall in love with it in no time :)
Slick is another one if you're interested in 2D in 3D..
http://slick.cokeandcode.com/Java isn't really any slower than other managed code languages. It JIT's to native code just like .Net (which has been proven already to be fine for game development)
I tried to compile JME and it was very complicated. I always go back to blitz in the end
I cant see what so complicated, since once you compile your libs you dont have to anymore..simply do coding over your project, and if you are lazy to do compiling there is always bin download(already precompiled everything, ready to use)..
Thanks, all.
One question, though: how significant is the speed increase for a 2D game to do 2D-in-3D with one of these libraries, as opposed to standard Java Graphics commands?
These are all written in Java with
LWJGL (which is a Java wrapper around native implementations of OpenGL and OpenAL, for Windows, Mac and Linux). Okay some of the games are pretty simple 2D things, but Tribal Trouble is a full 3D game.
LWJGE is really good, you should have no real speed issues using that.
Cheers
Charlie
@Buggy..
To answer your question, I believe the speed comparison issue really depends upon the intensity of the special effects and the hardware your game requires.
At one point in time (not sure if it's the case now), Java's rasterizer was software driven and/or uses the one native to the operating system (like GDI+ for Windows). Many of the modern native rasterizers utilize hardware acceleration in some of their commands, but I'm pretty sure they don't talk directly to the hardware drivers the way OpenGL and DirectX do for a majority of them..
I know there's been some inconsistency in performance between platforms because of this (Some native Java 2D commands run slower on a Mac than Windows or Posix-based systems because they rely on the platform's native rasterizer, which doesn't fully utilize hardware acceleration.)
If you're doing simple pong, 8-bit-ish super mario brothers, or something similar to an early Flash type of game, you can probably get away with the native commands.
If you want to do something quite a bit more graphically intensive like a modern 2D game you'd see on the XBox, PS3 or even Wii/DS, the OpenGL-bound solutions are probably the safer way to go.
One advantage of OpenGL-based APIs is that their focus is strictly on the graphics capabilities, or at least will follow the trend of graphics cards a bit more timely.
Java's got a lot of libraries in their framework. Supporting the latest/greatest implementations of a graphics API might not be at the top of their list.