Myth: Java not suitable for video games

There seems to be a popular belief that the Java programming language is unsuitable for video game development, often citing either the runtime speed or the “power” of the language.

Today, I’m going to take a stab at putting this myth to bed; it’s not true, and those who tell you otherwise are misinformed and should be listened to only with a healthy grain of salt.

I’m a believer in the concept of “putting up or shutting up” — that is, you should be willing to back up what you say with solid evidence or you should stop saying it — and so I’ll start by providing some evidence to support my claims.  We’ll then take a look at why people might believe this particular myth, and examine some of the reasons Java might still not be suitable for your specific game.

The proof: Java is suitable for video games:

A simple case of proof by contradiction: if there are good quality games programmed using Java, then Java must be suitable for games.  Let’s look at a few notable games created with Java:

  1. RuneScape is a popular Java-based MMORPG which can be played in a web-browser window.  According to Wikipedia the game “has approximately 10 million active accounts, [and] over 200 million accounts created”, whilst this Java.com page lists “over 135 million users who have already discovered RuneScape”.  This is a very successful and popular game.
  2. Puzzle Pirates offers both single player-puzzles as well as a MMO puzzle-solving experience, and has over 4 million registered users.  The game is free to play, but offers premium content and subscription-only “oceans” (servers) as in-game purchases.  The game was originally released in 2003 and is still going strong today.  Again, this is a very successful title.
  3. Minecraft is “a game about placing blocks to build anything you can imagine”.  At the time of my writing, according to the official website “36,456,346 people have registered and 6,873,118 people bought the game”.  A stats page is provided on the website.  This game is fairly recent, and is a pretty well known smash-hit success.
  4. Spiral Knights is a newer MMOPRG with attractive graphics which opened to the general public in 2011 and reached 1 million user accounts within 3 months of launch, and has since exceeded 3 million.  The game is free-to-play but offers premium features including the ability to start a guild.
  5. Wurm Online is yet another Java-based MMORPG featuring dynamic, player-constructed worlds, and has been going strong since a beta release in 2003.  This game presents a different experience than more mainstream MMO titles, but has a loyal player-base and is usually able to count the number of online players at any given time in the low thousands.  At the time of my writing there were a little over 3000 paying players currently active, and whilst this is lower than popular commercial MMOs it’s certainly nothing for an indie to scoff at.

Given these examples, it seems blindingly obvious that Java is suitable for at least some games.  There’s nothing about the language or platform that prevented these games from being very successful.  So…

Why do some people think Java is unsuitable?

There are a couple of reasons this particular myth came to be commonly believed.

The first is historical.  Java used to be pretty terrible for creating any non-trivial game.  The code was interpreted (newer versions benefit from JIT compilation) and there were therefore serious performance concerns.  There also weren’t as many libraries for would-be game creators as more popular choices such as C and C++ provided.

Secondly because Java — like any programming language — isn’t suitable for all games and some people unfortunately take that a little too far and decide that Java must not be suitable for any games.  There aren’t a lot of professional games (excluding the more recently popular Android platform) written in Java, and so many falsely conclude that hobbyist and indie developers should not use it either.

Thirdly Java is taught as an introductory programming language at many colleges and universities, often poorly, or well but not to a great extent, and so there are many bad or mediocre would-be programmers out in the world creating bad examples of software written in Java.  Any programming language will look bad if you examine poorly written software created with it, and unfortunately there is a highly visible wealth of such examples available for Java.  This should not reflect on what can be achieved if the language is used well, as in the examples given above.

Is Java suitable for your game?

Personal preference plays a huge part in the smart selection of tools and programming languages.  Many people — myself included —  simply don’t really like Java, and if you are one of those people then Java will not likely be a good choice for your next project.

Assuming you don’t have a dislike for the language you should next examine the libraries available to help achieve your goal.  What sort of game are you making, and are there libraries available to a Java programmer which will help make your life easier?  If there are, then you can consider Java as a good potential candidate for your project; if not, you may wish to look elsewhere.

Hopefully this helps to clear up some misconceptions about the suitability of Java.  Like any programming language, it isn’t for everyone, and it certainly isn’t suitable for all projects, but in the majority of cases it simply doesn’t deserve the bad reputation.  Be on the lookout for follow-up articles over the next week or two on why I personally prefer to avoid Java, and a look at some of the resources available to those who want to create their next game using the language.