Archived

This topic is now archived and is closed to further replies.

sSimontis

[java] Is Java good for games?

Recommended Posts

I have a book on Java. I wanted to know if Java is good for game development. What libraries does it support, and is it as good as C++? And does anyone know good online Java tutorials beside Sun Microsystems''? Scott Simontis Big Joke: C#

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
java is good for games, but not the best for 3d games. It is used usually in web games, 2D or 3D like gba games. You can use numerous opengl bindings (see gamedev news). If you want to do a 3D good-fast games, use C or C++ and opengl or directx, else, use what you want

Share this post


Link to post
Share on other sites
Village Specialton: Just pick a language and learn it. Just about every modern langauge will be fine for a beginner to learn how to do basic games. Like the AP said, there are openGL bindings now so you could always use them if you wanted to do 3D stuff.

Share this post


Link to post
Share on other sites
In the near future you will see more and more Java games being put out by indie developers. With the various OpenGL bindings available (GL4Java, LWJGL, JOGL, and the new thing by SGI and sun based upon JOGL), the improvements to the Hotspot JIT compiler with each release of the JDK, and with info regarding Java-specific optimization techniques readily available, speed is no longer an issue in most cases. Some suggest that Java may not be suitable even now for fast-paced games such as Quake or Warcraft 3, but in the hands of someone who truly knows the language and how to get the most out of it, even those sort of games are doable.

There are other drawbacks to developing games in Java (the primary one in my book being distribution). But IMO the language really helps speed up the development process and is just much more fun to work with than C++.

Share this post


Link to post
Share on other sites
quickly said: yes, java is good for game developpement. Look at this study if you're really interested. But, because i know most of you are lazy (i'm myself), here is "a part" of the conclusion:

In contrary to popular belief, Java applications are in fact not much slower than C++ applications when they have been tuned for performance. A rough estimate based on the various benchmarks would say that tweaked Java code is a little slower than C++;
typically 20-50% on the average, but this is hard to tell for certain because of the large variations in the speed seen in the benchmarks. The slowdown is less in 3D applications, where performance mostly depends on the performance of the 3D hardware and not on the programming language used.

So, what AP said was wrong: java is good for games, and even better for 3d games. Benchmarks in the previous mentionned study shows it clearly.

So, if it's not intendet for high profile games that rely on maximum performance, then it's perfect.

By the way: C# is not a big joke, it's a part of the future!

cheers!

Edit: PS: sun's tutorials are maybe boring but they are good ones!

[edited by - misterx on August 7, 2003 6:26:04 AM]

Share this post


Link to post
Share on other sites
I already know C++, and jsut wanted to find out if I should learn it. Thanks for the information!

Scott Simontis
If it wasn''t for C, we''d be using BASI, PASAL and OBOL

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If I have to select between java and C#, I select java, because C# is a microsoft''s strategy for compete with java, and eliminate definitely C and C++, in a few years(2 or 3) they stop makeing C/C++ compilers, and then I suicide !!! xD

Share this post


Link to post
Share on other sites
between those 3, i would personnally choose c#. But that's just my opinion! Hopefully, java has some more tricks in its pocket! ;-)
But, well, let's stop to discuss such things, we are risking another stupid flame war. :-P (With always the same conclusion: every language have their advantages.)

[edited by - misterx on August 7, 2003 6:48:09 PM]

Share this post


Link to post
Share on other sites
Personally, the only thing that I think C# currently has going for it better than Java is that it is (supposedly) faster on Windows .NET implementations. However, I''ve personally tested an identical Java program to the C# version on linux (using the Blackdown JVM and the Mono .NET framework), and the Java version ran considerably faster. Keep in mind that I was just timing with a handheld stopwatch, and the discrepency was about 10 seconds for a simple program that did nothing but add numbers or something...

Also, I don''t think C/C++ will ever die out. Look at it this way: C is still around years after C++ has come out, which it was intended to replace. C and C++ are way too firmly embedded to die out any time soon.

The Artist Formerly Known as CmndrM

http://chaos.webhop.org

Share this post


Link to post
Share on other sites
quote:
Original post by Strife
However, I''ve personally tested an identical Java program to the C# version on linux (using the Blackdown JVM and the Mono .NET framework), and the Java version ran considerably faster. Keep in mind that I was just timing with a handheld stopwatch, and the discrepency was about 10 seconds for a simple program that did nothing but add numbers or something...


1) If it was a big loop with just a number incrementation, then such a thing should have been optimized to nothing if compiled with the right parameters.
2) You must consider warm-up time, which doesn''t count.
3) A handheld stopwatch isn''t the most precise stuff!

Benchmarks should be done carefully and with big care of the conditions, one parameter change during compiling can make big differences, and there are many other things to take into account! And they should be interpreted with even more care!
For example, java is quicker than c++ for number computation (no joke), but on the other hand, it takes very much more time for memory allocation in java (when creating an object for example) than in c++. There many fields to take into account, it''s not because a language adds 2 and 2 faster that it''s overall faster. Therefore, take care when you see benchmarks...

Share this post


Link to post
Share on other sites
quote:
Original post by misterX
Java applications are in fact not much slower than C++ applications when they have been tuned for performance. A rough estimate based on the various benchmarks would say that tweaked Java code is a little slower than C++;[edited by - misterx on August 7, 2003 6:26:04 AM]


Yeah, the thing they don''t tell you is that it takes a ton of tweaking and someone who really knows the VM to be able to write Java code that competes with C++ for speed. So much tweaking that it''s probably a whole lot easier just to write the thing in C++ in the first place.

See, C++ has the advantage that it''s really easy to look at your code and tell if it''s efficient or not. Since Java does a lot of work behind the scenes, one line of Java code could be 10,000x times slower than the other lines, and you would have no idea.

Share this post


Link to post
Share on other sites
quote:
Original post by Strife
Also, I don''t think C/C++ will ever die out. Look at it this way: C is still around years after C++ has come out, which it was intended to replace. C and C++ are way too firmly embedded to die out any time soon.


There''s no doubt that Java, C#, Python, etc will continue to take away marketshare that C and C++ used to enjoy, but they will not replace them. Java and the like have just taken software development to yet a higher level, much like what Fortran, Ada, C, etc did for assembly. This shift means these higher level languages can accomplish certain tasks far better than the older languages, but they certainly can''t accomplish all tasks better, if even at all. I don''t think any OS will be written in Java any time soon as a rather obvious example.

Share this post


Link to post
Share on other sites
quote:
Original post by andy_fish
See, C++ has the advantage that it''s really easy to look at your code and tell if it''s efficient or not. Since Java does a lot of work behind the scenes, one line of Java code could be 10,000x times slower than the other lines, and you would have no idea.

Ever heard of a profiler?

"... we should have such an empire for liberty as she has never surveyed since the creation ..."
Thomas Jefferson

Share this post


Link to post
Share on other sites
quote:
Original post by misterX
quote:
Original post by Strife
However, I''ve personally tested an identical Java program to the C# version on linux (using the Blackdown JVM and the Mono .NET framework), and the Java version ran considerably faster. Keep in mind that I was just timing with a handheld stopwatch, and the discrepency was about 10 seconds for a simple program that did nothing but add numbers or something...


1) If it was a big loop with just a number incrementation, then such a thing should have been optimized to nothing if compiled with the right parameters.
2) You must consider warm-up time, which doesn''t count.
3) A handheld stopwatch isn''t the most precise stuff!



1) Yeah, I know.
2) I did, I didn''t start my stop watch until numbers started appearing for either the Java version or the C# version.
3) Of course it''s not precise. But come on! 10 seconds? Obviously, there''s a sizeable discrepency there. And keep in mind, I was using Mono, which isn''t officially sanctioned by Microsoft, it just complies with the standards. I only did this just out of pure curiosity to see how good Mono is so far, and obviously, it''s not quite up to snuff yet.

The Artist Formerly Known as CmndrM

http://chaos.webhop.org

Share this post


Link to post
Share on other sites