[java] Feelings on Java3D?

Started by
21 comments, last by Sieggy 22 years, 9 months ago
I''ve been looking at options for doing iso engines in Java. I''ve come across references to Java3D and looked up some info on it and wanted to get some thoughts on it. While the game world still seems heavily entrenched in C/C++ the business world is rapidly moving to Java so it would be nice that my hobby (game programming) corresponds to my day job (business programming). So thoughts any thoughts on its merits, or lack thereof would be appreciated. Thanks! Sieggy
Advertisement
Sieggy,

I''ve been going through a similar process. I have found that with working in Java all day and going home to work on C++ after a few hours spending time with the family is just not working that well.

Although the languages are very similar, it still takes some time to get back into the C++ groove. And if you go a few day''s without touching it, it takes much longer to get back into it.

So, I have moved over to Java for my current game development efforts. For me it makes a great deal of sense since writing games in Java only improves my Java skills for my day job, and using Java in my day job only improves my Java skills for my game development.

Now as far as Java3D goes, I think it still has a way to go before it can even compete with Direct3D and OpenGL. But the JDK1.4 does look promising. And since it is still in Beta, we can only hope for a bigger performance boost in the final release.

At the JavaOne conference, I saw the new JDK1.4/Java3D in action. I''m not sure what hardware it was running on (my guess is it was a Sun workstation), and the performance was much better than before (16fps versus .8 fps for the same demo).

So, for now I''m going to stick with the Java stuff and see what I can make it do.

borngamer
Where did you see the JDK1.4/Java3D demo? I talked to the Java3D people and they said they haven''t even tried 1.4 with Java3D.

The Grand Canyon demo I saw was with 1.4 and GL4Java.

[<><]
Hi!

I have had the same thoughts as both Sieggy and borngamer. Why retreat to C++ for games, when Java is working well for other task?

I have tested Java 3D a little bit. To learn Java 3D, I bought the book "Ready-to-Run Java 3D" by Kirk Brown & Daniel Petersen. I have gone through the book and run all the examples in the book. The examples where all to simple to get a real impression about the performance. However, with very simple code the visual appearance was quite impressive.

One thing that annoyed me was that exclusive full-screen mode was not available. Today, when looking at JDK 1.4, I was pleased to see that this screen-mode was available. But I didn´t get if it was possible to run Java 3D in full-screen mode. But I think that full-screen exclusive mode is a great way to improve the graphic performance of Java.








Johan Karlsson

Johan Karlsson
tunabox,

They did a demo at the Java3D booth at JavaOne.

borngamer
If you hadn't noticed already, there's a tutorial available at
[html]http://java.sun.com/docs/books/tutorial/extra/fullscreen/index.html[/html]
on the exclusive mode in 1.4

Haven't tried it yet though.

oh yeah and on the Grand Canyon demo at JavaOne:
[html]http://java.sun.com/products/jfc/tsc/articles/jcanyon/[/html]

Edited by - PeterB on July 10, 2001 9:54:37 AM
Java and Java3D seems like a good way to build a game if you don't care about speed. I'm building a 3D editor + engine in c++/directx so I need all the speed I can get. It's true that Java is 20x slower than c++. I wrote vector of 40,000 chars to a file in Java in 10,000 iterations. Open file, write chars, close file, rinse wash repeat

Results:
a)Java - 50 seconds
b)C++ STL (ofstream) - 30 seconds
c)C (FILE) - 9 seconds
d)win32 api - 1.6 seconds.

Binary output and done on win98 with 1ghz 266 tbird on FIC AD11 DDR mobo, 2100ddr ram 128mb and ibm60 gxp ata100 harddrive.

As you can see if you have large worlds to write to disk then it will be slowest in Java. Also I don't think you can protect your Java files from privy eyes or is there a way I don't know about? I can open .class files with text editor and peek inside. I'm a Java newbie

Edited by - JD on July 11, 2001 1:13:51 AM
Hi!

I have a couple of things that I want to point out regarding the performance of Java.

First of all a comment on JD''s "benchmark"; It''s not enough to measure one thing (writing to file) and then say that Java is slow. Back in ´97 I wrote my Master Thesis on the subject of Java vs C++ performance. This was when JIT just arrived at the market and there was one adoptive JIT compiler available. No Hotspot and so on. I did a series of microbenchmarks, like comparing for-loops and array access etc. In the case of a for-loop there wasn´t any big differences, but in the case of array access there was huge differences.

However, it´s the overall performance thats counts in real-life applications. Different types of applications, have different types of characteristics. Thus, Java is more suitable in some areas than others. For example, Java is fast on number crunching. A nice real-world example is the Colt library:
http://tilde-hoschek.home.cern.ch/~hoschek/colt/index.htm

The promising thing about Java3D is the possibility to use a hardware accelarator, which most graphic cards have today. One problem today is that many graphic cards have only 3D accelaration when using fullscreen mode. However, the 1.4 release seems to have solved that problem. I think that using Java 3D in fullscreen mode with a hardware accelarator could be rather fast.

Regards
Johan
Johan Karlsson
Hi!

One more thing. It´s possible to protect your .class file by using an obfuscator. Many time a tool like this i combined with an optimizer. A good example of this is Jopt://www-i2.informatik.rwth-aachen.de/~markusj/jopt/

Some obfuscator could ruin the code and make it impossible to execute. However, I have tested Jopt on our products and have not noticed any trouble running them. The become smaller, faster and more difficult to read.

Regards
Johan
Johan Karlsson
JavaJohan, thank you for the link. That piece of code is interesting. For someone using the obfuscator a backup of data would be helpful before running it on the real files.

I hear slow loading times of games all the time from frustrated gamers. Compare file saving of win32 2 seconds versus 50 seconds for Java. It''s better to do benchmarks now and avoid headaches then find yourself with nice unplayable game later when tons of code was already written. Profile, profile and then do some more profiling. For C++ users, Amd has pretty decent free profiler on their site. It tells you what functions are taking the longest to process, etc.

Java3D + Java is slow (interpretative languages usually are) but it trades that for the flexibility which I think is very valid for non-time critical applications. Every tool has it''s place. I really like the write code once run anywhere paradigm, that''s why I''m eyeing Java now. If my game has enough speed under java then I''ll use Java, if not I''ll use c++ and os api. Will check out Java3D in near future, maybe I don''t need to talk to hardware on lowest of levels, just need poly handling api and I''ll write my own scene graph, portals like I''m doing now.

This topic is closed to new replies.

Advertisement