• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Why don't more game dev's use Java?

bomblord1

Banned
Outside of a few notable exceptions like Minecraft I can't think of any "major" games written in Java and big engines like Cryengine and UE4 don't support it to my knowledge.

Java has a lot of advantages and is one of the most popular languages used according to some metrics.

It also has the advantage of write once run anywhere. I know this isn't universally true but if I write a program that isn't using some kind of platform dependent library or methods in Java it will more than likely run on PC, Linux, Mac, and Android without hassle.

It's also fairly easy to learn, write, compile, and debug when going against similar level programming languages. So I'm wondering why more games don't use it?
 

Durante

Member
Java is a terrible language. For one.

Though that's probably not the reason. One important reason is likely that garbage-collected languages were historically garbage (pardon the pun) for anything which requires consistent realtime performance.
 

Timeaisis

Member
It uses a virtual machine, meaning it has a lot more overhead than other languages.

It's great for lighter stuff and business software, but isn't as great when it comes to games. That being said, Minecraft and Runescape were both written in Java. So it can be done.
 

Zane

Member
It's slow as shit and not nearly low level enough for game dev, which relies on a lot of low level optimizations
 

Durante

Member
No it's not?
Oh, but it is. The whole boxing/unboxing mess, the major inconsistencies in its standard libraries, the slow adoption of essential language features such as first-class functions, I could go on but it's a bit OT.

I already edited what is likely to be one major reason into my original post.
 
You can use it but it's almost never the best tool for the job, especially not for performance-intensive applications, which includes most games.
 
It's remarkably slow and inefficient from a computational and memory standpoint, and if your goal is to maximize performance to allow for richer worlds and such, it won't be entertained for a second. Even C#'s usage in Unity is a hard sell for a lot of people, and only in the last 5-or-so years could it be entertained, and nowadays it's mostly for small games.

Remember Fez? Fairly simple game, technically? And it started to hitch on 360 after playing for extended periods? That was because of C#'s non-constant and relatively uncontrollable garbage collection. And C# is REALLY good at garbage collection, in ways that most JREs aren't.
 

Storm360

Member
Because it's awful for optimization for a start, games like Minecraft prove this.


Personally too, Java is too risky and I won't have it on my machine
 

georly

Member
Because it runs through an API and isn't low level enough. It's fine when your platform is the PC and performance isn't a huge issue because it's not very demanding, like minecraft.

Minecraft would run on even worse computers if it were in C or something.
 

Nachos

Member
When I took a computer science class for non-majors, I remember my teacher mentioning that Java doesn't support good memory management, or something like that. As in, it often clears the memory so frequently that anything more sophisticated than Minecraft would be impossible or an incredible headache. Though, maybe I'm just misremembering.

EDIT: Already being beaten/clarified
 
Because it's slow as molasses, and there are lots of issues with newer versions of Java breaking apps written for older versions. So a lot of times the apps need to be patched when Java versions get patched.

It's a big stinking POS.
 

El Phenicks

Neo Member
Oh, but it is. The whole boxing/unboxing mess, the major inconsistencies in its standard libraries, the slow adoption of essential language features such as first-class functions, I could go on but it's a bit OT.

I already edited what is likely to be one major reason into my original post.

Being a Java programmer for 7 years I say you're right. Java 8 doesn't even scratch the surface of what the competition is offering. It is a necessary "evil" though.
 

nynt9

Member
Java is a terrible language. For one.

Though that's probably not the reason. One important reason is likely that garbage-collected languages were historically garbage (pardon the pun) for anything which requires consistent realtime performance.

No manual memory management.

Oh, but it is. The whole boxing/unboxing mess, the major inconsistencies in its standard libraries, the slow adoption of essential language features such as first-class functions, I could go on but it's a bit OT.

I already edited what is likely to be one major reason into my original post.

Pretty much these. Game engines are about efficiency.

People complain about Minecraft performance all the time.

Being platform agnostic isn't necessarily good. It means you are a jack of all trades and master of none. Platform-specific to-the-metal coding is how you achieve performance gains.
 

Somnid

Member
Because the games that might use this can use the web platform which is even more simple, even more compatible and more mature. Nobody wants to install Java VMs either.
 

bomblord1

Banned
It uses a virtual machine, meaning it has a lot more overhead than other languages.

It's great for lighter stuff and business software, but isn't as great when it comes to games. That being said, Minecraft and Runescape were both written in Java. So it can be done.

Java's JIT solved most the overhead problems.
 

Zukuu

Banned
Java is fine for a lot of stuff. Games just isn't one of them, in particular in a world where unity and unreal are available on the market for cheap.
 

Noobcraft

Member
Because it runs through an API and isn't low level enough. It's fine when your platform is the PC and performance isn't a huge issue because it's not very demanding, like minecraft.

Minecraft would run on even worse computers if it were in C or something.
Isn't the console version of Minecraft written in C++ to make the performance better?
 
No it's not?

lol cute...

no really, please explain why it is not.

I hate Java with the passion of a thousand fiery suns. But it is a major language in what I do day to day. So it pays the bills but god it's a pos.

Edit: Let me be a little more clear. Java overhead, at least for some legacy stuff is a nightmare. I am not saying Java is bad, just with what I do it is a nightmare. Resource management is also like walking a tightrope at times. Java is not the devil but with what I specifically do on a day to day basis it hinders more in my day to day operations than helps.
 

El Phenicks

Neo Member
Because it's slow as molasses, and there are lots of issues with newer versions of Java breaking apps written for older versions. So a lot of times the apps need to be patched when Java versions get patched.

It's a big stinking POS.

This is a common misconception, Java code runs as fast as C++ code once the VM is properly warmed up.

I've never seen newer versions break legacy code though. Even with most things beeing deprecated they mostly still work fine. SUN isn't stupid.
 

Social

Member
Well it's very comparable with Actionscript 3 in terms of syntax and while I adore that language and owe a lot of my current life to it, it's not a very efficient language at all.
Like people say here, the memory management, it's quite bad and there is a lot of overhead too.
 

Hari Seldon

Member
I'm not a game dev, but it seems to me that using the java rendering compared to OpenGL or DirectX seems like it would only work for very light indy games.

The memory management stuff, I think that is less of an issue. Lots of games are written in C#.
 

Nirolak

Mrgrgr
What do they mostly code in? C#?

Sometimes gameplay is written in Python or C#, but most engines will have people use C++ and sometimes drop down into assembly for things like math libraries.

Efficiency is very key to game performance. Any inefficiencies will get a language thrown out. C# is only used in Unity because the people using it are largely not expected to very proficient and have efficiency of development as their #1 goal by a very large margin.
 

Kyuur

Member
Because it's slow as molasses, and there are lots of issues with newer versions of Java breaking apps written for older versions. So a lot of times the apps need to be patched when Java versions get patched.

It's a big stinking POS.

You can deploy your own JRE with your application, so this is bs.
 

bomblord1

Banned
I'm not a game dev, but it seems to me that using the java rendering compared to OpenGL or DirectX seems like it would only work for very light indy games.

The memory management stuff, I think that is less of an issue. Lots of games are written in C#.

Java has OpenGL libraries.
 

RPGam3r

Member
This may be an odd tangent, but with MS at the helm of Minecraft is there a chance for the game to be transitioned over to another language (as was said by other(s) in this thread Minecraft performs poorly)?
 
I'm waiting to hear why it's bad first. It's a modern programming language that is platform independant.
Platform independent also means that optimization is pretty much impossible. Like everyone has said: memory management, garbage collection, etc.

If you look at games if the past, and how people were squeezing every bit of memory out (pun intended) just to fill in textures, or do data allocation, you quickly realize that sort of stuff isn't available to you in Java.

It's good for learning and things that would need virtualization, but then that's also your downfall. Making sure every virtualization works exactly the way you intended (as most games would, for something as simple as drawing something on screen) is probably not it's strong suit.
 
I'm waiting to hear why it's bad first. It's a modern programming language that is platform independant.

Yes you are right it is a modern language. And yes you are right it is platform independent.

Problem with modern languages is not that they are new but that a lot of legacy stuff already in place is a pain in the ass to handle when you implement newer systems in place with Java (they don't play as nicely as the pro java/vendors would have you believe)
 

bomblord1

Banned
Platform independent also means that optimization is pretty much impossible. Like everyone has said: memory management, garbage collection, etc.

If you look at games if the past, and how people were squeezing every bit of memory out (pun intended) just to fill in textures, or do data allocation, you quickly realize that sort of stuff isn't available to you in Java.

It's good for learning and things that would need virtualization, but then that's also your downfall. Making sure every virtualization works exactly the way you intended (as most games would, for something as simple as drawing something on screen) is probably not it's strong suit.

You can't manually manage memory but you have some decent control over the garbage collection protocols if you're trying to optimize your code.
 

bomblord1

Banned
Yes you are right it is a modern language. And yes you are right it is platform independent.

Problem with modern languages is not that they are new but that a lot of legacy stuff already in place is a pain in the ass to handle when you implement newer systems in place with Java (they don't play as nicely as the pro java/vendors would have you believe)

Care to elaborate? Can you give me specific examples to I can better understand where you are coming from?
 
No. A game dev can confirm (or deny), but historically, it has been C and C++. C# and Java aren't quite "too the metal" enough, though I suppose they can be and are used on indie games.

C/C++ is mostly in AAA games because of middleware and yes, massive flexibility with memory and when you are dealing with importance of performance, Very technical games will opt for C/C++.

C# however is very popular when games aren't pushing limits, it's also very popular with indies. The entire XNA project by Microsoft spawned a huge amount of indie games, many of them big hit indie games, today Monogame is keeping it alive.

C# is the most adopted language of choice with Unity and games such as Shadowrun, Wasteland, Hearthstone, Kerbal Space Program, Gone Home, Ori and the Blind Forest, Might & Magic X Legacy, RUST, FRACT, Among the Sleep, Pillars of Eternity, the list goes on and on. None of these are pushing the limits of technology, but all use C#.

Unreal Engine at the moment also has unofficial C# support because C# is such a widely used language nowadays, people want to and love using it. It has good adoption rates.

C# doesn't have manual memory control, it uses a garbage collector, it's miles and miles ahead of Java's but still not ideal when you actually need to control that memory so you won't see C# being used to push very technical games. It's more than capable though and a perfectly suited language for games depending on what you are trying to do.

When you really get technical and the game becomes a huge performance burden you will see C# struggle with its garbage collector, experiencing "hooks"/stutter every now and then in gameplay with a very technical game is because of the garbage collector doing its work when dealing with what you want to hold in memory in the game as well as when putting something in and destroying something else.

Code I wrote few years ago was in C# and it dealt with pretty crazy explosions, dealing with that when it would occur would cause a "hitch" for a frame or so when the garbage collector did its work when things were destroyed in the game from the explosion such as destructibles. No amount of perf passes would solve it, it was solely due to the garbage collector not being efficient enough to deal with it. Nothing a programmer could have control over unless they were using a language like C/C++ that required the programmer to do all the memory management that could make this go away.

C/C++ has always been the industry defacto language due to flexibility + middleware that was natively for C/C++ (although you could prob write binds for other languages, nobody wants to do that if they can just go the native way), C# is pretty much the language that is widely commonly used after C/C++.

This is on my opinion/experience, been programming for 10+ years now every day with C/C++ and C# (I do love C# for what it does, dearly). C# is definitely the most adopted language and useful one other than C/C++ when it comes to games at the moment.

* Note that C# can have unsafe access to the memory of the game, but nowhere what you would need in most situations. Anyone curious in general about C#'s GC, this is a good starting point: https://msdn.microsoft.com/en-us/library/ms973837.aspx
The issue with C#'s GC is basically with full collections, they are the most costly operations since an object that is in gen2 requires a full clean up. Any way there is a lot to read up on C#'s GC.
 

3DShovel

Member
No manual memory management.

It uses a virtual machine, meaning it has a lot more overhead than other languages.

It's great for lighter stuff and business software, but isn't as great when it comes to games. That being said, Minecraft and Runescape were both written in Java. So it can be done.

These two are the main reasons.

Java garbage collection is too unpredictable to be confident in the performance of the language as a whole.

When designing a game (which are very complex programs, typically), you want to be able to decide when you don't need an object anymore so you can free up resources and then refill when needed.
 

Zane

Member
This may be an odd tangent, but with MS at the helm of Minecraft is there a chance for the game to be transitioned over to another language (as was said by other(s) in this thread Minecraft performs poorly)?

Doubtful.
 

mclem

Member
No. A game dev can confirm (or deny), but historically, it has been C and C++. C# and Java aren't quite "too the metal" enough, though I suppose they can be and are used on indie games.

'twas always C++ for me. Plus brief forays into microcode as appropriate, of course.
 

Timeaisis

Member
Oh, come on, guys. Java isn't that bad. It's just not made for games.

Yes, it's garbage collection you can't control, it has no memory management. For some things, this is great. It's not for games.

C# is like a middle ground between C and Java. It's starting to get a lot of use in game development, and I'm happy about it.
 
Top Bottom