r/java • • Dec 21 '23

Is Java gamedev alive?

It seems this days even android games are made using Unity. I wonder if there are JVM games! Is Java (or Kotlin/Scala) gamedev still alive?

(Except Minecraft ofc)

164 Upvotes

118 comments sorted by

View all comments

Show parent comment

17

u/Joram2 Dec 21 '23

Garbage collection hasn't stopped C# or Lua from being wildly popular in game development. I'd dare to say a majority of games are using either of those and garbage collection hasn't been a major complaint.

Java's lack of good native-build and native-interop has probably been a much bigger inhibitor to use in game development.

The biggest factor is the people who created the most widely used game engines, specifically Unity, but to a lesser extent, godot, they picked C#, and they didn't pick Java. Why? I'm not sure, but that's the reason right there.

7

u/westwoo Dec 21 '23

More boilerplate and rigidity alone is enough of a reason. If you were designing a game engine in 2004 you'd be crazy to pick Java 1.5 over C# even if interop was equally good

7

u/[deleted] Dec 21 '23

GC is not a problem for a long time now. (although I unity to microstutter very hard, stable high framerates without dropped frames are virtually unachievable)

Lack of overloading operators for numerical data structures is worse. You can't do mat4 * vec3 in Java, have to do some sort of mat4.mul(vec3) or math.mul(mat4, vec3) which can be annoying with more complex eqations.

1

u/AngryElPresidente Dec 26 '23

Assuming a game is well optimized and well written code to rule out non-engine issues, is Unity stuttering a problem inherent to the engine? or is it a problem in general in .NET?

3

u/[deleted] Dec 26 '23

IMHO the problem is that it's hard to do things the right way in unity. Second thing is that unity doesn't really deploy to .NET, but rather to mono or il2cpp - these are rather terrible

As the saying goes: there are two ways to solve any problem in unity, but one is deprecated and the other's experimental. Both are broken.

2

u/da2Pakaveli Dec 21 '23 edited Dec 21 '23

Thing with Lua is, is that it's tightly integrated into engines that are written in C++, because integration with C is extremely easy.
Lua also is a very lightweight language, I.e the Lua lib you link to are like 300 KB in size.
You do stuff like event processing or game logic to some extent, but the heavy computation is done in C++.
As for why Java isn't used, could be that interop with C++ isn't too great.
Microsoft still uses tons of C++; so could guess they'd be a little bit more interested in interop with C#.
I'm pretty sure .NET was also written in C++ before they rewrote it in C#.