Java Is A Fast Programming Language, So Why Is It Not Used For Games Development?
Java is a very popular programming language, and it often dominates the most popular programming languages chart, or at least stays on the top of these charts. From a technical standpoint, Java doesn’t lack it when it comes to creating games. Despite all that, it’s not widely used for games development. This is a question I was curious about myself, since I do a lot of stuff with Java.
I talked about that briefly back when I compared Java VS C# VS Python. Since it’s an interesting topic, I decided to write a dedicated post for it, where I could talk about the main reasons why Java is not a widely used gaming development languages.
So, let’s get started~
Quickly go to:-
Gaming Engines Support
For the most part, game engines don’t support Java as the programming language. Or more like, the gaming engines world is dominated by C++.
Here’s the list of some of the popular games engines, along with the primary programming languages they use:-
|Game Engine||Programming Language(s)|
|Marmalade SDK||C++, Lua, Objective-C, HTML5|
|GameMaker Studio 2||GML (Game Maker Language)|
The dominance of C++ is obvious here, and it’s something we will talk about later in this article. To understand the big picture better, here’s a list of Engines used in the most popular games of 2019 as a sample:-
|1||Slay the Spire||libGDX||Java|
|2||Katana Zero||Gamemaker Studio 2||GML|
|3||Resident Evil 2||Custom|
|4||Risk of Rain 2||Unity||C#|
|6||Baba Is You||Clickteam Fusion|
|9||Touhou Luna Nights||Gamemaker Studio 2||GML|
|10||Bloodstained: Ritual of the Night||Unreal 4||Blueprints/C++|
|11||My Friend Pedro||Unity||C#|
|12||Oxygen Not Included||Unity||C#|
|16||A Short Hike||Unity||C#|
|19||Spyro Reignited Trilogy||Unreal 4||Blueprints/C++|
|20||Streets of Rogue||Unity (prototyped in Construct 2)||C#|
|21||Phoenix Wright: Ace Attorney Trilogy||Unity||C#|
|23||Devil May Cry 5||Custom||C++|
|24||Nova Drift||Gamemaker Studio 2||GML|
|27||A Plague Tale: Innocence||Custom||C++|
|29||One Finger Death Punch 2||Unity||C#|
|31||Sekiro Shadows Die Twice||Custom (?)||C++|
|32||Amid Evil||Unreal 4||Blueprints/C++|
|36||Yakuza Kiwami 2||Custom|
|37||Five Nights at Freddy’s: Help Wanted||Unreal 4||Blueprints/C++|
|39||Halo: The Master Chief Collection||Custom|
|41||Don’t Escape: 4 Days to Survive||Unity||C#|
|42||Forager||Game Maker Studio 2||GML|
|43||STAR WARS Jedi: Fallen Order||Unreal 4||Blueprints/C++|
|44||Tsukikage no Simulacre||???|
|45||Aokana||??? (Visual Novel)|
|46||Bug Fables||Unity 5||C#|
|47||Smile For Me||Unity||C#|
|48||A Dance of Fire and Ice||Unity||C#|
|49||Sayonarra Wild Hearts||Unity||C#|
While the use of C++ is still apparent here, many of the games are also made using C#, because of the popularity of the Unity engine, very few games in the list were made with Java. It’s apparent how the popularity of the engines themselves and their numbers can greatly affect the use of any given language in game development. That’s where C#, a language that’s similar to Java, managed to be used much more.
C++ is the gaming industry standard. As we saw just now, it’s the most used languages used by many engines. Including internal engines like Frostbite (used by EA). In a world where getting the most performance out of the system, C++ has been very important for the industry.
To answer why Java isn’t popular in gaming development, it’s a good way to know why C++ is popular itself.
Game developers invested heavily in C & C++, which created some sort of a network effect. They tend to reuse some of that C++ codes from a previous project in their newer ones.
C++ is used widely to develop games engines, which are in turn used to develop the games. Either with C++ as the scraping language, or some language the developer has mad.
Portability of C++ makes it easier to develop for many system, it allows you to your game to many systems relatively easily. That includes all the following systems:-
- PS Vita
- Wii U
- Nintendo Switch
And even more consoles than that. Giving how C++ makes it easy to communicate very close to the hardware itself.
In many ways, C# & Java don’t lack the technical capabilities to replace C++. It’s similar to how all sorts of software could be written and run on Linux, but the world is too tied to Windows for that to happen at a large scale (although you could personally still hop to Linux and do all sorts of things if you so desire, but you have to work for that to happen).
JVM Garbage Collection
Java’s performance isn’t that bad for creating games. Many people accuse garbage collection for causing severe frame drop every time it runs. That true to any language with garbage collecting, including C#. But if you coded your game in certain ways, where garbage collecting doesn’t need to happen all at once, you could totally avoid huge garbage collecting that could cause frame drops.
One way to achieve that is to allocate objects pool and keep reusing objects from there during the game execution. That way, the garbage collector doesn’t need to kick in, or at least it doesn’t have to run that much.
It’s worth noting that just like there are many implementations of garbage collectors for Java, and many are optimized for different things. One of them is the G1 implementation, which was optimized for concurrency, and can probably be used for games development. Specially giving how it allows you to set a certain pause time.
While the garbage collecting part of any language, Java or not, can affect its ability to implement games. I think the other factors mentioned in this article are more impactful to that. Unless you’re making AAA game, where performance is everything, you may not have to worry about garbage collecting at all. Indie developers have it much easier. ^^
Game Consoles & JVM
The major game consoles, like Xbox & Playstation don’t have Java Virtual Machine (JVM), so porting games written by Java isn’t that easy. Giving the importance of the consoles market, that makes java a less of a choice for universal gaming development. Even if you’re a small or individual developer, you have to make sure the engine or framework you use supports as many platforms you want. Many of the Java game development frameworks can be used to develop games for Windows, Mac OS, Linux, iOS & Android, which gives you a good reach of platforms.
Should I Use Java To Develop Games?
You totally can, and while I generally defended Java in this post. When it comes to games development, and software development in general, you have to use the best tool for the job, or to use the tools others are using to benefit from their contributions. If you plan to work in a game development studio in the future, then you have to learn C++ first & foremost, followed by C#.
You can totally use Java to develop smaller games, either for fun, or to see what you can achieve with it. Never develop games with Java because it’s the only language you know. If that’s the case for you, consider expanding your arsenal of programming languages, it will save you a lot of time in the med-term.
Things Are Different For Android Games Development
It’s worth noting that Java is the main language for developing all Android applications, including games. If you want to develop a game for Android only, and not any other platform, then Java is easily the language of choice, or one of your main options. The game can be ported to iOS later on if you so wanted. There’s also the option of developing games in a framework that makes it easier to develop games and port them to many platforms, but that’s outside the scope of this article.
Java Game Development Libraries
There are many frameworks for developing games in Java. Here are a short list of some of them:-
Games development is one of these domains that’s dominated by certain languages, and unfortunately, Java is not one of them. While it’s totally possible to use it for that, if we are to treat programming languages as tools, then it may not be your best choice.
From technical perspective, Java doesn’t lack the capability to develop games, and it’s not really that different from C#, which is a good language to consider if you don’t want to use C++ for whatever reason.
I hope you found my article useful, that it answered your question on why Java isn’t used for games development, and see you again in another article.
- What are business
- Java VS Python VS C# detailed comparison, which language to learn first? – Tech Fairy
- Do you need an Expensive motherboard for gaming? – Tech Fairy
- What is the meaning of the different USB port colors? (blue, teal blue, yellow, red, black)
- Why motherboards & laptops still come with USB 2.0 ports When USB 3.0 Is Backward Compatible?
- USB 2.0 VS USB 3.0 Comparison: What are the differences between the two ports?
- History Of Graphics card motherboard slots: PCI VS AGP VS PCI-Express VS Integrated graphics.
- What are the advantages & disadvantages of using a Trackball? And why you should use one
- What’s the difference between remake & remaster? (With multiple examples).