Sign in to follow this  
InsaneBoarder234

[java] Java for game dev?

Recommended Posts

I'm studying java as part of my university course so I was thinking about doing a 4e6 entry in java in order to boost and strengthen my skills. I already have a fairly good understanding of C/C++ so that side of things isn't a problem, I'm just wondering what other people think of java with regards to game development? What is it like performance wise? Are there many (any?) "libraries" out there to aid in java game development? If it matters at all, I don't plan on doing any kind of 3D graphics for this project if it goes ahead.

Share this post


Link to post
Share on other sites
SimonForsman    7642
Quote:
Original post by InsaneBoarder234
I'm studying java as part of my university course so I was thinking about doing a 4e6 entry in java in order to boost and strengthen my skills. I already have a fairly good understanding of C/C++ so that side of things isn't a problem, I'm just wondering what other people think of java with regards to game development? What is it like performance wise? Are there many (any?) "libraries" out there to aid in java game development?

If it matters at all, I don't plan on doing any kind of 3D graphics for this project if it goes ahead.


performance is(or was, havn't looked in quite some time) slightly behind .NET and a bit ahead of mono(or atleast it was last time i looked at mono). (if you're using suns JVM , i don't know how the others perform). Either way both .NET and Java was fast enough last time i looked and should be more than fine today.

As for libraries you probably want to look at LWJGL (bindings for OpenGL and OpenAL) (There are ofcourse other libraries aswell as some engines you can use)
(Oh , and despite what some people say, LWJGL works fine in applets or with Java webstart aswell (you just get a security warning since LWJGL executes largely outside the VM))

Share this post


Link to post
Share on other sites
actually my personal opinion (and also that I was told) Java performance is not that far behind any longer. There are bindings for opengl and (I guess) even DirectX. So you have all the hardware accelaration you get with c/c++ too.

If you consider to use Java for games professionally I would suggest to go a step deeper into J2ME (Micro Edition) for celluphones, there is the bigger java market so far.

And (if you haven't knowen so far) there is the JMonkey engine. I haven't worked with it so far, but it realy looked great.

One benefit Java has (and shares with C#) are the applets. With a little fantasy and java (or C#) you can do great things on the upcomming browser game market (I forgot the name of the MMORPG as applet, made by an british company).

But if you allready have a good understandig of c/c++ stick to it, but a mix (with Java) can never be wrong.

Share this post


Link to post
Share on other sites
Promit    13246
Quote:
Original post by Promit
The people who have paid any attention to Java (read: almost nobody who does anything vaguely serious with graphics) know that performance isn't really a problem for it. (Ironically, most of Java's performance issues are with desktop apps that are GUI heavy, because of how badly written the Java UI libraries are.) What IS a problem:
  • Poor SDK and library support. Nobody supports Java or is even interested. This one will probably never change. Of course it's caused by...
  • Extremely poor interoperability support. JNI is just a cruel practical joke on developers. Nobody is interested in doing this work, because of the monumental failure on Sun's part to do anything reasonable here.
  • Poor language expressiveness. Java is an extraordinarily dull, uninteresting, and weak language. It does an alright job of covering the basics, and stops there. There's simply no sophistication to the language. And thanks to the library support issues, integrating a scripting language is a pain too. (Could Jython help here? Hard to say.)
  • Java3D. This was the official 3D route from Java for some time, and whoever designed it was a complete moron (and probably had a Phd). JOGL has come into the fold now, but it's far too late for a lot of people.
  • Perception. Sun basically fed us a bullshit line over the last 10 years. While Java's more or less reached what was originally promised, people have a real bad taste in their mouth after it all.
That is why people no longer pay any attention to Java for game development. Hell, people don't even bother with applets anymore; that market was completely taken over by Flash.

Share this post


Link to post
Share on other sites
Aldacron    4544
There's a thriving Java game development community online. You can find game engines like JMonkey (3D) and Slick (2D), which use native bindings for OpenGL, OpenAL, and such via libraries like LWJGL (and the official Sun alternatives, JOGL and JOAL).

Promit's rather pessimistic list is a bit off. There are plenty of libraries out there that will help with game development, and most of those cover the cases where you really need JNI (for bindings to system APIs like OpenGL and OpenAL, for example). You can write complete games in Java without ever dropping to JNI yourself. The bit about language expressiveness is his own personal gripe. I'm an old C guy, but I quite like Java myself. Java3D is open source now and has improved from the old days, but there are much better options available like JMonkey (and it's not too late for a lot of people). As for his last point, the perception thing, that certainly is a problem. There's a lot of FUD out there, as Promit so aptly demonstrates, that is based on outdated, or just plain wrong, information. So that surely has contributed to Java's bad rep. I can't count the number of times I've seen people make a comment like, "I can't believe that's made with Java" after playing a Java game.

Hobbyists and indie shops have been using Java to develop games for years. Games like Puzzle Pirates, Tribal Trouble, Bang! Howdy and all of the PuppyGames stuff, are all made with Java. Now, it's starting to gain some traction in the mainstream industry as well. NCSoft's Austin studio has at least one Java project in development using the JMonkey engine (and several of their improvements to the code base make it back to the JMonkey's source repository). Perpetual, along with some other companies who haven't gone public about it yet, are integrating Project Darkstar (a.k.a the Sun Game Server) into their MMO pipelines. And of course, Java is ubiquitous on mobile platforms.

In other words, there's no problem with using Java for game development. The best place to go for help and more info javagaming.org. There, you'll find a number of people currently using Java for different game, and game-related, projects, who will answer your questions based on practical experience and point you in the right direction.

Share this post


Link to post
Share on other sites
alnite    3436
You are making a game for a contest, and probably your game won't be played by more than 1000 people. I am pretty sure Java's performance is more than enough for your game -- heck, I think it is even enough to create all sorts of 2D games, and you do not even need OpenGL bindings. There are far more important optimization issues that you should be thinking about to make yourself a better programmer.

There are Java optimizers out there for your micro-optimization needs. Check ProGuard, an open-source-industry-standard obfuscator + optimizer.




Unless you are making BioShock II, you shouldn't be worried about Java being too slow.

Share this post


Link to post
Share on other sites
coden4fun    100
Having been a student who studied java 3 years ago and know what was capable 3 years ago. I can assure you'll have no problem making your game, but don't be so depressed when you start seeing it lag unless they've fixed that.

Dang, I was gonna provide you a link to the 2d game that I made, but can't remember my old usename password for the site to grab the link.

Well in a nutshell the Java API supports 2D Graphics double buffering, and I think I saw some new article about java and active rendering, so just hearing about that java must be doing something amazing.

Given that, and the fact that most all cellphones use some sorta of Java RE, and most all games if not all use the Java technology to create the games for the cellphones.

I forgot to mention that what I do remember most about my game(Mario clone) I made in java while I was attending my AP Comp Sci class that taught us java was I didn't have to use any third party libraries whatsoever to make the game, and it wasn't that complicated as it would of been if I had just used C++ STL stuff to make a game. Hope this helps!

Good Luck

Share this post


Link to post
Share on other sites
Quote:
Original post by Woron kar DeDulle
there is the JMonkey engine.

Quote:
Original post by Aldacron
I can't count the number of times I've seen people make a comment like, "I can't believe that's made with Java" after playing a Java game.


Hehe, I just watched a demo video on the JMonkey website and I just have to say wow!

My only real experience with java (prior to uni) is with various GUI based applications and applets. I've never been keen on these, they never seem to be very responsive or execute fast, hence giving me the idea that java isn't great performance wise. Well now I've been enlightened somewhat!

Well I'm quite happy about using java for a 4e6 project, now I just need to get an idea down on paper (read .txt file)!

Thanks for the responses and links everyone :)

Share this post


Link to post
Share on other sites
Aldacron    4544
Quote:
Original post by InsaneBoarder234
Hehe, I just watched a demo video on the JMonkey website and I just have to say wow!


You must be talking about the hockey video. That's a good looking vid, but the one for Nord has more wow-factor, methinks.

EDIT: Fixed the link

[Edited by - Aldacron on October 12, 2007 8:34:42 PM]

Share this post


Link to post
Share on other sites
OrangyTang    1298
1. JavaGaming.org. Lots of links and discussion.

2. LWJGL. Binding for OpenGL, OpenAL, FMod and allows access to game controllers.

3. Slick. Fast 2D game library written on top of LWJGL and OpenGL.

4. JSmooth. Simple app which generates .exe wrappers around you jar files so windows people get a nice friendly exe to run.

5. Shameless self-promotion. [grin] Written with LWJGL.

Share this post


Link to post
Share on other sites
Quote:
Original post by Aldacron
You must be talking about the hockey video. That's a good looking vid, but the one for Nord has more wow-factor, methinks.


Your link is wrong :) But no, the video I saw wasn't *just* hockey, there were several games in there and overall I was very impressed by it all.

Share this post


Link to post
Share on other sites
Promit    13246
Quote:
Original post by Aldacron
There's a thriving Java game development community online. You can find game engines like JMonkey (3D) and Slick (2D), which use native bindings for OpenGL, OpenAL, and such via libraries like LWJGL (and the official Sun alternatives, JOGL and JOAL).
Physics? Scripting? Input? Video? Networking? (No, Java's built in network stuff is not good enough.)

Share this post


Link to post
Share on other sites
Aldacron    4544
Quote:
Original post by Promit
Physics? Scripting? Input? Video? Networking? (No, Java's built in network stuff is not good enough.)


There are a few physics options. JOODE is a Java port of ODE. There's a JMonkey physics package in development and, for 2D, there's Phys2D.

Scripting languages aren't really necessary in Java, since you can hotload classes on the fly and, with third-party libs, compile them on demand. But, that apparently seems like too much voodoo for most people, so there are a number of Java scripting languages out there. Where performance is a factor, pnuts and Rhino are the way to go. But Groovy and Jython are quite popular. There are many more, but I know nothing about them. Furthermore, Java 6 added a scripting framework to the standard APIs, so you can use a common interface to different scripting languages. The four I listed have implementations, as do several others.

As for input, the way to go is JInput, the cousin of JOGL and JOAL. This is used internally by LWJGL as well. It uses DirectInput on Windows, and whatever is appropriate on the other supported platforms. This allows game developers to use Joysticks, gamepads and other controllers not available through standard Java APIs.

Video playback is currently a problem. I don't know of any libraries that provide for this in a manner suitable for game programmers. This isn't an issue for most people currently using Java for gamedev, though it certainly can be for AAA titles. But, I suspect it's only a matter of time now that companies like NCSoft and Perpetual are using Java.

And for Networking, I wholly disagree with you. I haven't the faintest idea why you think that Java's networking isn't good enough, considering that the driving force behind Java for the last decade has been enterprise network applications. Unless you mean that the java.net and java.nio APIs are not high-level enough. In which case there's Apache Mina, JGN (JavaGameNetworking), and, at an extremely high level, Project Darkstar. Those are the ones I'm most familiar with, but I know there are a few more out there somewhere.

A decade ago, third party libraries had to be pushed down game developers' throats for the most part. These days, it's a chicken-and-egg situation. If nobody's using a language for game development, nobody's developing game libraries for it. If there are no game libraries for a language, nobody wants to develop games with it. The days of 'nobody's doing it' are quite over for Java. As time goes by, we are going to see more Java game-related libraries, improvements to existing libraries, and quite a bit of growth in the Java game space.

Share this post


Link to post
Share on other sites
Whackjack    100
Quote:
Original post by Aldacron
Quote:
Original post by Promit
Physics? Scripting? Input? Video? Networking? (No, Java's built in network stuff is not good enough.)


... snip ...

Video playback is currently a problem. I don't know of any libraries that provide for this in a manner suitable for game programmers.

... snip ...



I haven't used it myself, so I don't know how useful it is to game developers, but here is a (supposedly) good library for media playback:

FMJ - Freedom for Media in Java

Share this post


Link to post
Share on other sites
Jon914    184
Quote:
Original post by Promit(No, Java's built in network stuff is not good enough.)


Would you care to elaborate on that point? Many Java devs I work with shun the higher level libraries and prefer to work directly with the built-in stuff.

Everything else that Aldacron says is accurate and in touch with the current Java gamedev situation, and we all concede that movie playback blows right now, but everything else is improving by the day.

For 2D, Slick and Phys2D together make a killer combination, and for 3D, jME is the way to go.

- Jon

Share this post


Link to post
Share on other sites
signupsucks    100
Quote:
Original post by Jon914
Quote:
Original post by Promit(No, Java's built in network stuff is not good enough.)


Would you care to elaborate on that point? Many Java devs I work with shun the higher level libraries and prefer to work directly with the built-in stuff.


No, he doesn't need to because he is a moderator. That means that he can go around trolling as much as he wants and if you don't like it then all you can do is to get angry about it.

Among the misinformation he spreads around the most incredible one was about "scripting languages". Did he pass the last 10 years with his head stuck up in his ass? From what planet did he come from? Java had scripting languages, and frameworks for plugging them into the JDK, long before it was included in the standard JDK (that means before .Net existed). Today there are many production ready options around, some developed by Sun itself.

This idea that somehow it's impossible to run other languages on top of the JVM could only from a cheerleader type of guy that doesn't have the slightest idea of how things work. He must be one of those that believe that .Net is faster than Java (because Microsoft said so) and that Visual Studio is the best IDE (because he doesn't know any other or doesn't care to know).

For the record, Naughty Dog created their own Lisp for producing PS2 games. C and C plus plus (or even C#) are hardly the only options for game development. It just takes a little of imagination to see ways of improving the life of developers.

There are a few things that I don't like about Java, but vast majority of the Java bashing you see on the internet is just bullshit. This guy Promit has set a new world record by not getting a single fact right.

Share this post


Link to post
Share on other sites
pinacolada    834
Quote:
Original post by signupsucks
No, he doesn't need to because he is a moderator. That means that he can go around trolling as much as he wants and if you don't like it then all you can do is to get angry about it.

Among the misinformation he spreads around the most incredible one was about "scripting languages". Did he pass the last 10 years with his head stuck up in his ass? From what planet did he come from? Java had scripting languages, and frameworks for plugging them into the JDK, long before it was included in the standard JDK (that means before .Net existed). Today there are many production ready options around, some developed by Sun itself.

This idea that somehow it's impossible to run other languages on top of the JVM could only from a cheerleader type of guy that doesn't have the slightest idea of how things work. He must be one of those that believe that .Net is faster than Java (because Microsoft said so) and that Visual Studio is the best IDE (because he doesn't know any other or doesn't care to know).

For the record, Naughty Dog created their own Lisp for producing PS2 games. C and C plus plus (or even C#) are hardly the only options for game development. It just takes a little of imagination to see ways of improving the life of developers.

There are a few things that I don't like about Java, but vast majority of the Java bashing you see on the internet is just bullshit. This guy Promit has set a new world record by not getting a single fact right.


Wow, you talk a lot without saying anything of substance.

Regarding scripting languages on the JVM, no one here said that they were impossible. Promit's exact words were "integrating a scripting language is a pain". Obviously he knows that you can run other languages on the JVM, as he mentions Jython.

(Personally, I've worked with Jython and Jruby, and yes the integration is kind of a pain. But I wouldn't say it's any more hard than integrating a scripting engine with any other language.)

If you have gripes with any of Promit's other statements, please explain what they are. Making blanket statements in the form of "everything that dude says is wrong!", is the opposite of helpful.

Share this post


Link to post
Share on other sites
signupsucks    100
Quote:
Original post by pinacolada
If you have gripes with any of Promit's other statements, please explain what they are. Making blanket statements in the form of "everything that dude says is wrong!", is the opposite of helpful.


Please read the thread, the answers are all there.

Scripting languages like Scala, Ruby, Groovy, javascript and many others are all over the place. Not knowing for example that the JRuby people were hired by Sun for developing JRuby for the JVM and that it has excellent support on NetBeans for example is evidence enough that he doesn't have a clue of what he is talking about.

Oh yes, he didn't explain anything about "network being not good enough". I think he is the one that must explain himself, the other participants of the thread already answered the original question pretty well with information and links for libraries.



Share this post


Link to post
Share on other sites
Promit    13246
Quote:
Original post by Jon914
Quote:
Original post by Promit(No, Java's built in network stuff is not good enough.)


Would you care to elaborate on that point? Many Java devs I work with shun the higher level libraries and prefer to work directly with the built-in stuff.
Since .NET and Java's networking facilities are for all practical purposes identical, I'll point you to Lidgren as an explanation of what's missing. It essentially saves you the trouble of writing a protocol layered on top of UDP, since TCP is a non-starter for most real time games. (For enterprise junk it's fine, which is why Java seems just fine to most. Remember, it's exactly the same with C#.) Then you have other niceties like simulation, throttling, encryption, etc. I'd comment on JGN, except that all I see is a forum and no description of what the hell it does.

I have a powerful disdain for ODE, but I'll grudgingly admit that ODE bindings for Java are at least adequate, if not ideal. JMonkey is not something I can glance over quickly, although it'll be some kind of miracle if it manages not to disappont me. That's ok, my standards are not often reached on that front. JInput doesn't appear to suggest any support for Java 1.5 or 1.6? The video playback thing is unfortunate, but not worth making a big deal out of. Most indies don't have videos to play anyway, and most studios are not interested in Java anyway. Of course, if FMJ does the job, then that's that. I mean it can't really be worse than DShow, right?

Oh, and this thread is not high priority on my radar. Truth is I think anyone working in Java to make games is basically just wasting their time. (And if you're waiting for me to back that claim up, you're going to be very disappointed.) Don't be surprised if I don't bother to reply for a week.

Share this post


Link to post
Share on other sites
MaliciousDigit    105
After years of Java hating and working in C++, I'm starting to think that Java could be the future of gaming. Sound insane? Here me out.
I developed my app using DirectX and C# earlier this year. I put it on sourceforge and allowed people to download it for free. It got some minor attention.
I started thinking about ways to distribute an app and make money at it. Who would buy an indie app? What if a time limited demo doesn't make sense for your app?
I had already seen a few JOGL demos and was quite impressed at their ability to do 3D graphics as fast as C++. The idea of keeping work on GPU which I had been trained all these years with C++ mattered even more, but for many application types this was ideal.
Now i'm nearing a finish on my webcam app and i'm starting to believe in a first person shooter on a web page, using ads on the page to get some cash for my troubles.
No downloading, no installing, no cross platform maintenance. The user clicks his bookmark and starts killing. Java should be the future of PC gaming... Flash is too expensive :P.

Share this post


Link to post
Share on other sites
Aldacron    4544
Quote:
Original post by MaliciousDigit
Now i'm nearing a finish on my webcam app and i'm starting to believe in a first person shooter on a web page, using ads on the page to get some cash for my troubles.
No downloading, no installing, no cross platform maintenance. The user clicks his bookmark and starts killing. Java should be the future of PC gaming... Flash is too expensive :P.


My biggest gripe about Java, on the games front, has always been distribution. WebStart was supposed to solve the problem, but didn't. People with older versions of Java wouldn't have WebStart, which defeats the purpose. For some time, there has been a mechanism to automatically install the Java Plugin from an applet page, but that never really caught on. Applets suck. thanks to the way they cause a browser to lock up during load, so few people are using them. Now things are finally changing.

One of the big changes is that it will be easier to get the latest Java version, or just the version you need, installed on the user's machine from your web page. Another is that applet execution is being moved into a separate process from that of the browser. This eliminates the 'freezing browser' problem and also allows you to be able to set JVM arguments for applets, something that wasn't possible before.

Sun's got quite a bit going on to make Java apps easier to deploy and faster to launch. And with the ability to use JOGL (and LWGJL, too) from applets, I think a whole new world is opening up for game developers. You'll be able to code a complete game and, from the same code base, deploy it as a direct download (setup program), as a WebStart app, or as an Applet. No need for downloadable demos, just run the demo as an Applet. It's possible to do all of that now, but the applet problems make it much less than an ideal option. Some companies also do that now with C++ games, but it requires recompilation to link with whichever API they use for browser integration and, AFAIK, a bit of a different code path for app initialization. Then when you factor in the possibilities of easy integration with a J2EE backend on your website for different web interfaces to the game, the upcoming JavaFX platform, the Netbeans and Eclipse rich application platforms for game tools...

As far as I'm concerned, anyone sticking with C++ and not moving to Java, or even C#, for their game development really is wasting their time.

Share this post


Link to post
Share on other sites
Antheus    2409
Quote:
After years of Java hating and working in C++, I'm starting to think that Java could be the future of gaming. Sound insane?


No.

Java missed the desktop train years back, and has since then been almost actively trying to make everyone hate Java on desktop.

Java has established its presence on server and in large development projects. The advantages it brings there are undisputable, and have been proven over and over.

Due to its non-compromising rigid and pure language design, it has served as ideal platform to popularize design concepts, and all the "new" language paradigms, such as reflection, serialization and garbage collection.

But for desktop, C# makes a much better choice, and as was noted by some other developers, the "future" language has not been made yet.

This is unrelated to platform, but from "big picture" perspective, the only difference between C/C++ and "high-level" languages such as C#, Java or Python is garbage collection. Everything else is the same.

Share this post


Link to post
Share on other sites
Argus2    140
Promit is trolling, obviously. Whether Java is acceptable for game dev depends entirely on the kind of game you're looking to write. Java's advantages lie in scalability, development speed, and code maintenance. It is fast enough for most designs that require speed, but obviously for maximum performance look elsewhere.


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this