Why Java?

I am doing a report for my High School Java class, and was wondering what advantages java gives to game programming.
Thanks ;D

There aren’t any, if anything it makes it more difficult. :smiley: That ought to start a war.

Just kidding, but I’m brain fried right now and can’t think of anything. Actually it might help if you specified a specific type of game programming. For instance:

Online multi-player
2D shoot-em ups
2D adventure
3D FPS
etc.

I was thinking of more of games that are 2D in nature. I was thinking that JAVA makes working in the Windows enviornment easier.

If you are targeting only the windows plattform there are no need to use Java. Then C++ is more mature for game programming. There are one aspect that can make the use of Java as programming language for a game targeting the Windows plattform more interesting and that is that if you feel comfortable with Java as your language it is easy to make a nativ binding with JINI to use the graphical plattform specific things Windows has. Check out LWJGL that both work under Windows and Linux.

But if you would like to target alot of plattform and consoles Java can be a choice but unfortunate the java api hasn’t got a real gaming api yet and therefor it is not as mature as other languages. I hope we will soon see a specific game api in Java that let’s us use hardware acceleration easy.

I disagree…

My primary motivation for using Java is not platform independence - If I can sell my software to 95% of the worlds computers, then that’s good enough for me :P.

No, I use Java because it is by far the most productive language I have ever used (and I have been programming everything from 6510 machine code to C++ over the past 15 years).

It’s probably slower than C++, but C++ is slower than C (asuming you make use of C++ features), C is slower than assembler, yet gamedevelopers have walked that very path, sacrificing performance for reliability and productivity. Sooner or later, gamedevelopers will look at C++ and go: “why the f*** did anyone ever bother with that crap”.

Whether Java is the next step on the evolutionary path of game development remains to be seen, but believe me, C++ is NOT the last.

Ok I agree with the points you make. I only hope that Microsoft loses large parts of their 95% market on operating system so that java can really use its platform independence.

And C++ is not the last step. I hope Java will be the next because I like the language and it makes me more productive , as you stated. But until Sun are more willing to spend some money on creating a stable gaming api in Java, Java will never become the next step.

A few points on Sun and expanding the Java API:

  1. Sun are not actually making money from Java (at least not directly, and not in any major way), so I think we should be happy with what they’ve given us so far, and beg that they focus their future efforts where it makes a difference (VM research). Sun’s efforts on the run-time APIs are somewhere between mediocre and horrible, so let’s not encourage further efforts in that area.

Which leads me to point 2:

  1. AWT, Java2D, Java3D, JavaSound, etc. … Any of these strike you as major advances in any of their respective areas? No, because they aren’t. All have been inferior to what was available for other platforms at their time of release. Sun is just not very good at this, each new API bloats the JRE but adds nothing, because you eventually have to roll your own anyway (LWJGL).

And bloating is, in fact, my 3rd issue with Sun’s API efforts:

  1. I work with Java every day and has been doing so for the past 6 years and I can’t figure out what the hell is part of what “configuration”, “spec”, “api”, “package”, “option” or wtf they call it. How on earth do they expect end-user-joe to figure this out? Everything is over-engineered, over-designed and generalized to the point where it is generally useless.

So, my advice to Sun, and hope for the future, is that they focus all their resources on the Java language, VM and the very very basic of the JRE (basically JRE1.0 minus unnecesarry garbage), and leave everything else to those who know. (I.e. when there’s a perfectly well functioning, open, industry accepted API already available, EMBRACE IT! Yes, I’m thinking OGL vs. J3D here, but there are other examples).

I’ll shut up now - I really don’t enjoy trolling ::), but sometimes it gets the better of me :stuck_out_tongue:

That’s the kind of trolling I like :slight_smile:
There’s some other advantages of Java no-one’s mentioned to our earnest school chum which are along the lines of the ability to run dynamically loaded code in safety. Not only that but the whole VM concept leads to a more stable platform. Very few - OK, none for me even - Java applications have managed to break my computer, but a lot of native things have screwed things royally.

Cas :slight_smile:

Totally forgett about

Thanks for reminding me princec.

Thats one of the great features with java. Easy to dynamically load in plugin modules into Java games makes the life alot easier. And also be able to run them i safety where no evil Java programmers (if there are any ::slight_smile: ) can make a evil plugin and spreding it to n00bie gamers. So no more script languages and the code to parse it ;D

I am currently playing around with a game that uses dynamic loading of classes in two cases. And I always thought classloaders and securitymanagers would give me a headache but it was abit to easy, think I missed something :stuck_out_tongue:

Dynamic class-loading is very neat indeed, something that in C++ you’d be resorting to .dll’s, which gets very annoying for small, pluggable modules >:( At the moment i’ve got a nice dynamic game objects system working (ignoring collision resolution bugs :-[) which means that i can add new object/weapons/bullets etc. by just dropping a couple of extra class files in ;D

Not only can you dynamically load classes, but one of my favorites, is the fact that I can patch a program very easily by just including the class/jar on the classpath, before the original class/jar.

I have heard that there is a 8-10x productivity gain in using Java or C or C++. Mostly due to certain classes of bugs that you don’t get in Java, like pointer corruption or memory leaks from failure to release allocated memory.

My own experience, having used all three languages a lot, is pretty similar. The higher-level the language the easier it is to write things, but the close-to-the-hardware tuning becomes harder. But it also depends on what you are doing with the language. I find it much easier to build large complex systems (e.g. MMO game) involving multithreading and distributed behavior in Java than in C++. But small demoware could be done quickly in either language, depending on what tools and APIs are already available.

And learning Java is a lot easier. And the language is cleaner. YVMV.

–Brad

Evaluating Java for Game Development
goes through alot of what’s been mentioned and then some, including benchmarking different types of games under different VMs as well as C++ implementations and what not.

dry reading perhaps, but relevant.

Hay, looks like Lisp will be the next ph33r tool at least if you believe gamedev.net the reasons? “Lisp invented game programming, OOP, objects and pre-emptive strikes, hence it si teh best tool! LOL U SUK c++ hobo!”

maybe a better question to ask, is why not Java?

[quote]maybe a better question to ask, is why not Java?
[/quote]
Not really, thats like shooting your self in the leg.

Why? Because obviously there are so much better and commonly accepted solutions where you can basically copy and paste the source and “create game” that way. Also Java isn’t professionally very accepted.

When the next u2k3 uses java we can ask why not java.

But if no one ever asks, it never will… :stuck_out_tongue:

The only thing i can say is, pick the language for the job!
There is no perfect language, you just need to pick the best one for the job. :slight_smile:

We wont see a commercial FPS built in java. But we will probally see game tools being built out of java. Tools are perfect for java, because they benifit from all the productivity benifts of java, and don’t need fast graphics.

Now java can use openGL through lwjgl, we can get cool 3D graphics in java fairly fast. Its never going to as fast as c/c++ but for simple projects the benifits of java will out weight the speed loss.

[quote]We wont see a commercial FPS built in java. But we will probally see game tools being built out of java. Tools are perfect for java, because they benifit from all the productivity benifts of java, and don’t need fast graphics.
[/quote]
I disagree.

[quote]Now java can use openGL through lwjgl, we can get cool 3D graphics in java fairly fast. Its never going to as fast as c/c++ but for simple projects the benifits of java will out weight the speed loss.
[/quote]
Well, C++ will never be as fast as straight C. C will never be as fast as assembly. Assembly will never be as fast as machine code. Don’t fall into the trap of thinking that C/C++ is the be-all and end-all of software development!

I’d also say that Java is a greater benefit on the larger and more complex projects, rather than the simple ones.

You might disagree, but denial won’t reveal the whole truth. I’d much rather be open eyed than bound to stupidity with retarded fanboyism.