After having read kev’s post on reasons why Java is a good development choice for game programming I felt it necessary to balance things out with a list of reasons why Java is not a good choice.
[1] Native libs. Currently the only way to get decent graphics performance is to use native libraries. Native libraries such as LWJGL rely on the fact that the player has a decent video card, otherwise the library won’t even open up a window. Most PCs have low-end video cards in them.
[2] Java2D’s performance is awful. Even when using the hardware accelerated graphics you still find that the game’s main loop stutters and lags.
[3] Bloated API. Many method names and class names are stupidly, anally long. For example, how many times have you had to type System.out.println(“some string”);? This is a ridiculous amount of typing for such a simple task.
[4] The garbage collector makes games slow and unpredictable. Good time management is a crucial aspect of any game. When you think about it a large chunk of the playability tuning that goes on in game development comes down to adjusting the timed appearance of game objects such as aliens and other moving objects. For a large game, the garbage collector makes it nearly impossible to perform synchronised screen updates.
[5] Write once, run anywhere is a complete myth. It is write once, debug everywhere and if you are writing applets then that means testing it in IE, Mozilla & Opera running on a combination of Mac, Linux and Windows. Because of the run anywhere myth developers rarely take the time to produce different versions of their software tuned for different machines, something that happens in the C++ world all the time as a matter of routine.
[6] The lack of function pointers is a major pain in the arse. Having no closures is also a major pain. True, Java has anonymous inner-classes but anonymous inner-classes are ugly as Hell; they hang off your code in the editor like a wart.
[7] The security restrictions on applets have rendered them almost useless; you can’t even read and write a temporary cache which means that games can’t save state for the player. Games that force a player to revisit completed levels are a bit lame.
[8] Size. At 14.5Mb the Java runtime is a huge lump of code for a casual game to be dependant upon. Flash games use only a small 1.8Mb runtime.
That’s it for now. I’m sure if I thought about it I could come up with a much longer list, but for the moment I think the above pretty much covers it for me. What are my top hates for programming games in Java? Number one is the stutter and lag closely followed by the garbage collector which cannot be switched off.
–Mario