Java gaming discussion

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
Spacebeans
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 2
Joined: Sat Jun 14, 2014 11:15 pm
Current Project: Crystal2D: https://github.com/Spacebeans-/Crystal2
Favorite Gaming Platforms: PC
Programming Language of Choice: Java
Location: Ontario, Canada

Java gaming discussion

Post by Spacebeans »

I understand some people here have allot of things to say about different languages, and I also see that this thread may have already been started. (Maybe, I'm really really new here).

But I was wondering why some people don't recommend java? (Some bash it in fact). I ain't no newb, and I'm sure as hell not a fanboy. But its mainly the only programming language I've been using for the past 4 years. I've tried C++ then accidentally broke my compiler installation, and haven't touched it since. I've tried C#, that just ended up with allot of crying and lack of quality libraries.

Now, in no way did I recommend Java to be the "best" programming language. In fact, speed wise, Java kinda lacks on the calling side, because of its JVM communications. (Program talks to JVM, JVM talks to hardware) (I may be horribly wrong on how that works.))

Also, that JVM communication could be surpassed on the graphics side. Modern OpenGL uses interleaved data, so even if Java doesn't have very fast OpenGL calls, the data is interleaved anyway. There are some openGL wrappers for Java, like LWJGL, and JOGL. In fact, the LWJGL project now has OpenCL and OpenGL 4.0 versions. So that's not a problem either. Java also makes it very very portable through various devices. LWJGL handles the Native libraries through JNI (Java Native Interface) so all you have to do is include the right natives and you're good to go on Windows, Mac, and Linux. Even android (If you try hard enough)

I'm not college graduate, computer scientist, and some of you are, so please take it easy, even if I'm extremely wrong on everything.

Code: Select all

//XXX: This is an actual tag in eclipse SDK, google it.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Java gaming discussion

Post by dandymcgee »

Spacebeans wrote:I've tried C#, that just ended up with allot of crying and lack of quality libraries.
I won't bother pretending I know enough about Java to give advice, since I've never actually used the language myself. I can, however, tell you that C# is probably the wrong choice of language for most game development. The exception being games that are directly targeting Windows. Yes, there are way to run C# on other platforms, but it's not even remotely close the level of cross-platform compatibility you'd find with Java.

I use C# every day at work for rapid development of Windows forms applications and Windows services it is an amazing tool. We do all sorts of data processing, reporting, and verification entirely in C#. The tools run plenty fast enough for our needs, and the code base is incredibly easy to maintain / debug / enhance. If we were to try to use C++ our development times would probably go up ten-fold for very little gain. Java is a slightly more likely candidate, but C# is specifically tailored to Windows development which is our only target platform.

In any case, Minecraft is the paragon of Java game development. It alone has proven that the game idea itself is infinitely more important to players than the language in which you develop it.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
jmcintyretech
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 34
Joined: Thu Mar 28, 2013 1:02 pm

Re: Java gaming discussion

Post by jmcintyretech »

If you're making a game with more complex grpahics needs, you can still use Java, but might choose a library like LWJGL (Lightweight Java Game Library).

If you have a need for extreme performance or distribution on platforms without a JVM, you'd want to use C/C++ and something like SDL or OpenGL.

Hell, you could write a cross-platform game in Fortran if that's what your programmers knew and there was a graphics lib to fit your needs.

Again, I think it boils down to programmer choice provided that the language/libraries of choice fit the needs of the product you are creating.
Last edited by jmcintyretech on Fri Mar 18, 2016 11:22 am, edited 1 time in total.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Java gaming discussion

Post by dandymcgee »

jmcintyretech wrote:Hell, you could write a cross-platform game in Fortran if that's what your programmers knew and there was a graphics lib to fit your needs.
I think having a compiler would be a bit more important than a graphics lib. You'd be hard pressed to get your Fortran running natively on iOS. :roll:
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
bbguimaraes
Chaos Rift Junior
Chaos Rift Junior
Posts: 294
Joined: Wed Apr 11, 2012 4:34 pm
Programming Language of Choice: c++
Location: Brazil
Contact:

Re: Java gaming discussion

Post by bbguimaraes »

Just forget that and write it in emacs lisp.
jmcintyretech
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 34
Joined: Thu Mar 28, 2013 1:02 pm

Re: Java gaming discussion

Post by jmcintyretech »

dandymcgee wrote: I think having a compiler would be a bit more important than a graphics lib. You'd be hard pressed to get your Fortran running natively on iOS. :roll:
...didn't even think of that, that's probably a bigger concern :lol: :lol:
X Abstract X
Chaos Rift Regular
Chaos Rift Regular
Posts: 173
Joined: Thu Feb 11, 2010 9:46 pm

Re: Java gaming discussion

Post by X Abstract X »

Java is perfectly fine for game development. In my experience the main thing you need to worry about is being careful with your allocation/deallocation strategy so the garbage collector doesn't come into play and cause large delays during gameplay. Not quite sure what you were getting at with the fact that you interleave data in OpenGL, how is this relevant to the choice of language issue?
User avatar
Spacebeans
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 2
Joined: Sat Jun 14, 2014 11:15 pm
Current Project: Crystal2D: https://github.com/Spacebeans-/Crystal2
Favorite Gaming Platforms: PC
Programming Language of Choice: Java
Location: Ontario, Canada

Re: Java gaming discussion

Post by Spacebeans »

X Abstract X wrote:Java is perfectly fine for game development. In my experience the main thing you need to worry about is being careful with your allocation/deallocation strategy so the garbage collector doesn't come into play and cause large delays during gameplay. Not quite sure what you were getting at with the fact that you interleave data in OpenGL, how is this relevant to the choice of language issue?
I meant that the biggest part in Java's bad performance is the constant JVM/JNI calls. Like Java Program > JVM > JNI > OpenGL

I may be wrong, but LWJGL/JOGL both work through the Java Native Interface. So it speaks to anouther language (C++/C#) that then calls its OpenGL methods. And on top of that, Java calls its methods from the compiled code on the JVM. So it talks to the JVM, then to the JNI then to the OpenGL libraries. But if you leave the data on the graphics card with interleaved data (Retained mode). You don't have to worry about the calls making your app slower.

Code: Select all

//XXX: This is an actual tag in eclipse SDK, google it.
Post Reply