• 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?

El Phenicks

Neo Member
You can fine tune garbage collecting timing, size, and type to help mitigate performance issues in specific situations. I'm aware it's not the same as or as efficient as manual memory management but you do have control on when and how it executes and can use that to fine tune it.

As I later completed :
There's no way to generically set the VM parameters so they magically run everywhere the same. That's wishful thinking.

I tire of this one sided debate, if you want reason you'll find none the way you're thinking.

If you want to make a game using Java, do it. Notch did and look how far he is now... just don't preach it's even close to ideal.
 

arit

Member
I can't be the only one here who prefers C over C++. I write all my games in it. OOP is the devil

You aren't. C is just a sweet compact little language. Put some Lua on top of it and you can even do some unpleasant stuff in a comfy way when needed. Though I might be biased, because the only languages used within uni were Java and C (well, plus some introductory MIPS ASM and web dev stuff, but that's web dev stuff that I don't like).
 
Who the hell programs in Java by choice when they don't have to?

I don't hate Java, but this is me. It is never my first choice.

Do they still teach Java as the primary programming language at high schools and universities? I'd wager the only reason most schools even touch Java is because of its unfortunate ubiquity in industry.

It was required at the university I attended for my degree. Had to take 4 courses that all focused Java.
 

Durante

Member
Not even taking game development into the equation, Java is a horrible language. I've started and stopped Android development so many times because I quickly got sick of the thick layers of boilerplate and OOP madness.

If you need to use the JVM for whatever reason I'd recommend Scala instead. It's a far more modern language with a very clean syntax that doesn't bombard you with cruft.
Funny story relevant to this thread:
When I implemented a first person dungeon crawler in Java for Android in 2012, it suffered from very unstable performance on my Galaxy S2. After profiling, I fixed it to a locked 60 FPS by basically implementing manual reuse stacks (actually fixed-size arrays) for every single object type which needed dynamic per-frame allocation/deallocation.

Of course, once you do that you are actually dealing with memory allocation in a way which is more cumbersome than even in vanilla C, never mind C++ and its myriads of conveniences.

Do they still teach Java as the primary programming language at high schools and universities? I'd wager the only reason most schools even touch Java is because of its unfortunate ubiquity in industry.
We switched away from almost Java-only to a C (low-level/algorithms101/OS/computer graphics) / Haskell (languages/logic/advanced algs) / Java (other stuff) curriculum in 2011. Thank god.

There's no such thing as a bad programing language, just bad uses of programming languages. Every language has its good points and bad points. (this from someone who has used about 20 languages since 1993)
I mostly agree in principle, that's why I think teaching only a single language is the very worst thing you can do. However, there are languages (like Java :p -- or perhaps less controversially, say, COBOL) for which I can't really imagine many use cases where you wouldn't be better served by another language. Except for maintaining Java software (poor suckers).

I can't be the only one here who prefers C over C++. I write all my games in it. OOP is the devil
OOP is useful sometimes, but it's often overused (the same "all you have is a hammer" issue applies to using only a single programming paradigm as with knowing only a single language).

What C++ (especially modern C++) does, is give you a toolbox you can write a very nice program in using almost any paradigm (or mixture of paradigms) you desire. Between classic object oriented class hierarchies, templates and template meta-programming, more or less the entirety of C, neatly integrated lambda functions/closures since C++11, and more, there's a way to implement almost any program or library neatly and well-performing in C++.

There's also more than enough material to shoot off your entire leg if you are not careful, and enough to know that after ~16 years of programming C++ and ~5 years of writing a C++ compiler I still learn new things about it. It's really beautiful in a baroque way.
 
You can deploy your own JRE with your application, so this is bs.

I am speaking more from experience form a corporate environment where Java apps typically rely on the browser's JRE version. I am still stuck with v/ 1.6 "something" and I can't upgrade unless the vendor decides to update their app.

On another note, most of these corporate apps are moving to HTML5 now instead of Java.
 
Java is slow (it's not native code, but interpreted)
You can't just make statements about any programming language like this. Speed is a property of the compiler and/or run-time system, not a language. I can make a dead slow interpreter for C, but that doesn't mean C is a slow language.

Also, any decent VM worth its salt compiles bytecode to native machine code. In case of Java, the commonly used HotSpot JVM does this.

its garbage collection is... garbage(pardon the pun)
Which one?

its memory management doesn't work for games.
That I cannot comment on. I have never made a large game.

(Edit: That said, I'd rather not choose Java for game programming or any programming for that matter. There are nicer languages out there.)
 

bomblord1

Banned
As I later completed :


I tire of this one sided debate, if you want reason you'll find none the way you're thinking.

If you want to make a game using Java, do it. Notch did and look how far he is now... just don't preach it's even close to ideal.

Where on earth did I say that. I keep asking people to point me in the right direction show me what they are talking about and all I'm getting is this crap. "It's awful" "it's not close to ideal" I'm making a point to source my stuff so people can see where I'm coming from.

All I'm saying is you do have some control over garbage collection but it's not fine tuned nor do I pretend there is any kind of direct control I have no clue what you are arguing or think I'm arguing against at this point honestly.
 

Frologic

Member
Do they still teach Java as the primary programming language at high schools and universities? I'd wager the only reason most schools even touch Java is because of its unfortunate ubiquity in industry.

At my University they teach you all the basics of programming using Java. Then they transition you to C, C++, Ruby and Assembly on your second year of studies.
 

Krejlooc

Banned
your neckbeard needs neckbeard to even approach this language lol

Learning an assembly language is something I recommend every programmer do. It'll give you a much better conceptual understanding of how computing is done and make you better at managing your memory manually. It'll flat out make you a better programmer.

Even if you're learning an ancient cpu, the concepts still apply.
 
Didn't the original binding of Isaac run into a shed load of problems because it was built in Java and promoted ed to rewrite the game in C++ for BoI rebirth?
 

^DJ_Link^

Neo Member
As a gamedev myself, and take this with a grain of salt, Java is usually slower. The no direct memory management is also an issue but C# has that "issue" too and it seems to be used a bit more. Personally I prefer C++, and it happens to be the more used language for coding games. It's flexible, fast and allows for direct memory manipulation.
That said, C++ is not without problems and some argue that it has taken much more time to reach a "modern language" status. but c++11 has brought many cool features.

Java has regained more gamedev lately mostly because of Android, and even on PC I know a couple of indie devs that use Java and like it.
 

kevm3

Member
Big games: C/C++ and maybe assembly for some really performance critical parts

unity and xna: C#

web games: javascript

I've only rarely seen java. Other than minecraft, I can't think of any others.
 

Daedardus

Member
I still don't get why Java gets chosen so much as an introductory language to teaching programming. I find it a mess to code in, the syntax is confusing to newcomers and it isn't particularly useful in critical applications (I'm in engineering, many big software projects are written in C++). I can understand that they don't want to deal with the mess that is trying to run programs on different platforms (which is useful in teaching) but to me it seems like a big deal of Java's popularity only comes from its popularity. Not to say there aren't good examples of Java software, just that most of the time there's a better suited language, like Durante said.

I actually prefer Python for introductory (college/uni level) teaching. Just lets you focus on programming structure, algorithm writing and developing other good habits. After that let them move on to more complex OOP languages like C++/C#. I've seen many fellow students struggling with learning to program just by how confusing Java seems to the newcomer.
 

Flai

Member
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.

IIRC the Xbox 360 version of XNA/C# uses old garbage collector, which wasn't nearly as good as the PC/WP8 version. And besides, if you don't allocate memory, then the GC won't run :p ! It's not super hard to make a game that allocates very little after the initial loading and thus won't trigger the GC very often.
 
I don't know why devs use Java, but I wish no game developers did. The best MMO in the world - Istaria - uses Java and I wish to high heavens that it didn't. I'd probably still be playing it if it wasn't plagued by the absolutely horrible performance / general clunkiness that is innate to Java-based projects.

It boggles my mind that games like Runescape or Minecraft found such success - it was surely in spite of being Java-based. I mean, sure, Java helped the ease-of-use for new players, but their enduring success is really a testament to how strong both are conceptually.


Down with Java!
 
I'll give you this. When I was in games, some of the tools we wrote were in Java. Then again, it was up to whoever was writing the tool.

It should also be noted that almost all the seniors never did, and most of the juniors that did eventually migrated to things like perl and Python for speed and maintainance reasons.
 

bomblord1

Banned
I still don't get why Java gets chosen so much as an introductory language to teaching programming. I find it a mess to code in, the syntax is confusing to newcomers and it isn't particularly useful in critical applications (I'm in engineering, many big software projects are written in C++). I can understand that they don't want to deal with the mess that is trying to run programs on different platforms (which is useful in teaching) but to me it seems like a big deal of Java's popularity only comes from its popularity. Not to say there aren't good examples of Java software, just that most of the time there's a better suited language, like Durante said.

I actually prefer Python for introductory (college/uni level) teaching. Just lets you focus on programming structure, algorithm writing and developing other good habits. After that let them move on to more complex OOP languages like C++/C#. I've seen many fellow students struggling with learning to program just by how confusing Java seems to the newcomer.

I'de like to learn C++ I know a lot of programming languages and have found basic concepts are identical between them the only difference is learning the syntax of the new language. I don't see how java can be considered confusing though.
 

Krejlooc

Banned
or perhaps less controversially, say, COBOL

So funny story - I was mentored by a nasa engineer when I was in highschool. They still use cobol - not because it's better proposed for what they do, but rather because most of their code has decades of bug testing done already. Porting to another language risks things going wrong, which can result in millions of dollars being wasted.

Hence, while I agree with you, if you do use COBOL, there is work waiting for you at nasa :p
 
So funny story - I was mentored by a nasa engineer when I was in highschool. They still use cobol - not because it's better proposed for what they do, but rather because most of their code has decades of bug testing done already. Porting to another language risks things going wrong, which can result in millions of dollars being wasted.

Hence, while I agree with you, if you do use COBOL, there is work waiting for you at nasa :p
and many banks, and many government agencies. Those won't go away for a while.
 

Krejlooc

Banned
I'de like to learn C++ I know a lot of programming languages and have found basic concepts are identical between them the only difference is learning the syntax of the new language. I don't see how java can be considered confusing though.

Sounds like you're either learning languages that are similar to each other or aren't learning these languages past a superficial level. There are big differences beyond syntax depending on what language you're using.
 

Tempy

don't ask me for codes
Plenty of people have explained why devs don't use Java for games, but I think OP will just continue ignoring these posts.

Devs have tried Java, stumbled, and subsequently moved onto something superior.
 

tuffy

Member
Learning an assembly language is something I recommend every programmer do. It'll give you a much better conceptual understanding of how computing is done and make you better at managing your memory manually. It'll flat out make you a better programmer.

Even if you're learning an ancient cpu, the concepts still apply.
Learning at least some assembly language makes learning C a lot easier, for that matter. Once one has some experience dealing with memory pointers and addresses by hand, the abstractions C uses become a lot more intuitive. I may not remember much of the 68000 assembly I used, but the concepts stuck around.
 

bomblord1

Banned
Learning an assembly language is something I recommend every programmer do. It'll give you a much better conceptual understanding of how computing is done and make you better at managing your memory manually. It'll flat out make you a better programmer.

Even if you're learning an ancient cpu, the concepts still apply.

Naw man we need to write everything in machine code
This is a joke[ and is not in any way a jab at assembly
 

arit

Member
I still don't get why Java gets chosen so much as an introductory language to teaching programming. I find it a mess to code in, the syntax is confusing to newcomers and it isn't particularly useful in critical applications (I'm in engineering, many big software projects are written in C++). I can understand that they don't want to deal with the mess that is trying to run programs on different platforms (which is useful in teaching) but to me it seems like a big deal of Java's popularity only comes from its popularity. Not to say there aren't good examples of Java software, just that most of the time there's a better suited language, like Durante said.

I actually prefer Python for introductory (college/uni level) teaching. Just lets you focus on programming structure, algorithm writing and developing other good habits. After that let them move on to more complex OOP languages like C++/C#. I've seen many fellow students struggling with learning to program just by how confusing Java seems to the newcomer.

Before Python it was the popular way of teaching OOP, without the headaches of getting it to run on all students' pcs or having to teach compiler stuff before the actual cs stuff. May it be apple, linux or windows pc, it did run and in the lower courses you do not use OS specific features or external hardware, in that aspect it was good and you could just start to code, click on your run button and be happy. With C/C++ for example you'd have to introduce different compilers, debuggers and their usage which might be a bit much at the beginning.

Learning an assembly language is something I recommend every programmer do. It'll give you a much better conceptual understanding of how computing is done and make you better at managing your memory manually. It'll flat out make you a better programmer.

Even if you're learning an ancient cpu, the concepts still apply.

Having dealt with ASM before made understanding C memory usage so much easier. Hell, it even makes Java easier to understand.
 

El Phenicks

Neo Member
Where on earth did I say that. I keep asking people to point me in the right direction show me what they are talking about and all I'm getting is this crap. "It's awful" "it's not close to ideal" I'm making a point to source my stuff so people can see where I'm coming from.

All I'm saying is you do have some control over garbage collection but it's not fine tuned nor do I pretend there is any kind of direct control I have no clue what you are arguing or think I'm arguing against at this point honestly.

Your sources are just that, sources. They talk about fine-tuning a VM for a specific environment. There's no way you'd be able to find a magical sweet spot in-between and making it run smooth across devices\hardware. And that's (other minor language issues aside) it.
 

jman2050

Member
I can't be the only one here who prefers C over C++. I write all my games in it. OOP is the devil

I'm somewhat of a purist so I've been going this way lately as well. Frankly, I find OOP to be a frustrating mess of needless obfuscation with vague 'benefits' that don't actually improve performance or efficiency in any meaningful way. If I wanted to be really mean, I'd say that OOP reinforces bad programming habits and is a crutch for people who want to be "programmers" but who are too ignorant and/or stubborn to actually learn how computers work. But eh, there are some very intelligent people who vouch for it for whatever reason so maybe the problem is with me all along.

Also echoing what Krejlooc said, learn some sort of assembly language. Even if you'll never use it it's worth knowing because every program you ever make will eventually become machine code at some point.
 

Krejlooc

Banned
I'll give you this. When I was in games, some of the tools we wrote were in Java. Then again, it was up to whoever was writing the tool.

It should also be noted that almost all the seniors never did, and most of the juniors that did eventually migrated to things like perl and Python for speed and maintainance reasons.

Writing tools in java can actually make sense depending on the tool. I've written tools with visual basic before, it sort of depends on what type of tool you're creating and for what purpose.
 
"Write Once, Run Anywhere" never has a more pernicious lie been told and retold. As someone who spends all day tearing his hair out trying to get customers off XP I can assure you JAVA programmes can rarely migrate between different versions of the damn JRE on Windows let alone multiple platforms.

JAVA's benefits seem to be more about supportability than portability at least from my own experiences. I'd also like to echo the Don't start with JAVA sentiment as I personally found it nightmarish to go from a garbage collected language to raw C.
 

bomblord1

Banned
Sounds like you're either learning languages that are similar to each other or aren't learning these languages past a superficial level. There are big differences beyond syntax depending on what language you're using.

I've learned PHP, Java, Javascript, Objective C, and Visual Basic.

I find basic concepts are the same across all languages it's just how you write it to get the same result. Objects are objects classes are classes variables are variables, and arrays are arrays.
 

Krejlooc

Banned
I went the other way with regard to microprocessor assembly. Actually, if we trace my programming roots, I went from Hypercard (lol) to qbasic to visual basic to C to C++ to m68k microprocessor assembly to java.

Learning to work with the m68k helped me understand the differences between C and C++ and more importantly how to use C so much better. What were vague concepts before became concrete after. It also made working with java a nightmare, lol.
 

Jiraiza

Member
I still don't get why Java gets chosen so much as an introductory language to teaching programming. I find it a mess to code in, the syntax is confusing to newcomers and it isn't particularly useful in critical applications (I'm in engineering, many big software projects are written in C++). I can understand that they don't want to deal with the mess that is trying to run programs on different platforms (which is useful in teaching) but to me it seems like a big deal of Java's popularity only comes from its popularity. Not to say there aren't good examples of Java software, just that most of the time there's a better suited language, like Durante said.

I actually prefer Python for introductory (college/uni level) teaching. Just lets you focus on programming structure, algorithm writing and developing other good habits. After that let them move on to more complex OOP languages like C++/C#. I've seen many fellow students struggling with learning to program just by how confusing Java seems to the newcomer.

My school starts off with C++, then C together with assembly code. After that, we're required to take a programming languages course consisting of multiple languages which may or may not include Java. We have it good.

Now I'm getting the urge to write some code.
 

bomblord1

Banned
Your sources are just that, sources. They talk about fine-tuning a VM for a specific environment. There's no way you'd be able to find a magical sweet spot in-between and making it run smooth across devices\hardware. And that's (other minor language issues aside) it.

Ok so what are we disagreeing on? You're going to have to tell me so I can continue the argument.
 
I'm waiting to hear why it's bad first. It's a modern programming language that is platform independant.

Honestly I've always felt like the platform independent argument is BS. When applying it to games it just means you'd rather not bother learning how to develop efficiently for each platform and instead want to take the easy way out.

My brother uses Game maker Studio software. I don't even know what it runs on but he paid extra for a feature that allows him to port it to Android and IOS so he doesn't have to really learn the languages. I think he's doing himself a disservice but he doesn't listen.
 
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'll find as many developers claiming something like C++ is a heaping pile of shit too, though. So, I don't see much point in saying one thing is more garbage than another (I know you didn't compare, just saying for the sake of it).

Java is super shitty for a lot of things. What you say is true, but it's still around, so that's something. To answer the OP's question though... because Java is far down on the ladder for programming languages for games. Memory management is ridiculous when you can't explicitly free it, for one. There's probably a hundred million other reasons, too. It's just slower.

Some things are just no good for a particular task. It's funny looking up what Linus Torvalds said about using things other than C in the Linux kernel, for example. He lives and dies by C. People have suggested it be in C++ and he just rips them, for his own reasons. It's all purpose and opinion.

Java just doesn't let you interface with the hardware as well. It's a garbage option for low level programming. I do like it for some things, though I think anything you'd want to do in Java can at least be equally well-done using another option.
 

jman2050

Member
I've learned PHP, Java, Javascript, Objective C, and Visual Basic.

I find basic concepts are the same across all languages it's just how you write it to get the same result. Objects are objects classes are classes variables are variables, and arrays are arrays.

I'd highly recommend learning a non-OOP language, if only for educational purposes. And assembly, but I already covered that
 

survivor

Banned
Here is a blog post by a rendering engineer that used to work with EA before, not sure where he is at now. He is talking about why C++ is still the primary choice and why no viable replacements have arrived
 

Krejlooc

Banned
I've learned PHP, Java, Javascript, Objective C, and Visual Basic.

I find basic concepts are the same across all languages it's just how you write it to get the same result. Objects are objects classes are classes variables are variables, and arrays are arrays.

Well like I actually mentioned this earlier in this topic. 2D arrays, in java, are arrays of arrays. Meaning the first dimension of the array is a pointer to a block of memory that contains another array. They are not contiguous. Vs, say, C where a 2D array is just a very large, single block of memory. This obviously has consequences - for one, in java, a 2D array does not have to be a block pattern. Meaning element 0 might have a size of 3, where element 1 might have a size of 4. In C, a 2D array is always a block size, all "elements" will have the same length. Given that, assuming you have a 2D array block patter where each "element" is 3 long, you can compute the address of each individual element like so:

array[2][4] = array[2*width+4] = array[2*(3)+4]

this is because the 2D array is defined as one large block of memory all sequentially. in Java, one element of your 2D array might be in one location, and the next might be in a completely different location.

This is just a tiny taste of how different these languages can be, beyond syntax.
 

hitsugi

Member
so glad to see some positive comments about Java D:

I prefer C++, personally.. but for the next couple of years I'm working with Java
 

Kalnos

Banned
Learning to work with the m68k helped me understand the differences between C and C++ and more importantly how to use C so much better. What were vague concepts before became concrete after. It also made working with java a nightmare, lol.

Not to mention the 68k was used in the Genesis, which is awesome.
 

bomblord1

Banned
Well like I actually mentioned this earlier in this topic. 2D arrays, in java, are arrays of arrays. Meaning the first dimension of the array is a pointer to a block of memory that contains another array. They are not contiguous. Vs, say, C where a 2D array is just a very large, single block of memory. This obviously has consequences - for one, in java, a 2D array does not have to be a block pattern. Meaning element 0 might have a size of 3, where element 1 might have a size of 4. In C, a 2D array is always a block size, all "elements" will have the same length. Given that, assuming you have a 2D array block patter where each "element" is 3 long, you can compute the address of each individual element like so:

array[2][4] = array[2*width+4] = array[2*(3)+4]

this is because the 2D array is defined as one large block of memory all sequentially. in Java, one element of your 2D array might be in one location, and the next might be in a completely different location.

This is just a tiny taste of how different these languages can be, beyond syntax.

But since java doesn't have manual memory management anyway how does this differ conceptually or in real world use vs another language (performance aside)?

If I create a 2D array doesn't still behave as a 2D array (from a conceptual standpoint not regarding the way the machine accesses the information) regardless of where it's located in memory?
 

Stumpokapow

listen to the mad man
I very strongly disagree with this one. Java teaches people all the wrong things, and it's not particularly good for learning anything.
  • Low-level programming, operating systems, and basic algorithm and memory management knowledge is best taught in C.
  • High-level concepts, advanced algorithms, composition, type systems, and language concepts are best taught in some high-level functional language such as Haskell or OCaml.
  • General programming for larger user-facing programs can be taught in Java if you really have to, but e.g. Python or Ruby are also good choices for this and round out the set of languages much better (e.g. having one statically but not strictly typed, eagerly evaluated compiled language in C, a strictly statically typed lazily evaluated language in Haskell and a dynamically typed, interpreted/JITed language in Ruby).

I 100% agree and am not a fan of Java; but most universities use it because it was considered a minimal-cruft maximal-portability easy-for-beginners introduction into OOP concepts. I agree that doing OOP through another language, even if it means having to teach manual memory management, would be preferable but I think understanding the motivation behind it makes it a little less shit.

... although dealing with Swing/AWT was fucking misery when I went through my CS degree and Eclipse was a far weaker IDE back then. Ugh.
 

Krejlooc

Banned
so glad to see some positive comments about Java D:

I prefer C++, personally.. but for the next couple of years I'm working with Java

Programming lanuages are tools, and there is no single tool that works for every situation. Just like how you can't buy a hammer to screw in some nails, there are instances where you don't necessarily need fine memory management and Java is fine.

But game development is really not suited to java.
 
Top Bottom