Why Java can be used for games
by Jacob Marner
Originally written June 15th, 2000. Last edited August 16th, 2001.
(Note: If you have read this article before you will see that the conclusions has changed and old outdated links are removed. This is because Java technology has improved since the article originally was written and many of things no longer was true. This article view of Java is based on the use of Sun's JDK 1.3.1.)
IntrodUCtion
Often when I tell people that I am writing a game in Java they sniff and say something like "You must be kidding; Java is too slow", "Real men don't program Java", or "Java is not a real programming language". This opinion is very often caused by the fact that those people only have tried to run a Java applet in their browser and have seen that it runs very slowly.
In the following I will clear up some common misconceptions and make sure that you understand that Java really is useful for game programming and C++ is not the only choice. I am not saying that C++ is bad or anything; just that using Java for a gaming project can be a real benefit that should not be missed.
This articles is generally targeted at C++ programmers that are wondering or skeptical about whether Java can be used for professional games.
To understand this article you need some general programming eXPerience and at least a basic knowledge of C++. Some basic knowledge of Java is also required, but reading a small tutorial somewhere should be enough.
This article assumes that the goal is to write high performance games similar to those boxed ones being released commercially for sale in stores. The target platforms we are interested in are the PC and consoles.
Also, we will not compare Java with other high level languages such C# or Visual Basic .NET, but merely consider Java when compared with the de facto game development language of today: C++.
Start by opening your mind
If you are a C++ programmer then you are probably very tired of all those Java evangelists back in 1995 claiming that Java is superior is every regard and that 100% pure Java is the best thing there is. Chances are that you tried it back then, saw how awfully it ran, and the dismissed it as a web development toy.
Fortunately most the hype surrounding Java has since then died out and the compilers and virtual machines has improved significantly.
We will now try to figure out what Java really is useful for.
I have heard the same hyped arguments and originally dispelled the use of Java as anything but a web applet language because of the many promises that was clearly not true. After all, if something needs justification then it is usually not worth the effort - usually.