Sign in to follow this  

[java] Java 3d game engine?

This topic is 4856 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay, I am not a coder, nor do I ever claim to be. I understand all the lingo, just don't know what all 'dem pretty words mean... Okay, the real idea here is I have some buddies who are graduating from school with degrees in CS and specialize in Java programming. One of them has recently informed me that they are starting their own dev. company to write a 3d game engine based entirely in Java... Is it just me or does that seem ENTIRELY whacked? Please, no flames, just facts. I am not trying to knock Java, correct me if I am mistaken, but isn't java a pisspoor choice for a 3d game engine? Again, just asking, factual explainations would be greatly appreciated as I am in fact a lead designer/developer for a studio, I just don't know jack about java. Thanks.

Share this post


Link to post
Share on other sites
The discussions about whether Java is to be used when doing games have been plenty in these forums and I don't think a correct or complete answere can ever be given to this question. What can be said however is that java is definetely speeding up and with external OpenGL libs it becomes great at rendering as well.

Oh and if you haven't you should check the Forum FAQ thread and the actual FAQ. There are quite alot on the speed issues that jave has.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The ultra short answer is: java can make 3D engines every bit as good and fast as C++ ones.

The more useful answer is to look back through the last 2 weeks of threads (not much, really) in this forum and you'll find one with screenshots from a recent java commercial 3D engine. The use of realtime shadows should be enough to convince you that java is a fine contender, irrespective of debates over precisely waht it can or can't do.

The long answer is that Java can theoretically be faster than c++, but the compilers for java are less than 10 years old whereas the C++ ones are effectively 20+ years old. Java running on a modern JVM can in many cases outperform well-compiled C++ by around 20%, but C++ outperforms java by a similar margin in just as many cases. These are all exceptional - on almost all "real" programming tasks, the two languages are within 5% of each other, performance wise.

redmilamber

Share this post


Link to post
Share on other sites
Given that many graphics engines spend most of their time on the GPU, Java is ok.


Although given the amount of time Doom 3 spends on the CPU, even in the graphics engine (things like shadow volume generation), I don't know.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I'm going to have to disagree.
While java performance in many applications is fairly good, it really still isn't up there.
One of the fundamental problems is that object instanciation is very expensive in java, and in a 3D engine, you are often required to create many samll objects on a per frame basis (Think vertices, matrices, quaternions). Apart from the overhead of object instanciation, this also impacts you generation size for collection purposes.
With very careful object management (as in reuse of old objects rather than disposing them and creating new ones), careful lifetime management (ie references), and well timed work, this impact can be reduced, but it will always be a fundamental issue with a managed language.
Managed DirectX under c# has a lot of crutches to help performancewise which are simply unavailable in java using openGL, through any of the JNI implementations.
Obviously i don't claim its impossible, but i feel that a lot of the energy required to make it run well would balance many of the advantages of coding in java.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
One of the fundamental problems is that object instanciation is very expensive in java...

Not to contradict you or anything (I agree memory allocation is expensive compared to other operations), but memory allocation in Java will most likely be quicker than memory allocation in C++, as Java has a garbage collector to more efficiently locate free memory and prevent memory fragmentation. Ideally, though, one would try to reuse allocated memory in either language, where possible, as opposed to reallocating it.
As a game platform, Java seems pretty suitable, with 3D APIs that are easier for beginners to learn than most, that still (as mentioned before) maintain good performance since the heavy-duty stuff is handled by the GPU.

Share this post


Link to post
Share on other sites
as said before this question cannot be answered correct nor in some sentences...
java HAS definitly some advantages to other languages and some disadvantages... thats vice versa to all languages... even german ^^°...
no, to get back to the point... java can be very quick, but to be that quick, a java programmer has to programm for the jvm, not as c++ programmer who programs for a specified os or cpu... advantage here is, that java runs nearly everywhere, if nothing specific is implemented, disadvantage is that the jvm is no os, no cpu, it runs on those... therefore a game can be good an win but terrible on mac... that is something the jvm programmer has to solve the best... and there we can say, they did pretty damn good the last years, and i am eager to se java5 not only in beta, which is better already as i think...

i would never say you could not do a great engine in java, therefore i have seen to many stuff that changed my mind... great stuff, opengl accellerated with everything we can dream of... i am working myself on a 3d engine for 2 month now my point to this topic should be clear ^^... and i am doing this, because i think java IS fast, and what i am very sure off java WILL BE faster...

Share this post


Link to post
Share on other sites
If you want an example of a good 3D engine written in Java, go to http://www.mascotcapsule.com, they have a complete CLDC compliant java 3D engine. It doesn't run as fast as the C version but it's a good proof of concept.

Share this post


Link to post
Share on other sites

Here are 2 more examples of java 3d engines

http://www.bytonic.de/html/jake2.html a nearly complete quake 2 engine. This puts the figures at about 60% the speed of c.

and

http://www11.brinkster.com/chapter23/divergence/divergence.html

a quake 3 viewer only, i.e. no game.

My personal opinion only but I think that the quake 2 conversion gives a very good indication of relative performance. This puts java a bit behind C but not a total write off.

Share this post


Link to post
Share on other sites
People who have no (or minimal) experience with Java tend to believe the worst. And for those saying there is no correct answer to this question, you are just wrong. The correct answer is, 'yes Java can be used to create 3D game engines, but may not be the best choice based upon project requirements'.

The biggest negative for Java is not performance. For boxed titles it is platform support - currently nothing on consoles. For titles distributed online JRE market penetration could be a problem (but might not be for every title). The first is not an issue if you aren't planning a release on any consoles, and the second is nowhere near as bad as it used to be. 50% of all new computers sold come with the latest Sun JRE preinstalled now, thanks to deals Sun has made with OEMs such as Dell over the past year or so.

I think your friends will be fine considering they have an education in Java. Forget about the 5 year old rumors. Java games are competitive when created by someone who knows what they are doing. A beginning C++ programmer will likely produce suboptimal C++ code, but a veteran will know the pitfalls and tricks of the trade. The same is true of Java. This...

Quote:

One of the fundamental problems is that object instanciation is very expensive in java


...is an example of inexperience and/or misinformation. Object instantiation in Java is faster than C++. This is one of the benefits of garbage collection. The reason Java programmers use object pools and such is not to avoid allocating new objects, but to avoid generating a boatload of garbage. And even then only when a GC profiler indicates there is a problem.

That's another great thing about Java, is the profiling and debugging features built in to the VM. There's a plethora of free and commercial tools to help you tune a Java app. VM parameters can be used to adjust min and max heap size, the type of GC to use, server/client VM... many options. Proper use of these tools in conjunction with solid code help get the best performance possible from a Java app. Without all of the optimizing you still get acceptable performance, but someone who really knows what they are doing can do amazing things.

Share this post


Link to post
Share on other sites
It's worth pointing out that nearly all mobile devices (primarily cell phones) are using Java for games, and its not exactly like they have CPU cycles to spare. So performance can't be all that bad.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Promit, compare the Mophun games to the Java games :P

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
aldacron,

if somebody say there is no correct answer, than he is right, you state the exact defintion why: It depends on project requirements...
as said before java has pros and cons as every other language... some programms i write in haskell because of speed and mathematic comfort... some guis in vb... a lot in java...
it always depends on project requirements...

overall you can say, java made a big jump in nearly all parts of programming, in some it got best... others have to be compensated... you can write a simple java programm that cann be so damn slow, because you used methods not deigned for that kind of operation, ornot optimized... same could be done in c... a c programm can be fast and slow, depends on programming, plattform (and the programming on it) etc etc...

java is a good language, and there is nothing wrong on trying to do a good 3d engine in java... java will get better and better...
www.wurmonline.com as example, do a online game in java...

Share this post


Link to post
Share on other sites

This topic is 4856 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this