You Can Make Real Games In Java!!! Yeah... But So What?
Yeah, there are still those annoying questions about whether or not Java is fast enough. "Yes" we say pointing at 800 3D animated vikings running around on a lush, fully rendered tropical Island, "anything you can do in C++, you can now do in Java"
Problem is, as far as these guys are concerned, anything we can do in Java, they can do in C++. And they already know how to write games in C++, so proving equivelant capability is no real argument at all.
Cross-Platform? Well, cross-compilers for games have been around for a while, and when game companies are thinking cross-platform they're primarily thinking PC, PS2 & Xbox not PC, Mac & Linux, so Java's not really gonna help them there. Even if we do get Java on the PS2 and Xbox, cross-platform is still a moot point for those who are already doing it.
How 'bout memory management? You know, that wicked cool Java Garbage Collector? No offense to the truly brilliant minds who continue to catapult the JVM leagues ahead in power and capability with each release, but memory management in games, especially on constrained devices like consoles, largely consists of pre-allocating objects and disposing of them when you're done. Having a process you don't control eating CPU cycles in the middle of a tight game loop isn't really seen as a bonus
What about RMI? Object Serialization? Surely, with all these Massively Multiplayer Online Games (MMOGs) people are creating, it seems like the perfect place for Java. When you've got a few thousand people sending 10+ messages/sec over 56K modem lines, you've got to squeeze as much information into a single packet as possible. The last thing you wanna think about is writing out (and reading in) some graph of objects.
Security? nope. Threads? uh-uh. Applets? ...don't even get me started on Applets.
Okay, okay, before you send the hit squad, let me assure you that I don't think Java for Games is a lost cause. But maybe, just maybe, we're fighting the wrong fight.
See, Java is being used in commercial games - as a scripting language.
Chrome by Techland and Vampire: The Masquerade by Nihilistic are just two examples of a new trend toward using Java as the basis for writing the game logic and AI for a game. Why? One word. Productivity
Scripting languages are often used in games to provide a more intuitive, less error-prone way for non-programmers (ie game designers) to rapidly create, test and revise content for games. For these reasons, Java is starting to gain real acceptance in the games industry as the scripting language of choice
But that's not REAL Java!
Why not? Why must it be all-or-nothing? We provide all this support in JNI to enable developers to call native methods from Java and to instantiate the JVM from native code, yet we call it "Dirty Java" when someone actually uses it this way.
Maybe it's an ego thing. We know we're good enough to play the lead and don't like being cast in a supporting role. But, as they say in Hollywood, "There are no small parts, only small actors" Instead, maybe we should look on the adoption of Java, in any capacity, as a real step forward for Java in an industry that had long ago dismissed it.
Because clearly the stigma around using Java in games is weakening and the advantages of using it are starting to be recognized, something those of us being paid to promote Java can point to with pride.
So what about JOGL, JOAL and JInput? If demonstrating you can make real games isn't going to make game developers switch, why bother?
Because, as far as I'm concerned, getting game developers who are currently working in C++ to switch isn't really the point.
Removing the barriers to entry for Java game development means Java developers, like you and me, can begin writing real games that take advantage of the true power of the platform. It means that students learning Java in college (because the learning curve is easier and they spend less time debugging) will have little or no reason to switch to C++ when it comes time to start making games themselves.
Because as far as I'm concerned, developers who don't want to switch, don't matter
At the end of the day, the publishers don't care whether a game's been written in C++ or Java as long as it kicks ass, so the longer professional game developers stubbornly refuse to take advantage of everything the Java platform has to offer, the better it is for the rest of us.
So stop bitchin' about what other game developers aren't doing and go write some cool games! :-)
Edit: Yes, I realize that for a whole host of reasons, a significant percentage of commercially available mobile games are written in Java. While that's absolutely fantastic, this blog is directed at the "mainstream" universe of PC and console games