Java for game development?

Started by
43 comments, last by Lazy Foo 17 years, 11 months ago
Hi, Recently I've dived into the wonderfull world of game development on indie level and was wondering some things. Initially I'd planned on learning how to do things with Java (since I have some background in Java), but I'm not entirely convinced Java is the best choice for this. Now my question is, how does java compare to languages like C# and C++ with regards to game development and how widely is it used? Generally im trying to find out if it's wise to stick with Java when it comes to game development. A quick search in the game engine index returned jME (www.jmonkeyengine.com) as best game engine and I must say that I am impressed. With such capabilities why wouldn't people want to use Java? kind regards, Jef
Advertisement
If you have a background in Java just stick to it. Who cares in which language you implement a cool game? The algorithms are the same.
Maybe interesting for you: http://www.bytonic.de/html/jake2.html

For the question why people don't want to use Java: maybe because they already have some source done in another language which they can reuse, maybe because their knowledge is more broaden in another language, maybe because everyone is using another language, maybe there are more examples in other languages, and so on.

But believe me, Java is just fine (as maybe almost any other language).
Quote:Original post by killingdjef
With such capabilities why wouldn't people want to use Java?

Because a lot of people judge java's performance based on how it used to be 10 years ago.
killingdjef,

I would advise against using Java unless you have a particular interest in web games or cell phone games. Why do you ask? Well, because historically that's the only place Java games are used. Additionally, there is a performance difference between Java and C# (C# is 2 to 6 times faster )and especially between Java and C++ (C++ is generally 10 times faster).

If you're interested in a Java-style language you might look at C#. Its a managed language and has all the benefits of Java, in addition to which it has really nice reflection, which can be useful for dynamic coding (a replacement for scripting). C# has DirectX bindings (does java?) so you have access to powerful, hardware accelerated graphics. And finally, C# is already making its way into the game development industry as the primary language for Tool development and to some degree game development.

As an overview...
Java is STILL slower than C++ or C#. You can verify that HERE.
Java isnt used on XBox, Xbox360, or PS2 (though neither is C#)
Java isnt used on (most) commercial PC games unless they're web apps.

Learn either C# or C++...as that is what most industry professionals are using these days.

Cheers and good luck!
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
You can target the XB and PS2 with C#?

EDIT: jwalsh, that "Shootout" you linked to is more than 3 years old, at the least. It can hardly be useful as a benchmark. I think you made Fred's point. They didn't even use JIT java.
smitty1276: Where do you get that it is 3 years old?

According to the website the benchmarks were done with:

Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_03-b02)
Microsoft (R) Visual C# .NET Compiler version 7.00.9466

Unless I'm mistaken those are both 1-2 years old...and even if Java has improved in performance...so has C# and C++ (.NET 2005), unless you're stating that only Java improves in performance over time?

But even if it were 3 years old? Has Java gotten 10 times faster in 3 years? Or are Java games popping up on all consoles? Or perhaps World of Warcraft, GuildWars, Lineage 2, EQ 2, Or ANY other game you find in EB-Games were developed with Java?

Here's a "shootout" for you, perhaps thousands of video games released in the last 3 years...how many of them were Java games....Zero?

The point is the same. The best test of a market trend is to see what the market is doing. Sure, you could argue that "Java is just as good as C#"....but WHY? Would YOU knock on blizzard's door saying "Let me be a game programmer...I know JAVA!" They would politely say "Thanks, but we dont use Java...no one does."
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
To help with your decision, check out some of these Java games:

Tribal Trouble
Puzzle Pirates
Wurm Online

Another great example is Puppy Games. They have some great shooters developed with Java. And if you spend some time at javagaming.org you'll find several others using Java to develop games.

You'll hear a lot of comments like those from jwalsh. He's right that there aren't any Java VMs on consoles yet. But that only matters to people who are developing games for the console market. Generally, that camp does not include indies and hobbyists. He's just dead wrong about the other two points he made. There are several commercial titles out there using Java. Aside from the games I listed aboce, you can find some in the retail space as well. There were a couple of Law & Order games in Java, Red Storm Entertainment used Java for some of their titles, there was a flight Sim coded in Java, and more. Google will help there. Or the games section at java.com. As for the speed point, this whole "java is slow" mantra is old hat. Just ignore it.

If the games I linked above don't prove that Java is a legitimate option I don't know what will. Maybe sales stats for the first year after Tribal Trouble's release? Maybe the fact that UbiSoft picked up PuzzlePirates for distribution in the retail space? Maybe the fact that NCSoft hired two of the developers of the JMonkeyEngine to work on an as yet unannounced project?

I recently wrote a blog entry about choosing a language for game development. I wrote it because people ask questions like this all of the time on these forums. The problem with asking here is that the forum visitors come from diverse backgrounds. Everyone has their favorite languages and are quick to spread misinformation about those they don't use. Really, if someone has never taken the time to really learn a language, then how can they have an informed opinion of it? Most people just parrot what they have hear others say.

The advice I give in my blog post is to avoid asking for language advice in general forums like this. If you want to ask others about the strengths and weaknesses of a language, the best people to ask are the ones who use it. Don't ask them to compare languages. Comparisons will usually result in biased answers and more parroting. Ask Java programmers what they like or don't like about Java. Ask C# programmers about C#. Ask C++ programmers about C++. The answers you get then will be more informed and you will be better able to use their opinions to help you in your decision.

Of course, it's always good to experiment yourself. The more languages you know, the better. But when just starting out to learn game development, it's best to stick with a language you are already familiar with. Learning game dev is hard enough. You don't need to overload yourself with learning a new language at the same time. Once you have the basics and know how to apply the concepts at a high level (i.e. in a language agnostic way), then is the time to start applying those concepts to new languages. Game development concepts don't change from language to language, only the implementation. When it comes time to go commercial, then the language choice becomes important based upon target platform, target market, available tools, and so on.
jwalsh: what in the world? you think "Let me be a game programmer...I know C#!" would work well?? a)that would be the worst interview pitch ever. b)no one uses c# either...except for production tools! exactly where they use java as well.

overall, you win the prize for attempting to start yet another pointless flamefest. the main problem is, every criticism you have of java fits perfectly on c# as well. if pros still can't bear to use STL cause of not deterministic memory use, guess which languages they are *never going to use* for released products. go on, i'll wait. take a guess.




killingdjef: every advantage he listed for C# java has as well (though you'll have to stick to opengl...no problem, many people prefer it (and it works better if you need mac/linux compatability)). moreover, since it sounds like youre just starting off, either language should be pretty quick to get going. if you have experience in java go ahead and use that, plenty of hobbyists use it, even for major projects (jME is one, check out the lwjgl and java game development forums for some more great communities).

if you think youre going to use a lot of premade gui stuff (buttons, forms, etc) you might consider C#, as its UI system is a lot faster to get going and faster to run. if you're going to be doing straight graphics (either to a provided graphics object or with an API like opengl or directx), either language will do.

overall you had the right instinct. java will most likely not be included in a major game any time in the near future...its mostly used by indie projects and as a scripting language for the big boys). developers tend to have large c and c++ codebases, use other peoples engines, or are just plain resistant to change (see above thread...no offence to dave eberly, he's perfectly welcome to his opinion). it is far more important when you're starting out just to go with what you know and just produce something! nothing is more motivating than when your code starts working and first starts becoming playable.

don't listen to idiots, especially ones that think one language is going to get you hired. game development demands that you learn more and more to satisfy it, and you'll find yourself, if you stick with it, learning many new things far more valuable for job prospects than syntax structure.
oops, that STL thread was here
http://www.gamedev.net/community/forums/viewreply.asp?ID=2315762

and what are System.out calls doing in benchmark tests?? but guess what, hes fine, cause he included this disclaimer (note: not to be taken seriously by language fanboys)

Quote: Please note that all the disclaimers, warnings, and notes by Doug apply to this shootout as well. This is ncluding, but not limited to:

* ...some solutions as currently presented are unoptimized...
* ...please take the current results with a grain of salt...
* ...you might even find that I have horrible bugs in my testing method...
* I'm doing it so that I can learn about new languages, compare them in various (possibly meaningless) ways, and most importantly, have some fun.

And, above all:

* "There are lies, damn lies, and benchmarks".

and notes with every language that the benchmarks could be improved.

heres a hint: if your language performs that poorly in the "hello world" test (48th), maybe you shouldnt include a print string call in the other benchmarks!
A finished game in C++/C#/Java/VB/.NET/Python/Perl/Ruby/Torque/Blitz/OpenGL/Direct3D/Assembly/Win32/MFC /logo/Allegro/SDL/BASIC/Dos/XBox/PS2

beats any unfinished
C++/C#/Java/VB/.NET/Python/Perl/Ruby/Torque/Blitz/OpenGL/Direct3D/Assembly/Win32/MFC /logo/Allegro/SDL/BASIC/Dos/XBox/PS2

game.

Don't worry so much about what's "right" or "wrong" for games. Just finish 'em and the rest will fall into place.

This topic is closed to new replies.

Advertisement