Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Viability of Java For Video Games


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
18 replies to this topic

#1 NewBreed117   Members   -  Reputation: 423

Like
0Likes
Like

Posted 26 November 2013 - 02:12 PM

Is Java viable for graphic intensive video games. More specifically could I recreate a game like Halo or Call of Duty where you need to have quick

input and output? Thanks in advance to your answers smile.png



Sponsor:

#2 Erik Rufelt   Crossbones+   -  Reputation: 3626

Like
2Likes
Like

Posted 26 November 2013 - 02:30 PM


Is Java viable for graphic intensive video games.

 

Yes.

 


More specifically could I recreate a game like Halo or Call of Duty

 

Doubt it. (Not that that has nothing to do with Java)

 


where you need to have quick input and output?

 

Yes.



#3 SimonForsman   Crossbones+   -  Reputation: 6293

Like
6Likes
Like

Posted 26 November 2013 - 02:52 PM

Is Java viable for graphic intensive video games. More specifically could I recreate a game like Halo or Call of Duty where you need to have quick

input and output? Thanks in advance to your answers smile.png

 

The language choice is mostly irrelevant on the PC, especially if you aim to create something similar to old games like Halo or CoD (a modern PC is significantly faster than the previous console generation and even the current generation (PS4/XBOne), Graphics are primarily handled by the GPU and most of the fancy special effects will be written using GLSL or HLSL regardless of what language you use for your game logic.

 

That said however, Java has quite many issues that you will have to work around(The Java standard library is pretty awful for games so you will have to rely on third party libraries quite a lot) and it doesn't really provide any tools for fine tuning the lower level details nor is it expressive enough to make it easy for the VM to optimize things for you (You pretty much have to choose between high performance with a slow startup(server VM)  or far from optimal performance and fast startup(client VM), i'd highly recommend going with C# instead. (its very similar but provides a saner way to interface with native code if it becomes necessary)


Edited by SimonForsman, 26 November 2013 - 02:58 PM.

I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#4 Satharis   Members   -  Reputation: 1249

Like
4Likes
Like

Posted 26 November 2013 - 03:27 PM

It's viable but a lot of things are "viable" doesn't mean its a good idea. Notably C# has every advantage over Java when it comes to games(well, most things.) The language only matters depending on what you're doing, it's pretty rare to be making a game that say, has to be fancy enough to -require- a language like C++.

#5 TheChubu   Crossbones+   -  Reputation: 4754

Like
1Likes
Like

Posted 26 November 2013 - 08:52 PM


The Java standard library is pretty awful for games so you will have to rely on third party libraries quite a lot
What do you mean with that?

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

 

My journals: dustArtemis ECS framework and Making a Terrain Generator


#6 frob   Moderators   -  Reputation: 22692

Like
4Likes
Like

Posted 26 November 2013 - 09:33 PM

The Java standard library is pretty awful for games so you will have to rely on third party libraries quite a lot

What do you mean with that?
The built-in Java libraries for graphics are based on the lowest common denominator. They were written with completeness and portability in mind. They were not designed around hardware acceleration.

Even when they do take advantage of it, the results are very inconsistent. It is well documented that graphics performance can dramatically change mid-execution. In one of many well-known examples, simply calling drawImage() with a BufferedImage can use DirectDraw for blitting giving you an incredible framerate, but then after resizing or even moving the window Java may suddenly decide to switch to CPU based rendering dropping you to just five or ten frames per second. There is no notice given to your app, just suddenly there is a performance drop as it switches to CPU-based rendering.

That may be fine for a turn-based game that isn't animated. If your Chess game drops to 5 frames per second nobody will care.

High performance games that use Java tend to use JOGL (Java OpenGL wrapper) or similar libraries that provide access to proper hardware acceleration.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.


#7 TheChubu   Crossbones+   -  Reputation: 4754

Like
0Likes
Like

Posted 26 November 2013 - 10:39 PM

Ohh I see, I asked because "Java for games" in my mind is Java + LWJGL, not Java2D precisely. By "standard libraries" I thought he was referring to the usual collections, networking, threading, and so on.


"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

 

My journals: dustArtemis ECS framework and Making a Terrain Generator


#8 SimonForsman   Crossbones+   -  Reputation: 6293

Like
1Likes
Like

Posted 27 November 2013 - 12:40 AM

Ohh I see, I asked because "Java for games" in my mind is Java + LWJGL, not Java2D precisely. By "standard libraries" I thought he was referring to the usual collections, networking, threading, and so on.

 

networking, threading, etc are included in the java standard library, LWJGL and JOGL are not. (They are third party wrappers around native, platform specific libraries).

Neither LWJGL nor JOGL are really optimal choices due to the JNI overhead (a proper engine will allow you to minimize the number of calls made through the JNI) but they are still significantly better than the Graphics classes provided by Java.


I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#9 Buster2000   Members   -  Reputation: 1774

Like
1Likes
Like

Posted 27 November 2013 - 06:58 AM


networking, threading, etc are included in the java standard library, LWJGL and JOGL are not. (They are third party wrappers around native, platform specific libraries).

 

But then OpenGL and DirectX are not part of the C++ standard library either and are also third party wrappers around native platform specific code.

 

I get what you are saying about the JNI overhead but then this isn't really a performance bottleneck that would prevent somebody writing a game like HALO or COD which are several years old and when released ran on much slower PCs than the average budget Dell that somebody can buy nowadays.



#10 Karsten_   Members   -  Reputation: 1655

Like
2Likes
Like

Posted 27 November 2013 - 10:52 AM

I have some experience of using Java / OpenGL for Android development. It was fast enough but since the Java garbage collector does not extend to the graphics card buffers, I found it to be really fiddly to manage the memory manually.

C++ has RAII for memory management which works great with vertex buffers, textures etc.. whereas I found the Java code needed to be spammed with try catches. Java was not great here.

All in all, I suggest that unless you know that you have all the Java wrappers required to do your project, Java is fine. If you feel you may need to wrap native libraries, not only will you need to write the native side of the Jni layer in C/C++ anyway but you will be spending time writing bindings rather than games.

I recommend Java shim and the rest in C++ any day of the week smile.png

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.


#11 samgj   Members   -  Reputation: 398

Like
1Likes
Like

Posted 28 November 2013 - 09:39 AM

Java can be compiled to native machine code with GCJ, so then as long as you use the right libraries it would have the same performance as C++.


MLNM-ONE: open source video game engine

Unincorporated Media's Website: my company's website


#12 Karsten_   Members   -  Reputation: 1655

Like
1Likes
Like

Posted 28 November 2013 - 12:09 PM

Java can be compiled to native machine code with GCJ, so then as long as you use the right libraries it would have the same performance as C++.


I don't think I have ever seen a game written in Java and compiled using GCJ. Probably because GCJ is not very actively developed and still only supports ~Java 1.4.

Either way, since standard Java will very likely need to be using native libraries to create a game (OpenGL, OpenAL, ODE, Bullet, etc..), the speed is very unlikely to be an issue since much of the processing is done by native code (in the .dll or .so) anyway.

Edited by Karsten_, 28 November 2013 - 12:11 PM.

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.


#13 3Ddreamer   Crossbones+   -  Reputation: 3160

Like
2Likes
Like

Posted 28 November 2013 - 10:55 PM

Is Java viable for graphic intensive video games. More specifically could I recreate a game like Halo or Call of Duty where you need to have quick

input and output? Thanks in advance to your answers smile.png

 

 

Hi,

 

World class games and simulations continue to be made based on Java, but often in conjunction with another language for specialized development needs such as gameplay scripting language (sometimes invented in house), hardware cross-platform, operating system cross platform (actually targeting a major Runtime such as .NET, Java, or Mono), or as an excellent development environment for mobile device games.  Java is also used sometimes for scripting gameplay or for GUIs and UIs over another language for lower level coding.

 

Java has multi-threading and multi-core capabilities via libraries, can go high or low level coding, and is often preferred for server heavy software development.  It plugs well into OpenGL (better than some languages) and has mature libraries to support any level of software development.  Some developers find it more efficient in cost and labor to develop in Java than C or C++, for example.  Java just in time (JIT) and post processing libraries combined with the previous mentioned cause the performance gap between Java and C++ or C to be more a matter of skills than the language.

 

Preference can trump every other consideration for any language, so keep that in mind.

 

" Good code written in Java performs better than bad code written in C++ "

 

Military and corporate developers in the many thousands settle on Java for the above reasons.  They create some simulators in Java which are more complex than the biggest entertainment games written in C++, but with competitive performance with the C++ games.

 

Some libraries of code, such as C++ game engine components, can be ported to Java or work inter-operatively in a virtual machine such JVM or a game engine.

 

The jMonkey game engine is a good one, so have a look.

 

Many thousands of games per year are developed based in Java.

 

The main languages to handle low level graphics with excellent performance are C, C++, and Java, in my opinion.   Since skill and preference weigh heavy in the quality of the end product, these are more important than the language itself.


Personal life and your private thoughts always effect your career. Research is the intellectual backbone of game development and the first order. Version Control is crucial for full management of applications and software.  The better the workflow pipeline, then the greater the potential output for a quality game.  Completing projects is the last but finest order.

 

by Clinton, 3Ddreamer


#14 Satharis   Members   -  Reputation: 1249

Like
4Likes
Like

Posted 28 November 2013 - 11:44 PM

World class games and simulations continue to be made based on Java, but often in conjunction with another language for specialized development needs such as gameplay scripting language (sometimes invented in house), hardware cross-platform, operating system cross platform (actually targeting a major Runtime such as .NET, Java, or Mono), or as an excellent development environment for mobile device games.  Java is also used sometimes for scripting gameplay or for GUIs and UIs over another language for lower level coding.

To me this sounds like a lot of really superfluous "Here's why Java is shiny."
 

Java has multi-threading and multi-core capabilities via libraries, can go high or low level coding, and is often preferred for server heavy software development.  It plugs well into OpenGL (better than some languages) and has mature libraries to support any level of software development.  Some developers find it more efficient in cost and labor to develop in Java than C or C++, for example.  Java just in time (JIT) and post processing libraries combined with the previous mentioned cause the performance gap between Java and C++ or C to be more a matter of skills than the language.

Do you have any actual proof of these claims? So far I'm just reading a lot of "Java is super amazing and better than every other language!"
 

" Good code written in Java performs better than bad code written in C++ "

What is "good" and "bad" code? This is extremely vague and could be taken as true in any language, I could pretty easily write a generic looping function in C++ that performs terribly and probably do the same thing correctly in Python and get better results. You might as well be saying that "remember our gun is still a gun if you're terrible with other guns!" When comparing languages you should be assuming competency.
 

Military and corporate developers in the many thousands settle on Java for the above reasons.  They create some simulators in Java which are more complex than the biggest entertainment games written in C++, but with competitive performance with the C++ games.

I'm starting to feel like I'm reading an advertisement for the language instead of discussing actual merit of i.
 

Some libraries of code, such as C++ game engine components, can be ported to Java or work inter-operatively in a virtual machine such JVM or a game engine.

More vagueness that honestly doesn't even make much sense.
 

Many thousands of games per year are developed based in Java.

I have to say this is probably one of the more hillarious and totally baseless lines I'm reading. In terms of serious games developed for Java I could name three off the top of my head: Wurm Online, Minecraft, and Runescape(which I believe isn't even Java anymore client wise, and their server likely hasn't been Java for awhile.

Even in terms of small web games made by individuals Java is almost completely extinct and the market is completely dominated by Flash or even html 5, I've found it unusual to even find anything on the internet that requires Java anymore.
 

The main languages to handle low level graphics with excellent performance are C, C++, and Java, in my opinion.   Since skill and preference weigh heavy in the quality of the end product, these are more important than the language itself.

If you're looking for graphical performance using Java is like hooking a ball and chain to your ankle to run a marathon, sure you can optimize quite a bit with it, I'm not saying its an impossibility but the effort involved is definitely not a time saver. You don't use a friendly language when you need speed you use a friendly language when you need quick development.

EDIT: Pardon if I'm coming off as rude or anything but I really think you're being a bit overzealous on Java's merits here, especially in the realm of game development. It simply really annoyed me to read a huge paragraph of "Java does everything" without even giving any actual base to the claims.

Edited by Satharis, 28 November 2013 - 11:54 PM.


#15 frob   Moderators   -  Reputation: 22692

Like
1Likes
Like

Posted 29 November 2013 - 04:39 AM

[EDIT: Pardon if I'm coming off as rude or anything but I really think you're being a bit overzealous on Java's merits here, especially in the realm of game development. It simply really annoyed me to read a huge paragraph of "Java does everything" without even giving any actual base to the claims.

Overall he is quite correct.

For his server side comments, Java for servers is very common in the business world, and I have seen it used in backends of several games. Look on job search boards like Dice or Monster for JSP developers, and thousands of jobs looking for Java+SQL experience.

As for games, well, he is right.

There really are thousands of games written in Java. Most of the 'dumb' cell phones starting in the late 1990s through today, aka feature phones, have the apps developed in Java, and there were LOTS of them. They still have a market and games are being made for them. Today, in addition to the feature phones, the Android environment is Java-centric. Many games do provide minimal Java code preferring to develop in C++, but quite a large number are written entirely inJava. Then there are still Java applets on the web (visit sites like Pogo for many active examples), and Java-built PC games like the ever-popular Minecraft.

So with Android being out for five years and recently hitting the one million app mark, saying many thousands of games per year are written in Java seems like a small number. I would say that the current rate is several tens of thousands of games per year use it. (Again, yes, many do jump quickly to C++, but I believe they are in the minority.)

While it is true that you won't be able to completely optimize everything at the lowest level with a Java code base, the number of games that need to do that are vanishingly small. Java is more than adequate for just about any game an individual developer or even a small team of developers is able to create.

So yes, Java can realistically do everything you need for a game. It is safe to estimate that hundreds of thousands of games already use it successfully.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.


#16 Satharis   Members   -  Reputation: 1249

Like
1Likes
Like

Posted 29 November 2013 - 01:54 PM

For his server side comments, Java for servers is very common in the business world, and I have seen it used in backends of several games. Look on job search boards like Dice or Monster for JSP developers, and thousands of jobs looking for Java+SQL experience.

Yes I'm well aware the business world is still pretty steeped in Java but that is a different sort of ballpark realistically, industry tends to be very slow to change to new languages and Java has been kind of the "awkward mainstay" fora very long time. It's the same reason extremely dated languages like fortran are still used in quite a few areas.
 

There really are thousands of games written in Java. Most of the 'dumb' cell phones starting in the late 1990s through today, aka feature phones, have the apps developed in Java, and there were LOTS of them. They still have a market and games are being made for them. Today, in addition to the feature phones, the Android environment is Java-centric. Many games do provide minimal Java code preferring to develop in C++, but quite a large number are written entirely inJava. Then there are still Java applets on the web (visit sites like Pogo for many active examples), and Java-built PC games like the ever-popular Minecraft.

To be honest I would consider phones to be a unique variant, for a lot of phones Java may have been the ONLY choice available, for Android, Google has pushed the language far above others and so most people default to it, even then C# through mono has a rather devoted following. I wouldn't really compare languages when you flat out get more out of using one on a certain platform, that's a bit silly.
 

So with Android being out for five years and recently hitting the one million app mark, saying many thousands of games per year are written in Java seems like a small number. I would say that the current rate is several tens of thousands of games per year use it. (Again, yes, many do jump quickly to C++, but I believe they are in the minority.)

Yes and mobile is a gigantic industry now, that said cell phone games are rarely performance centric and even simple 3d is pretty rare in a market dominated by 2d puzzle games and other 99 cent distractions. My personal opinion is that I really don't see how something being a used a lot means it has much merit as a language, keeping in mind the entire discussion here is viability for games(in which the OP specifically mentioned feature sized games like AAA industry.)

Again, I'm not saying Java "can't do this or that" I'm saying "there's no real reason to do this or that with Java." Of course that argument changes based on platform, on Android there actually is merit to considering Java as your language because its so often used.
 

While it is true that you won't be able to completely optimize everything at the lowest level with a Java code base, the number of games that need to do that are vanishingly small. Java is more than adequate for just about any game an individual developer or even a small team of developers is able to create.

I wouldn't say they're vanishingly small, in my opinion the same number of big games are coming out as before, if not more. If anything the game industry is just expanding because things like mobile games have started to capture all the "normal" people out there. But we're talking about things that are galaxies apart here really, a game like Battlefield 4 does not even entail remotely the same decisions as a bejeweled clone on a cellphone. The bigger you get, performance tends to become more of an issue as well.
 

So yes, Java can realistically do everything you need for a game. It is safe to estimate that hundreds of thousands of games already use it successfully.

My main issue was that was he says is superfluous, he makes the language sound like its amazing and used for everything and a direct competitor to languages like C++ or even C# while in reality, as a language, I still don't see much merit to it being used on PC in particular, or even on consoles unless its the preferred language.

My opinion is that C# is very similar to Java but it makes a lot more design decisions that are intuitive, and as a language it just feels better developed. Obviously mileage may vary there. On the flipside I would say a language like Java or even C# is going to have an extremely hard time being able to optimize down to the metal. If you do make those optimizations they will likely take longer, and for less payoff. Java is just kind of the ugly duck in the room when it comes to games, but then again why shouldn't it be! Java was designed to be totally generic.

Edited by Satharis, 29 November 2013 - 01:57 PM.


#17 3Ddreamer   Crossbones+   -  Reputation: 3160

Like
-1Likes
Like

Posted 29 November 2013 - 11:17 PM

The libraries whch Java can access lead the industry in many categories.


Edited by 3Ddreamer, 29 November 2013 - 11:18 PM.

Personal life and your private thoughts always effect your career. Research is the intellectual backbone of game development and the first order. Version Control is crucial for full management of applications and software.  The better the workflow pipeline, then the greater the potential output for a quality game.  Completing projects is the last but finest order.

 

by Clinton, 3Ddreamer


#18 Satharis   Members   -  Reputation: 1249

Like
0Likes
Like

Posted 30 November 2013 - 12:51 AM

The libraries whch Java can access lead the industry in many categories.

Okay?.. Whats your point? What kind of libraries are we talking about?

If we're talking about native libraries, Java would be, if anything, just adding overhead to their performance. If we're talking about Java specific libraries like the standard library then.. what advantage do they have over other standard libraries?

You're being really vague.

#19 NewBreed117   Members   -  Reputation: 423

Like
0Likes
Like

Posted 30 November 2013 - 10:35 PM

Thank you for all the responses I am starting to get a good picture of what I am looking at :) Thanks again everyone!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS