+ 2
Why is java not recommended in modern game engines
Miscellaneous question
4 Réponses
+ 4
Java and Kotlin would actually be the best languages for games specifically designed for Android mobile applications.
Other than Android, you're much better off using other languages. Why? I'll explain with some cases below.
c# and c++ can be optimized to perform more efficiently in Windows. These languages work better with DirectX or OpenGL because they have better libraries for them. Java's OpenGL graphics packages for desktop operating systems are less efficient and completely outdated. It would be hard to make a game look more modern than 2010 since packages like Java OpenGL(JOGL) are so outdated.
For iPhone, iPad, and any other iOS devices, Swift is better than Java. Swift is better because that's what Apple strongly promotes and almost forces on every Apple developer. You'd have a horrible challenge running Java in iOS or getting it approved by Apple's reviewers let alone impressing your gamers enough to pay for it.
If you want a game for a website, you simply can not use Java. You must use JavaScript. You could make something with a language compiled to WebAssembly or languages like TypeScript that transpiles to JavaScript but JavaScript is required. People could play games in Java applets when those were well supported but Java applets are officially deprecated now and most people don't enable or install what is necessary to run them. Java applets were popular from roughly 2000 to 2008 or so.
0
Martin Taylor
I have but I am not sure of its feasibility
0
On Android, you better still use C++ for MOST of the heavy lifting. On iOS Swift still can call C/C++ code if needed no big problem.
After all, one of the biggest problems is not the language itself but mostly comes down to which low-level lib you can call with it.
On the performance side, Java on AVERAGE "only(because in the end, it's a VM)" slower than C++ equivalent code(such as on game logic/NPC AI) optimally by around 30-50% GIVEN you have big and fast enough memory that's not bottlenecking the code execution itself by triggering GC constantly(30-50% is around 1-2 years of CPU hardware improvement now 2023). On C++, the programmers usually are more experienced with computer architecture, and the memory is managed more carefully manually by them when the timing is appropriate.
And this is not accounting modern game engines make heavy use of SIMD instructions(such as on physics simulation) which is way faster on some operations than what JVM can provide now.